Step stage0 to bootstrap from 1.42
This also includes a commit which fixes the rustfmt downloading logic to redownload when the rustfmt channel changes, and bumps rustfmt to a more recent version.
This commit reduces the size of `Nonterminal` from a whopping 240 bytes
to 72 bytes (on x86-64), which gets it below the `memcpy` threshold.
It also removes some impedance mismatches with `Annotatable`, which
already uses `P` for these variants.
```
error[E0412]: cannot find type `T` in this scope
--> file.rs:3:12
|
3 | impl Trait<T> for Struct {}
| - ^ not found in this scope
| |
| help: you might be missing a type parameter: `<T>`
```
Fix#64298.
This doesn't mention that using an existing lifetime is possible, but
that would hopefully be clear as always being an option. The intention
of this is to teach newcomers what the lifetime syntax is.
Clean up some diagnostics by making them more consistent
In general:
- Diagnostic should start with a lowercase letter.
- Diagnostics should not end with a full stop.
- Ellipses contain three dots.
- Backticks should encode Rust code.
I also reworded a couple of messages to make them read more clearly.
It might be sensible to create a style guide for diagnostics, so these informal conventions are written down somewhere, after which we could audit the existing diagnostics.
r? @Centril
Extract `rustc_hir` out of `rustc`
The new crate contains:
```rust
pub mod def;
pub mod def_id;
mod hir;
pub mod hir_id;
pub mod itemlikevisit;
pub mod pat_util;
pub mod print;
mod stable_hash_impls;
pub use hir::*;
pub use hir_id::*;
pub use stable_hash_impls::HashStableContext;
```
Remains to be done in follow-up PRs:
- Move `rustc::hir::map` into `rustc_hir_map` -- this has to be a separate crate due to the `dep_graph` (blocked on https://github.com/rust-lang/rust/pull/67761).
- Move references to `rustc::hir` to `rustc_hir` where possible.
cc https://github.com/rust-lang/rust/issues/65031
r? @Zoxc
Nix reexports from `rustc_span` in `syntax`
Remove reexports `syntax::{source_map, symbol, edition}` and use `rustc_span` paths directly.
r? @petrochenkov
Suggest calling method when first argument is `self`
Closes: #66782
I've explored different approaches for this MR but I think the most straightforward is the best one.
I've tried to find out if the methods for given type exist (to maybe have a better suggestion), but we don't collect them anywhere and collecting them is quite problematic. Moreover, collecting all the methods would require rewriting big part of the code and also could potentially include performance degradation, which I don't think is necessary for this simple case.
Make GATs less ICE-prone.
After this PR simple lifetime-generic associated types can now be used in a compiling program. There are two big limitations:
* #30472 has not been addressed in any way (see src/test/ui/generic-associated-types/iterable.rs)
* Using type- and const-generic associated types errors because bound types and constants aren't handled by trait solving.
* The errors are technically non-fatal, but they happen in a [part of the compiler](4abb0ad273/src/librustc_typeck/lib.rs (L298)) that fairly aggressively stops compiling on errors.
closes#47206closes#49362closes#62521closes#63300closes#64755closes#67089
Add options to --extern flag.
This changes the `--extern` flag so that it can take a series of options that changes its behavior. The general syntax is `[opts ':'] name ['=' path]` where `opts` is a comma separated list of options. Two options are supported, `priv` which replaces `--extern-private` and `noprelude` which avoids adding the crate to the extern prelude.
```text
--extern priv:mylib=/path/to/libmylib.rlib
--extern noprelude:alloc=/path/to/liballoc.rlib
```
`noprelude` is to be used by Cargo's build-std feature in order to use `--extern` to reference standard library crates.
This also includes a second commit which adds the `aux-crate` directive to compiletest. I can split this off into a separate PR if desired, but it helps with defining these kinds of tests. It is based on #54020, and can be used in the future to replace and simplify some of the Makefile tests.