Tweak wording of E0275 WF errors
Modify the main error message to read better:
```
error[E0275]: overflow evaluating whether `&'a mut Bar` is well-formed
```
Add regression test for TransmuteFrom ICE with min_generic_const_args
Regression test for rust-lang/rust#150457.
The wfcheck ICE with TransmuteFrom + min_generic_const_args was fixed by rust-lang/rust#150707 but didn't get a test.
Closesrust-lang/rust#150457
Add regression test for recursive lazy type alias normalization ICE
Regression test for rust-lang/rust#152633.
The normalization ICE with recursive lazy_type_alias + min_generic_const_args was fixed by rust-lang/rust#152040 but didn't get a test. Compiler now reports E0275 instead of crashing.
Closesrust-lang/rust#152633
Make typeck a tcx method which calls typeck_root query
Currently typeck query itself calls `tcx.typeck(tcx.typeck_root_def_id(key))` if its key isn't a type-check root. I thought this might be an overhead and made typeck a tcx method which calls typeck_root query instead.
This is a step to simplify `cache_on_disk_if` query modifier.
@petrochenkov please run perf
move many tests from `structs-enums` to `structs` or `enum`
This PR moves most of the tests in `ui/structs-enums` that are only about structs or only about enums to their respective directory, as a step towards removing `ui/structs-enums`.
Followup to rust-lang/rust#154131.
r? @Kivooeo
Fix ice in rustdoc of private reexport
Fixesrust-lang/rust#154383
The root cause is rustdoc could still try to resolve links for source docs that resolver did not cache in `ResolveDocLinks::Exported` mode. The test case will not crash with `--document-private-items` option, which will use `ResolveDocLinks::All`.
The fix makes rustdoc skip link resolution based on the source `DefId` of each doc fragment, so its behavior stays aligned with resolver's logic here: https://github.com/chenyukang/rust/blob/dc5cb1719eed6ac9275fe93d914d32141606b2ac/compiler/rustc_resolve/src/late.rs#L685
simd_fmin/fmax: make semantics and name consistent with scalar intrinsics
This is the SIMD version of https://github.com/rust-lang/rust/pull/153343: change the documented semantics of the SIMD float min/max intrinsics to that of the scalar intrinsics, and also make the name consistent. The overall semantic change this amounts to is that we restrict the non-determinism: the old semantics effectively mean "when one input is an SNaN, the result non-deterministically is a NaN or the other input"; the new semantics say that in this case the other input must be returned. For all other cases, old and new semantics are equivalent. This means all users of these intrinsics that were correct with the old semantics are still correct: the overall set of possible behaviors has become smaller, no new possible behaviors are being added.
In terms of providers of this API:
- Miri, GCC, and cranelift already implement the new semantics, so no changes are needed.
- LLVM is adjusted to use `minimumnum nsz` instead of `minnum`, thus giving us the new semantics.
In terms of consumers of this API:
- Portable SIMD almost certainly wants to match the scalar behavior, so this is strictly a bugfix here.
- Stdarch mostly stopped using the intrinsic, except on nvptx, where arguably the new semantics are closer to what we actually want than the old semantics (https://github.com/rust-lang/stdarch/issues/2056).
Q: Should there be an `f` in the intrinsic name to indicate that it is for floats? E.g., `simd_fminimum_number_nsz`?
Also see https://github.com/rust-lang/rust/issues/153395.
Merge `fabsf16/32/64/128` into `fabs::<F>`
Following [a small conversation on Zulip](https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/Float.20intrinsics/with/521501401) (and because I'd be interested in starting to contribute on Rust), I thought I'd give a try at merging the float intrinsics :)
This PR just merges `fabsf16`, `fabsf32`, `fabsf64`, `fabsf128`, as it felt like an easy first target.
Notes:
- I'm opening the PR for one intrinsic as it's probably easier if the shift is done one intrinsic at a time, but let me know if you'd rather I do several at a time to reduce the number of PRs.
- Currently this PR increases LOCs, despite being an attempt at simplifying the intrinsics/compilers. I believe this increase is a one time thing as I had to define new functions and move some things around, and hopefully future PRs/commits will reduce overall LoCs
- `fabsf32` and `fabsf64` are `#[rustc_intrinsic_const_stable_indirect]`, while `fabsf16` and `fabsf128` aren't; because `f32`/`f64` expect the function to be const, the generic version must be made indirectly stable too. We'd need to check with T-lang this change is ok; the only other intrinsics where there is such a mismatch is `minnum`, `maxnum` and `copysign`.
- I haven't touched libm because I'm not familiar with how it works; any guidance would be welcome!
stabilizes `core::range::RangeFrom`
stabilizes `core::range::RangeFromIter`
add examples for `remainder` method on range iterators
`RangeFromIter::remainder` was not stabilized (see issue 154458)
Rollup of 11 pull requests
Successful merges:
- rust-lang/rust#152880 (Tweak incorrect assoc item note)
- rust-lang/rust#153526 (Fix LegacyKeyValueFormat report from docker build: i686)
- rust-lang/rust#153613 (interpreter error reporting: remove arguments that are always the same)
- rust-lang/rust#154029 (Replace `truncate(0)` with `clear()`)
- rust-lang/rust#154125 (Inline and remove `DepGraphData::try_mark_parent_green`.)
- rust-lang/rust#154185 (Prevent no_threads RwLock's write() impl from setting mode to -1 when it is locked for reading)
- rust-lang/rust#154394 (Normalize rustc path prefix when testing `-Z track-diagnostics`)
- rust-lang/rust#154450 (Use the normal arg-parsing machinery for `-Zassert-incr-state`)
- rust-lang/rust#154475 (Emit a pre-expansion feature gate warning for `box`'ed struct field patterns)
- rust-lang/rust#154500 (EnumSizeOpt: use Allocation::write_scalar instead of manual endianess logic)
- rust-lang/rust#154502 (interpret: ensure that untupled arguments are actually tuples)
EnumSizeOpt: use Allocation::write_scalar instead of manual endianess logic
The first commits makes the test actually show the bytes of the newly generated allocation, so we'd notice if something goes wrong.
The 2nd commit replaces manual endianess handling with use of proper `Allocation` methods.
r? @oli-obk
Emit a pre-expansion feature gate warning for `box`'ed struct field patterns
While the following code triggers a feature gate *warning*:
```rs
fn f() {
#[cfg(false)]
let box x; //~ WARN box pattern syntax is experimental
}
```
the code below does not (on stable & main):
```rs
fn f() {
#[cfg(false)]
let Struct { box x };
}
```
This is an oversight as both are part of the unstable feature `box_patterns` (that isn't properly gated pre expansion for historical reasons). Of course, both forms lead to a feature gate error *post expansion*.
This is a bug fix and doesn't need any input from T-compiler or T-lang. For context, emitting warnings in these cases is legitimized by [MCP 535](https://github.com/rust-lang/compiler-team/issues/535)[^1].
Part of rust-lang/rust#154045.
[^1]: In case you're wondering why the MCP talks about a *lint* even though the feature gate warnings as seen today don't reference any lint by name, read https://github.com/rust-lang/rust/issues/154045#issuecomment-4144034419.
Add test for issue #101532: dead code warnings in const _
Closesrust-lang/rust#101532
Adds a test for dead code warnings in `const _`.
This was already fixed, just adding coverage to avoid regressions.
Avoid ICE in explicit reference cast suggestion for unrelated leaf pr…
Fixesrust-lang/rust#154403
The explicit reference cast suggestion in was enabled based on `main_trait_predicate` being `From`/`TryFrom`, but it then extracted the source type from `leaf_trait_predicate`.
That is only valid when the leaf obligation is also part of the `From`/`TryFrom` conversion family.
Improve doc comment unicode guidance
Fixesrust-lang/rust#153096
This PR does not suggest HTML bidi markup, because doc comments are still Rust source first, not only rendered rustdoc output. HTML only helps in the rendered documentation rather than making them explicit in source.