Rollup of 11 pull requests
Successful merges:
- #134913 (bootstrap: do not rely on LIBRARY_PATH env variable)
- #134940 (Make sure to scrape region constraints from deeply normalizing type outlives assumptions in borrowck)
- #135228 (Improve `DispatchFromDyn` and `CoerceUnsized` impl validation)
- #135264 (Consider more erroneous layouts as `LayoutError::ReferencesError` to suppress spurious errors)
- #135302 (for purely return-type based searches, deprioritize clone-like functions)
- #135353 (re-add --disable-minification to rustdoc)
- #135380 (Make sure we can produce `ConstArgHasWrongType` errors for valtree consts)
- #135423 (Enforce syntactical stability of const traits in HIR)
- #135425 (Do not consider traits that have unsatisfied const conditions to be conditionally const)
- #135499 (fix underlining of hovered intra-doc links.)
- #135505 (Fix clippy lints in rustdoc)
r? `@ghost`
`@rustbot` modify labels: rollup
Also, the macro is only called three times, and all with the same local variable entry_ptr, so just use the local variable directly,
and rename the macro to entry_field_ptr.
Do not consider traits that have unsatisfied const conditions to be conditionally const
This will improve error messages as we continue to constify traits, since we don't want to start calling things "conditionally const" if they aren't implemented with a const impl anyways.
The only case that this affects today is `Deref` since that's one of the only constified traits in the standard library :)
r? RalfJung
Enforce syntactical stability of const traits in HIR
This PR enforces what I'm calling *syntactical* const stability of traits. In other words, it enforces the ability to name `~const`/`const` traits in trait bounds in various syntax positions in HIR (including in the trait of an impl header). This functionality is analogous to the *regular* item stability checker, which is concerned with making sure that you cannot refer to unstable items by name, and is implemented as an extension of that pass.
This is separate from enforcing the *recursive* const stability of const trait methods, which is implemented in MIR and runs on MIR bodies. That will require adding a new `NonConstOp` to the const checker and probably adjusting some logic to deduplicate redundant errors.
However, this check is separate and necessary for making sure that users don't add `~const`/`const` bounds to items when the trait is not const-stable in the first place. I chose to separate enforcing recursive const stability out of this PR to make it easier to review. I'll probably open a follow-up following this one, blocked on this PR.
r? `@RalfJung` cc `@rust-lang/project-const-traits`
Make sure we can produce `ConstArgHasWrongType` errors for valtree consts
I forgot about `ty::ConstKind::Value` in #134771.
The error message here could use some work -- both in the new trait solver and the old trait solver. But unrelated to the issue here.
Fixes https://github.com/rust-lang/rust/issues/135361 -- this was only ICEing in coherence because coherence uses the new trait solver, but I don't think the minimization is worth committing compared to the test I added.
r? ```@lcnr``` or ```@BoxyUwU```
re-add --disable-minification to rustdoc
this also makes the rust.docs-minification option work as advertised in config.toml
nothing fancy this time, this is intended to be perma-unstable. it's only really here for the benefit of rustdoc devs.
mitegates https://github.com/rust-lang/rust/issues/135345
It was removed in f9e1f6ffdf.
Improve `DispatchFromDyn` and `CoerceUnsized` impl validation
* Disallow arbitrary 1-ZST fields in `DispatchFromDyn` -- only `PhantomData`, and 1-ZSTs that mention no params (which is needed to support, e.g., the `Global` alloctor in `Box<T, U = Global>`).
* Don't allow coercing between non-ZSTs to ZSTs (since the previous check wasn't actually checking the field tys were the same before checking the layout...)
* Normalize the field before checking it's `PhantomData`.
Fixes#135215Fixes#135214Fixes#135220
r? ```@BoxyUwU``` or reassign
Make sure to scrape region constraints from deeply normalizing type outlives assumptions in borrowck
Otherwise we're just randomly registering these region relations into the infcx which isn't good
r? lcnr
This makes tidy warn on the presence of any directives it does not recognize.
There are changes in compiletest because that file used "tidy-alphabet" instead of "tidy-alphabetical".
This incorporates all the backwards-compatible changes for the 2024
Edition. There will also be a follow-on PR to land revisions to the new
chapter on async so it can be as ready as possible when officially
released with 1.85 and the 2024 Edition.
Additionally, there are a few other, non-backward-compatible, changes
(largely around `use<..>`) we can only land using the stable edition,
which we may or may not be able to land in 1.85 by using the beta
toolchain in the example code. Those may or may not be ported over,
depending on how that does or does not play with the infrastructure.
Rollup of 7 pull requests
Successful merges:
- #134216 (Enable "jump to def" feature on patterns)
- #134880 (Made `Path::name` only have item name rather than full name)
- #135466 (Leak check in `impossible_predicates` to avoid monomorphizing impossible instances)
- #135476 (Remove remnant of asmjs)
- #135479 (mir borrowck: cleanup late-bound region handling)
- #135493 (Fix legacy symbol mangling of closures)
- #135495 (Add missing closing backtick in commit hook message 🐸)
r? `@ghost`
`@rustbot` modify labels: rollup
Fix legacy symbol mangling of closures
When this code was written, there was no `type_of` implementation for closures. That has long since been changed.
In the UI test:
```
trait A where
[(); (|| {}, 1).1]: Sized,
{
}
```
We tried to walk up the def path tree for the closure, from closure -> anon const -> trait. When we reached the trait, we tried to call `type_of` on it which obviously doesn't do the right thing and ICEs.
Fixes#135418
Made `Path::name` only have item name rather than full name
Closes#134853
This PR makes `Path::name` to only have item name rather than full name, i.e. with the following code
```rust
pub mod foo {
pub struct Bar;
}
pub fn get_bar() -> foo::Bar {
foo::Bar
}
```
and running `./rustdoc ./demo.rs -wjson -Zunstable-options` gives:
```json
{
"41": {
"id": 41,
"name": "get_bar",
"inner": {
"function": {
"sig": {
"inputs": [],
"output": {
"resolved_path": {
"name": "Bar",
"id": 0,
"args": { "angle_bracketed": { "args": [], "constraints": [] }
}
}
}
}
}
}
}
}
```
_Information which isn't useful here was trimmed_
r? aDotInTheVoid
Enable "jump to def" feature on patterns
Part of https://github.com/rust-lang/rust/issues/89095.
Pattern (as in "patterns in pattern matching") were not handled by the feature, it's now added.
It all started when I realized that prelude values like `Some` or `Err` were not getting a link generated either (added support for it in the first commit).
r? ``@fmease``
Eagerly mono drop for structs with lifetimes
That is, use `!generics.requires_monomorphization()` rather than `generics.is_empty()` like the rest of the mono collector code.