Rollup merge of #106248 - dtolnay:revertupcastlint, r=jackh726
Revert "Implement allow-by-default `multiple_supertrait_upcastable` lint" This is a clean revert of #105484. I confirmed that reverting that PR fixes the regression reported in #106247. ~~I can't say I understand what this code is doing, but maybe it can be re-landed with a different implementation.~~ **Edit:** https://github.com/rust-lang/rust/issues/106247#issuecomment-1367174384 has an explanation of why #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`
This commit is contained in:
commit
5b74a33b8d
12 changed files with 9 additions and 167 deletions
|
|
@ -1,12 +0,0 @@
|
|||
// check-pass
|
||||
|
||||
#![deny(multiple_supertrait_upcastable)]
|
||||
//~^ WARNING unknown lint: `multiple_supertrait_upcastable`
|
||||
//~| WARNING unknown lint: `multiple_supertrait_upcastable`
|
||||
//~| WARNING unknown lint: `multiple_supertrait_upcastable`
|
||||
#![warn(multiple_supertrait_upcastable)]
|
||||
//~^ WARNING unknown lint: `multiple_supertrait_upcastable`
|
||||
//~| WARNING unknown lint: `multiple_supertrait_upcastable`
|
||||
//~| WARNING unknown lint: `multiple_supertrait_upcastable`
|
||||
|
||||
fn main() {}
|
||||
|
|
@ -1,57 +0,0 @@
|
|||
warning: unknown lint: `multiple_supertrait_upcastable`
|
||||
--> $DIR/feature-gate-multiple_supertrait_upcastable.rs:3:1
|
||||
|
|
||||
LL | #![deny(multiple_supertrait_upcastable)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: the `multiple_supertrait_upcastable` lint is unstable
|
||||
= help: add `#![feature(multiple_supertrait_upcastable)]` to the crate attributes to enable
|
||||
= note: `#[warn(unknown_lints)]` on by default
|
||||
|
||||
warning: unknown lint: `multiple_supertrait_upcastable`
|
||||
--> $DIR/feature-gate-multiple_supertrait_upcastable.rs:7:1
|
||||
|
|
||||
LL | #![warn(multiple_supertrait_upcastable)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: the `multiple_supertrait_upcastable` lint is unstable
|
||||
= help: add `#![feature(multiple_supertrait_upcastable)]` to the crate attributes to enable
|
||||
|
||||
warning: unknown lint: `multiple_supertrait_upcastable`
|
||||
--> $DIR/feature-gate-multiple_supertrait_upcastable.rs:3:1
|
||||
|
|
||||
LL | #![deny(multiple_supertrait_upcastable)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: the `multiple_supertrait_upcastable` lint is unstable
|
||||
= help: add `#![feature(multiple_supertrait_upcastable)]` to the crate attributes to enable
|
||||
|
||||
warning: unknown lint: `multiple_supertrait_upcastable`
|
||||
--> $DIR/feature-gate-multiple_supertrait_upcastable.rs:7:1
|
||||
|
|
||||
LL | #![warn(multiple_supertrait_upcastable)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: the `multiple_supertrait_upcastable` lint is unstable
|
||||
= help: add `#![feature(multiple_supertrait_upcastable)]` to the crate attributes to enable
|
||||
|
||||
warning: unknown lint: `multiple_supertrait_upcastable`
|
||||
--> $DIR/feature-gate-multiple_supertrait_upcastable.rs:3:1
|
||||
|
|
||||
LL | #![deny(multiple_supertrait_upcastable)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: the `multiple_supertrait_upcastable` lint is unstable
|
||||
= help: add `#![feature(multiple_supertrait_upcastable)]` to the crate attributes to enable
|
||||
|
||||
warning: unknown lint: `multiple_supertrait_upcastable`
|
||||
--> $DIR/feature-gate-multiple_supertrait_upcastable.rs:7:1
|
||||
|
|
||||
LL | #![warn(multiple_supertrait_upcastable)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: the `multiple_supertrait_upcastable` lint is unstable
|
||||
= help: add `#![feature(multiple_supertrait_upcastable)]` to the crate attributes to enable
|
||||
|
||||
warning: 6 warnings emitted
|
||||
|
||||
9
src/test/ui/object-safety/issue-106247.rs
Normal file
9
src/test/ui/object-safety/issue-106247.rs
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
// check-pass
|
||||
|
||||
#![deny(where_clauses_object_safety)]
|
||||
|
||||
pub trait Trait {
|
||||
fn method(&self) where Self: Sync;
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
#![feature(multiple_supertrait_upcastable)]
|
||||
#![deny(multiple_supertrait_upcastable)]
|
||||
|
||||
trait A {}
|
||||
trait B {}
|
||||
|
||||
trait C: A + B {}
|
||||
//~^ ERROR `C` is object-safe and has multiple supertraits
|
||||
|
||||
fn main() {}
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
error: `C` is object-safe and has multiple supertraits
|
||||
--> $DIR/multiple_supertrait_upcastable.rs:7:1
|
||||
|
|
||||
LL | trait C: A + B {}
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
|
||||
note: the lint level is defined here
|
||||
--> $DIR/multiple_supertrait_upcastable.rs:2:9
|
||||
|
|
||||
LL | #![deny(multiple_supertrait_upcastable)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue