rust/compiler/rustc_middle
bors 7f0fa485a6 Auto merge of #115582 - compiler-errors:refine-yeet, r=oli-obk
Implement refinement lint for RPITIT

Implements a lint that warns against accidentally refining an RPITIT in an implementation. This is not a hard error, and can be suppressed with `#[allow(refining_impl_trait)]`, since this behavior may be desirable -- the lint just serves as an acknowledgement from the impl author that they understand that the types they write in the implementation are an API guarantee.

This compares bounds syntactically, not semantically -- semantic implication is more difficult and essentially relies on adding the ability to keep the RPITIT hidden in the trait system so that things can be proven about the type that shows up in the impl without its own bounds leaking through, either via a new reveal mode or something else. This was experimentally implemented in #111931.

Somewhat opinionated choices:
1. Putting the lint behind `refining_impl_trait` rather than a blanket `refine` lint. This could be changed, but I like keeping the lint specialized to RPITITs so the explanation can be tailored to it.
2. This PR does not include the `#[refine]` attribute or the feature gate, since it's kind of orthogonal and can be added in a separate PR.

r? `@oli-obk`
2023-09-07 07:26:26 +00:00
..
src Auto merge of #115582 - compiler-errors:refine-yeet, r=oli-obk 2023-09-07 07:26:26 +00:00
Cargo.toml Replace in-tree `rustc_apfloat` with the new version of the crate 2023-07-26 10:20:15 -04:00
README.md
messages.ftl Don't attempt to compute layout of type referencing error 2023-07-27 18:24:08 +00:00

README.md

For more information about how rustc works, see the rustc dev guide.