Renumber `proc_macro` tracking issues
Lots of issue links in the compiler still point to https://github.com/rust-lang/rust/issues/38356 which is a bit of a monster issue that isn't serving much purpose any more. I've split the issue into a number of more fine-grained tracking issues to track stabilizations.
do not promote comparing function pointers
This *could* break existing code that relied on fn ptr comparison getting promoted to `'static` lifetime.
Fixes https://github.com/rust-lang/rust/issues/54696
Re-export `getopts` so custom drivers can reference it.
Otherwise, custom drivers will have to use their own copy of `getopts`, which won't match the types used in `CompilerCalls`.
Use impl_header_lifetime_elision in libcore
The feature is approved for stabilization, so let's use it to remove about 300 `'a`s.
Tracking issue for the feature: https://github.com/rust-lang/rust/issues/15872
make run-pass tests with empty main just compile-pass tests
Many run-pass tests have an empty main, so there is not actually any point in running them. This makes them `compile-pass` tests instead, saving some time (generating the binary and then running it).
For now I did this only for `run-pass/issues`; if there is interest I can also do it for the other directories. I used `^\s*fn\s+main\(\s*\)\s*\{\s*\}` as regexp to identify these files.
Add `crate::` to trait suggestions in Rust 2018.
Fixes#54559.
In the 2018 edition, when suggesting traits to import that implement a
given method that is being invoked, suggestions will now include the
`crate::` prefix if the suggested trait is local to the current crate.
r? @nikomatsakis
Allow both explicit and elided lifetimes in the same impl header
While still prohibiting explicit and in-band in the same header.
Fixes#54456
As usual, I don't know the broader context of the code I'm changing, so please let me know whatever I can do better.
Pre-existing test that mixing explicit and in-band remains an error: https://github.com/rust-lang/rust/blob/master/src/test/ui/in-band-lifetimes/E0688.rs
#53840: Consolidate pattern check errors
#53840 on this PR we are aggregating `cannot bind by-move and by-ref in the same pattern` message present on the different lines into one diagnostic message. Here we are first gathering those `spans` on `vector` then we are throwing them with the help of `MultiSpan`
r? @estebank
Addresses: #53480
This commit fixes an oddity on the wasm target where LTO can produce
working executables but plain old optimizations doesn't. The compiler
already knows what set of symbols it would like to export, but LLD only
discovers this list transitively through symbol visibilities. LLD may
not, however, always find all the symbols that we'd like to export.
For example if you depend on an rlib with a `#[no_mangle]` symbol, then
if you don't actually use anything from the rlib then the symbol won't
appear in the final artifact! It will appear, however, with LTO. This
commit attempts to rectify this situation by ensuring that all symbols
rustc would otherwise preserve through LTO are also preserved through
the linking process with LLD by default.
we are consolidating `cannot bind by-move and by-ref in the same
pattern` message present on the different lines into single diagnostic
message.
To do this, we are first gathering those spans into the vector
after that we are throwing them with the help of MultiSpan in
a separate block.
Addresses: #53840
normalize param-env type-outlives predicates last
The normalization of type-outlives predicates can depend on misc.
environment predicates, but not the other way around. Inferred lifetime
bounds can propagate type-outlives bounds far and wide, so their
normalization needs to work well.
Fixes#54467
r? @nikomatsakis
beta-nominating because this is required for inferred_outlives_bounds, which is in beta
This commit takes a different approach to add the `crate::` prefix to
item paths than previous commits. Previously, recursion was stopped
after a prelude crate name was pushed to the path. It is theorized that
this was the cause of the linking issues since the same path logic is
used for symbol names and that not recursing meant that details were
being missed that affect symbol names. As of this commit, instead of
ceasing recursion, a flag is passed through to any subsequent recursive
calls so that the same effect can be achieved by checking that flag.
Avoid hardcoding and special-casing the `std` crate name in the item
path logic by moving the prelude crate name logic into the `Session`
type so it can be reused in the item path logic and resolve module.
In the 2018 edition, when suggesting traits to import that implement a
given method that is being invoked, suggestions will now include the
`crate::` prefix if the suggested trait is local to the current crate.
This commit improves mutability error suggestions by suggesting the
removal of `&mut` where a mutable borrow is being taken of a `&mut self`
or a `self: &mut Self`.
This commit adds an `ImplicitSelfKind` to the HIR and the MIR that keeps
track of whether a implicit self argument is immutable by-value, mutable
by-value, immutable reference or mutable reference so that the addition
of the `mut` keyword can be suggested for the immutable by-value case.
do not normalize all non-scalar constants to a ConstValue::ScalarPair
We still need `ConstValue::ScalarPair` for match handling (matching slices and strings), but that will never see anything `Undef`. For non-fat-ptr `ScalarPair`, just point to the allocation like larger data structures do.
Fixes https://github.com/rust-lang/rust/issues/54387
r? @eddyb
The normalization of type-outlives predicates can depend on misc.
environment predicates, but not the other way around. Inferred lifetime
bounds can propagate type-outlives bounds far and wide, so their
normalization needs to work well.
Fixes#54467
Panic when using mem::uninitialized or mem::zeroed on an uninhabited type
All code by @japaric. This re-submits one half of https://github.com/rust-lang/rust/pull/53508. This is likely not the one that introduced the perf regression, but just to be sure I'll do a perf run anyway.
This commit special cases the move out of borrowed content error,
previously:
```
error[E0507]: cannot move out of borrowed content
--> src/main.rs:7:10
|
7 | drop(x.field);
| ^ cannot move out of borrowed content
```
to instead mention that it is a move out of a `Rc`/`Arc` which is more
helpful:
```
error[E0507]: cannot move out of an `Rc`
--> src/main.rs:7:10
|
7 | drop(x.field);
| ^ cannot move out of an `Rc`
```
This commit introduces language items for `Arc` and `Rc` so that types
can later be checked to be `Arc` or `Rc` in the NLL borrow checker. The
`lang` attribute is currently limited to `stage1` as it requires a
compiler built with knowledge of the expected language items.
Rollup of 13 pull requests
Successful merges:
- #53784 (Document that slices cannot be larger than `isize::MAX` bytes)
- #54308 (Better user experience when attempting to call associated functions with dot notation)
- #54488 (in which we include attributes in unused `extern crate` suggestion spans)
- #54544 (Indicate how to move value out of Box in docs.)
- #54623 (Added help message for `impl_trait_in_bindings` feature gate)
- #54641 (A few cleanups and minor improvements to rustc/infer)
- #54656 (Correct doc for WorkQueue<T>::pop().)
- #54674 (update miri)
- #54676 (Remove `-Z disable_ast_check_for_mutation_in_guard`)
- #54679 (Improve bug! message for impossible case in Relate)
- #54681 (Rename sanitizer runtime libraries on OSX)
- #54708 (Make ./x.py help <cmd> invoke ./x.py <cmd> -h on its own)
- #54713 (Add nightly check for tool_lints warning)
Remove `-Z disable_ast_check_for_mutation_in_guard`
One should use `#![feature(bind_by_move_pattern_guards)]` over `-Z disable_ast_check_for_mutation_in_guard`
cc #15287
Rename sanitizer runtime libraries on OSX
Currently we ship sanitizer libraries as they're built, but these names
unfortunately conflict with the names of the sanitizer libraries
installed on the system. If a crate, for example, links in C code that
wants to use the system sanitizer and the Rust code doesn't use
sanitizers at all, then using `cargo` may accidentally pull in the
Rust-installed sanitizer library due to a conflict in names.
This change is intended to be entirely transparent for Rust users of
sanitizers, it should only hopefully improve our story with other users!
Closes#54134