Dont compute `opt_suggest_box_span` span for TAIT
Fixes#112434
Also a couple more commits on top, pruning some dead code and fixing another weird suggestion encountered in the above issue.
This has real differences in the effective debuginfo: in particular, it omits the module-level information and breaks perf.
Allow passing `line-tables-only` directly in config.toml instead.
rustdoc: Add `item_template` macro
Closes#112021
This change removes the use of `self.borrows()` in Askama templates, removes code duplication from `item_and_mut_cx()`, and improved readability by eliminating the prefix `item_template_` when calling from the template.
References:
- Discussion issue: https://github.com/rust-lang/rust/issues/112021
- `ItemTemplate` PR: https://github.com/rust-lang/rust/pull/111946
r? `@GuillaumeGomez`
Rollup of 7 pull requests
Successful merges:
- #112475 (Fix issue for module name when surround the struct literal with parentheses)
- #112477 (Give more helpful progress messages in `Assemble`)
- #112484 (Fix ntdll linkage issues on Windows UWP platforms)
- #112492 (Migrate GUI colors test to original CSS color format)
- #112493 (iat selection: normalize self ty & completely erase bound vars)
- #112497 (abs_sub: fix typo 0[-:][+.]0)
- #112498 (Update links to Rust Reference in diagnostic)
r? `@ghost`
`@rustbot` modify labels: rollup
iat selection: normalize self ty & completely erase bound vars
Erase bound vars (most notably late-bound regions) irrespective of their binding level instead of just at the innermost one.
Fixes#111404.
Fix ntdll linkage issues on Windows UWP platforms
See discussion: https://github.com/rust-lang/rust/issues/112265#issuecomment-1575479683
Static loading `ntdll` functions does not work for UWP programs, which will end up link errors complaining about missing symbols, or failure to pass the WACK tests. The breakage was introduced in #108262.
This PR basically reverts part of the changes in #108262 for UWP only, and fixes some lint suggestions.
Give more helpful progress messages in `Assemble`
Before (download-rustc):
```
# no output
```
After (download-rustc):
```
Creating a sysroot for stage2 compiler (use `rustup toolchain link 'name' build/host/stage2`)
```
Before (compiling from source):
```
Building compiler artifacts (stage0 -> stage1, x86_64-unknown-linux-gnu)
Assembling stage1 compiler
Build stage1 library artifacts (x86_64-unknown-linux-gnu -> i686-unknown-linux-gnu)
Building compiler artifacts (stage0:x86_64-unknown-linux-gnu -> stage1:i686-unknown-linux-gnu)
Assembling stage1 compiler (i686-unknown-linux-gnu)
```
After (compiling from source):
```
Building compiler artifacts (stage0 -> stage1, x86_64-unknown-linux-gnu)
Creating a sysroot for stage1 compiler (use `rustup toolchain link 'name' build/host/stage1`)
Build stage1 library artifacts (x86_64-unknown-linux-gnu)
Building compiler artifacts (stage0:x86_64-unknown-linux-gnu -> stage1:i686-unknown-linux-gnu)
Creating a sysroot for stage1 compiler (i686-unknown-linux-gnu) (use `rustup toolchain link 'name' build/i686-unknown-linux-gnu/stage1`)
```
cc https://rust-lang.zulipchat.com/#narrow/stream/122651-general/topic/Unable.20to.20compile.20rustc.20MSVC, https://discord.com/channels/273534239310479360/957720175619215380/1116867245499498506
Don't compile rustc to self-test compiletest
This was changed from stage 0 to 1 in https://github.com/rust-lang/rust/pull/108905, but I'm not sure why. Change it to `top_stage` instead to allow people to choose the stage.
This should save quite a bit of time in the `mingw-check` builder, which explicitly runs `x test --stage 0 compiletest`.
Note that this also fixes a latent bug that depended on running `x build compiler` before `x doc compiler`, as well as a couple cleanups related to symlinks (which made the latent bug easier to find).
cc `@pietroalbini`
rustdoc: re-elide cross-crate default trait-object lifetime bounds
Hide trait-object lifetime bounds (re-exported from an external crate) if they coincide with [their default](https://doc.rust-lang.org/reference/lifetime-elision.html#default-trait-object-lifetimes).
Partially addresses #44306. Follow-up to #103885. [Zulip discussion](https://rust-lang.zulipchat.com/#narrow/stream/266220-rustdoc/topic/clean_middle_ty.3A.20I.20need.20to.20add.20a.20parameter/near/307143097).
Most notably, if `std` exported something from `core` containing a type like `Box<dyn Fn()>`, then it would now be rendered as `Box<dyn Fn(), Global>` instead of `Box<dyn Fn() + 'static, Global>` (hiding `+ 'static` as it is the default in this case). Showing `Global` here is a separate issue, #80379, which is on my agenda.
Note that I am not really fond of the fact that I had to add a parameter to such a widely used function (30+ call sites) to address such a niche bug.
CC `@GuillaumeGomez`
Requesting a review from a compiler contributor or team member as recommended on Zulip.
r? compiler
---
`@rustbot` label T-compiler T-rustdoc A-cross-crate-reexports
Make the build process more beginner friendly:
- Include information explaining that the stage2 toolchain should be
used (and not the stage1 toolchain) due to the `download-rustc`
setting.
- Display a message when the user runs `x setup tools` explaining that
they should use the stage2 toolchain.
Instead of linking to the old Rust Reference site on static.rust-lang.org,
link to the current website doc.rust-lang.org/stable/reference instead in
diagnostic about incorrect literals.
Add deprecation warning to python versions <3.6 in x.py
Introduced based on conversation on Zulip. This is a repeat of #110439 with two changes:
- Warning rather than exit
- Can be suppressed via an environment variable
The min to not get the warning is set to 3.6 because that's a fairly recent "old" version (went EOL in 2021) and it's the first version to support useful modern features like f-strings and type hints.
cc `@Nilstrieb` (author of #110439) and `@Mark-Simulacrum` (reviewer of that PR)
Adjust span labels for `HIDDEN_GLOB_REEXPORTS`
Addresses https://github.com/rust-lang/rust/pull/111378#issuecomment-1581226063.
### Before This PR
The possibility that the private item comes before the glob re-export was not account for, causing the span label messages to say "but private item here shadows it" before "the name `Foo` in the type namespace is supposed to be publicly re-exported here".
### After This PR
```rust
warning: private item shadows public glob re-export
--> $DIR/hidden_glob_reexports.rs:9:5
|
LL | struct Foo;
| ^^^^^^^^^^^ the private item here shadows the name `Foo` in the type namespace
...
LL | pub use self::inner::*;
| -------------- but it is supposed to be publicly re-exported here
|
= note: `#[warn(hidden_glob_reexports)]` on by default
warning: private item shadows public glob re-export
--> $DIR/hidden_glob_reexports.rs:27:9
|
LL | pub use self::inner::*;
| -------------- the name `Foo` in the type namespace is supposed to be publicly re-exported here
LL |
LL | use self::other::Foo;
| ^^^^^^^^^^^^^^^^ but the private item here shadows it
```
Update field-offset and enable unstable_offset_of
This makes the compiler use the builtin `offset_of!()` macro, through the wrappers in memoffset and then in field-offset.
cc #111839
bootstrap: Disallow `--exclude test::std`
Use the top-level Kind to determine whether Steps are excluded.
Previously, this would use the `Kind` passed to `--exclude` (and not do any filtering at all if no kind was passed).
That meant that `x test linkchecker --exclude std` would fail - you had to explicitly say `--exclude test::std`.
Change bootstrap to use the top-level Kind instead, which does the right thing automatically.
Note that this breaks things like `x test --exclude doc::std`, but I'm not sure why you'd ever want to do that.
There's a lot of churn here, but the 1-line change in the first commit is the actual behavior change, the rest is just cleanup.
Fixes https://github.com/rust-lang/rust/issues/103201. Note that this effectively reverts most of https://github.com/rust-lang/rust/pull/91965.
cc `@pietroalbini`
Uplift `clippy::cmp_nan` lint
This PR aims at uplifting the `clippy::cmp_nan` lint into rustc.
## `invalid_nan_comparisons`
~~(deny-by-default)~~ (warn-by-default)
The `invalid_nan_comparisons` lint checks comparison with `f32::NAN` or `f64::NAN` as one of the operand.
### Example
```rust,compile_fail
let a = 2.3f32;
if a == f32::NAN {}
```
### Explanation
NaN does not compare meaningfully to anything – not even itself – so those comparisons are always false.
-----
Mostly followed the instructions for uplifting a clippy lint described here: https://github.com/rust-lang/rust/pull/99696#pullrequestreview-1134072751
`@rustbot` label: +I-lang-nominated
r? compiler