Commit Graph

83315 Commits

Author SHA1 Message Date
Otto Rask
5399616f1d Make Arc cloning mechanics clearer in module docs
Add some more wording to module documentation regarding how
`Arc::clone()` works, as some users have assumed cloning Arc's
to work via dereferencing to inner value as follows:

    use std::sync::Arc;

    let myarc = Arc::new(1);
    let myarcref = myarc.clone();

    assert!(1 == myarcref);

Instead of the actual mechanic of referencing the existing
Arc value:

    use std::sync::Arg;

    let myarc = Arc::new(1);
    let myarcref = myarc.clone();

    assert!(myarcref == &myarc); // not sure if assert could assert this
    in the real world
2018-08-29 13:20:56 +03:00
Matthias Krüger
50057ee3a3 bench: libcore: fix build failure of any.rs benchmark (use "dyn Any") 2018-08-29 12:18:05 +02:00
bors
ca0de63898 Auto merge of #53711 - arielb1:macro-table, r=michaelwoerister
create a valid DefIdTable for proc macro crates

At least the incremental compilation code, and a few other places in the
compiler, require the CrateMetadata for a loaded target crate to contain a
valid DefIdTable for the DefIds in the target.

Previously, the CrateMetadata for a proc macro contained the crate's
"host" DefIdTable, which is of course incompatible with the "target"
DefIdTable, causing ICEs. This creates a DefIdTable that properly refers
to the "proc macro" DefIds.

Fixes #49482.

r? @michaelwoerister

Should we beta-nominate this?
2018-08-29 08:42:20 +00:00
Ralf Jung
b06a8db26e audit the relocations code, and clean it up a little 2018-08-29 10:09:53 +02:00
Ralf Jung
365b90c637 refactor memory access methods a bit 2018-08-29 08:44:37 +02:00
Ralf Jung
1d498d5a43 make ptr_op finally reponsible for all ops involving pointers; make ValTy constructor private
Also remove public OpTy constructors, but a pub(crate) constructor remains
2018-08-29 08:44:37 +02:00
Ralf Jung
ec056d5188 re-do argument passing one more time to finally be sane 2018-08-29 08:44:37 +02:00
Ralf Jung
b8a40aad1b memory: make getting the alloc for a static an associate function for easier calling 2018-08-29 08:44:37 +02:00
Ralf Jung
cdeef61425 move some Scalar helpers from miri here, and use them where appropriate 2018-08-29 08:44:37 +02:00
bors
f4e981cfe4 Auto merge of #53684 - alexcrichton:suggest-remove, r=oli-obk
rustc: Suggest removing `extern crate` in 2018

This commit updates the `unused_extern_crates` lint to make automatic
suggestions about removing `extern crate` annotations in the 2018 edition. This
ended up being a little easier than originally though due to what's likely been
fixed issues in the resolver!

Closes #52829
2018-08-29 06:24:30 +00:00
bors
29e6aabceb Auto merge of #53659 - nnethercote:rm-AccumulateVec, r=Mark-Simulacrum
Remove `AccumulateVec` and its uses.

It's basically just a less capable version of `SmallVec`.

FWIW, the only use of `ArrayVec` is now within `HybridIdxSet`.

r? @Mark-Simulacrum
2018-08-29 04:20:01 +00:00
bors
9d69e81e9b Auto merge of #53642 - alexcrichton:fix-target-cpu-native, r=arielb1
Fix warnings about the `native` target-cpu

This fixes a regression from #53031 where specifying `-C target-cpu=native` is
printing a lot of warnings from LLVM about `native` being an unknown CPU. It
turns out that `native` is indeed an unknown CPU and we have to perform a
mapping to an actual CPU name, but this mapping is only performed in one
location rather than all locations we inform LLVM about the target CPU.

This commit centralizes the mapping of `native` to LLVM's value of the native
CPU, ensuring that all locations we inform LLVM about the `target-cpu` it's
never `native`.

Closes #53322
2018-08-29 02:08:02 +00:00
bors
f1d02c3073 Auto merge of #53671 - RalfJung:miri-refactor, r=oli-obk
Miri engine cleanup

* Unify the two maps in memory to store the allocation and its kind together.
* Share the handling of statics between CTFE and miri: The miri engine always
      uses "lazy" `AllocType::Static` when encountering a static.  Acessing that
      static invokes CTFE (no matter the machine).  The machine only has any
      influence when writing to a static, which CTFE outright rejects (but miri
      makes a copy-on-write).
* Add an `AllocId` to by-ref consts so miri can use them as operands without
      making copies.
* Move responsibilities around for the `eval_fn_call` machine hook: The hook
      just has to find the MIR (or entirely take care of everything); pushing the
      new stack frame is taken care of by the miri engine.
* Expose the intrinsics and lang items implemented by CTFE so miri does not
      have to reimplement them.
* Allow Machine to hook into foreign statics (used by miri to get rid of some other hacks).
* Clean up function calling.
* Switch const sanity check to work on operands, not mplaces.
* Move const_eval out of rustc_mir::interpret, to make sure that it does not access private implementation details.

In particular, we can finally make `eval_operand` take `&self`. :-)

Should be merged after https://github.com/rust-lang/rust/pull/53609, across which I will rebase.
2018-08-29 00:02:37 +00:00
Nicholas Nethercote
8cecfa62e8 Remove AccumulateVec and its uses.
It's basically just a less capable version of `SmallVec`.
2018-08-29 08:32:11 +10:00
Philip Daniels
0902fc88db Add rust-gdbgui script.
This script invokes the gdbgui graphical GDB front-end
with the Rust pretty printers loaded. The script does not install
gdbgui, that must be done manually.
2018-08-28 22:05:04 +01:00
Alex Crichton
1fd45a13de Fix warnings about the native target-cpu
This fixes a regression from #53031 where specifying `-C target-cpu=native` is
printing a lot of warnings from LLVM about `native` being an unknown CPU. It
turns out that `native` is indeed an unknown CPU and we have to perform a
mapping to an actual CPU name, but this mapping is only performed in one
location rather than all locations we inform LLVM about the target CPU.

This commit centralizes the mapping of `native` to LLVM's value of the native
CPU, ensuring that all locations we inform LLVM about the `target-cpu` it's
never `native`.

Closes #53322
2018-08-28 13:32:11 -07:00
Philipp Krones
fa75111043
Also link Clippy repo in the CONTRIBUTING.md file 2018-08-28 20:43:10 +02:00
Guillaume Gomez
da4febd51e Add partialeq implementation for TryFromIntError type 2018-08-28 20:40:14 +02:00
Ralf Jung
6628d39f4a move file-extension based .gitignore down to src/ 2018-08-28 20:04:52 +02:00
Ralf Jung
c9b5fac7da first test const-ness, then hook fn call 2018-08-28 19:57:05 +02:00
Ralf Jung
506dd7058c fix const_prop detecting unary neg underflows 2018-08-28 19:57:05 +02:00
Ralf Jung
e6a5a9418a restructure unary_op to also dispatch on type first; fix promotion with unary '-' overflowing 2018-08-28 19:57:05 +02:00
Ralf Jung
066d2eea25 fix unsized extern types 2018-08-28 19:57:05 +02:00
Ralf Jung
f96208ca5b address nits 2018-08-28 19:57:05 +02:00
bors
7061b27757 Auto merge of #53679 - japaric:cortex-r, r=alexcrichton
add more Cortex-R targets

This expands on PR #53663 to complete the set of Cortex-R targets and builds
rust-std components for them.

r? @alexcrichton

each extra rust-std component (there's 4 of them) takes about 3 minutes to build
on my local machine. In terms of stability (LLVM codegen bugs) these new targets
should be as stable as the Cortex-M ones (e.g. `thumbv7m-none-eabi`).

If the extra build time is too much we can leave the rust-std components out for
now

closes #53663
cc @paoloteti
2018-08-28 16:23:27 +00:00
Eduard-Mihai Burtescu
93f3f5b155 Use FxHash{Map,Set} instead of the default Hash{Map,Set} everywhere in rustc. 2018-08-28 17:04:04 +03:00
MaloJaffre
1908892d3f Fix tidy 2018-08-28 15:59:21 +02:00
MaloJaffre
1a1a7f6167 Add docs and debug asserts 2018-08-28 15:38:56 +02:00
bors
ec4a752202 Auto merge of #53493 - matthewjasper:hair-spans, r=nikomatsakis
Use smaller span for adjustments on block expressions

When returning a mutable reference don't use the entire body of the function as the span for the adjustments at the end.

The error [in this case](https://github.com/rust-lang/rust/compare/master...matthewjasper:hair-spans?expand=1#diff-ecef8b1f15622fb48a803c9b61605c78) is worse, but neither error message is really what we want. I have some ideas on how to get a better error message that will have to wait for a future PR.
2018-08-28 13:12:16 +00:00
Jorge Aparicio
84796cbc01 sort 2018-08-28 14:58:52 +02:00
Oliver Schneider
f318ba2d2f
Warn about naively fixing the FIXME 2018-08-28 14:04:07 +02:00
Oliver Schneider
0ed8e16195 Use partial but correct vtable layout 2018-08-28 13:15:22 +02:00
bors
83ddc33347 Auto merge of #53314 - nikomatsakis:nll-invert-liveness, r=pnkfelix
NLL: experiment with inverting liveness

I got inspired to see what would happen here.

Fixes #52460

r? @pnkfelix
2018-08-28 10:58:10 +00:00
Dimitri Merejkowsky
13113391a0 Fix typo in comment 2018-08-28 11:06:40 +02:00
Felix S. Klock II
8d231ec872 Fix definition of LocalUseMapBuild so that it can build under stage0,
which does not have as many feature gates enabled.
2018-08-28 10:59:15 +02:00
Ralf Jung
31b63d0ca8 split paragraph 2018-08-28 10:49:45 +02:00
Ralf Jung
e6dcdee7d9 expand keep-stage --help text 2018-08-28 10:20:24 +02:00
bors
59e52b1b96 Auto merge of #53616 - varkor:hir-map-rename, r=nikomatsakis
Restructure hir::map::Node and hir::map::Entry

- Moves `hir::map::Node` to `hir::Node` and removes the `Node*` prefix from its variants.
- Changes `hir::map::Entry` to a struct `hir::map::Entry`.
- Removes the `Node*` prefix from each of `AnnNode`s variants.

r? @eddyb
2018-08-28 06:44:12 +00:00
bors
ca63a4e438 Auto merge of #53404 - oconnor663:current_dir_behavior, r=alexcrichton
document the platform-specific behavior of Command::current_dir

See also https://github.com/rust-lang/rust/issues/37868.

Here's my initial wording:

> Note that if the program path is relative (e.g. `"./script.sh"`), the interaction between that path and `current_dir` varies across platforms. Windows currently ignores `current_dir` when locating the program, but Unix-like systems interpret the program path relative to `current_dir`. These implementation details aren't considered stable, and it's recommended to call `canonicalize` to get an absolute program path instead of using relative paths and `current_dir` together.

I'd like to get feedback on:

- _Should_ we consider those details stable? It might be disruptive to change them, regardless of what I can get away with claiming in docs :)
- Is `canonicalize` an appropriate recommendation? As discussed in #37868 above, there are reasons it's not called automatically in the `Command` implementation.
2018-08-28 03:22:21 +00:00
bors
f33921ba58 Auto merge of #53272 - mark-i-m:anon_param_error_now, r=nikomatsakis
Warn on anon params in 2015 edition

cc #41686 https://github.com/rust-lang/rfcs/pull/2522
cc  @Centril @nikomatsakis

TODO:
- [x] Make sure the tests pass.
- [x] Make sure there is rustfix-able suggestion. Current plan is to just suggest `_ : Foo`
- [x] Add a rustfix ui test.

EDIT: It seems I already did the last two in #48309
2018-08-28 01:04:05 +00:00
bors
8c2b371ebc Auto merge of #53227 - nivkner:pin_move, r=RalfJung
move the Pin API into its own module for centralized documentation

This implements the change proposed by @withoutboats in #49150, as suggested by @RalfJung in the review of #53104,
along with the documentation that was originally in it, that was deemed more appropriate in module-level documentation.

r? @RalfJung
2018-08-27 22:56:15 +00:00
Niko Matsakis
f77ad5c6e5 remove let x = baz which was obscuring the real error 2018-08-27 17:48:52 -04:00
varkor
a9d075e756 Revert crate root changes 2018-08-27 21:46:23 +01:00
varkor
6642462ef6 Make small modifications 2018-08-27 21:46:23 +01:00
varkor
e2a1cce9c5 Rename hir::map::NodeKind to hir::Node 2018-08-27 21:46:23 +01:00
varkor
ecbdfb4988 Convert EntryKind to a struct, Entry 2018-08-27 21:46:13 +01:00
varkor
11665ca45a Remove path prefixes from NodeKind 2018-08-27 21:46:13 +01:00
varkor
4b12f700db Remove Node* prefix from AnnNode 2018-08-27 21:45:46 +01:00
varkor
befc4b1100 Rename hir::map::Node to hir::map::NodeKind 2018-08-27 21:45:46 +01:00
varkor
a1a338faab Rename MapEntry to EntryKind 2018-08-27 21:45:46 +01:00