-
Notifications
You must be signed in to change notification settings - Fork 12.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement allow-by-default multiple_supertrait_upcastable
lint
#105484
Conversation
Hey! It looks like you've submitted a new PR for the library teams! If this PR contains changes to any Examples of
|
This implementation looks good. Given that the lint is gated behind a feature gate, I don't think it needs an FCP. r? @compiler-errors @bors r+ |
// check-pass | ||
|
||
#![deny(multiple_supertrait_upcastable)] | ||
//~^ WARNING unknown lint: `multiple_supertrait_upcastable` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are there so many copies of this error being emitted lol
…fee1-dead Rollup of 9 pull requests Successful merges: - rust-lang#94145 (Test leaking of BinaryHeap Drain iterators) - rust-lang#103945 (Remove `iter::Empty` hack) - rust-lang#104024 (Fix `unused_must_use` warning for `Box::from_raw`) - rust-lang#104708 (Fix backoff doc to match implementation) - rust-lang#105347 (Account for `match` expr in single line) - rust-lang#105484 (Implement allow-by-default `multiple_supertrait_upcastable` lint) - rust-lang#106184 (Fix `core::any` docs) - rust-lang#106201 (Emit fewer errors on invalid `#[repr(transparent)]` on `enum`) - rust-lang#106205 (Remove some totally duplicated files in `rustc_infer`) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Revert "Implement allow-by-default `multiple_supertrait_upcastable` lint" This is a clean revert of rust-lang#105484. I confirmed that reverting that PR fixes the regression reported in rust-lang#106247. ~~I can't say I understand what this code is doing, but maybe it can be re-landed with a different implementation.~~ **Edit:** rust-lang#106247 (comment) has an explanation of why rust-lang#105484 ends up surfacing spurious `where_clause_object_safety` errors. The implementation of `where_clause_object_safety` assumes we only check whether a trait is object safe when somebody actually uses that trait with `dyn`. However the implementation of `multiple_supertrait_upcastable` added in the problematic PR involves checking *every* trait for whether it is object-safe. FYI `@nbdd0121` `@compiler-errors`
The lint detects when an object-safe trait has multiple supertraits.
Enabled in libcore and liballoc as they are low-level enough that many embedded programs will use them.
r? @nikomatsakis