Skip to content

Add more test case to check if the false note related to sealed trait suppressed #144240

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

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion tests/ui/privacy/sealed-traits/false-sealed-traits-note.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// We should not emit sealed traits note, see issue #143392
// We should not emit sealed traits note, see issue #143392 and #143121

/// Reported in #143392
mod inner {
pub trait TraitA {}

Expand All @@ -10,4 +11,13 @@ struct Struct;

impl inner::TraitB for Struct {} //~ ERROR the trait bound `Struct: TraitA` is not satisfied [E0277]

/// Reported in #143121
mod x {
pub trait A {}
pub trait B: A {}

pub struct C;
impl B for C {} //~ ERROR the trait bound `C: A` is not satisfied [E0277]
}

fn main(){}
25 changes: 21 additions & 4 deletions tests/ui/privacy/sealed-traits/false-sealed-traits-note.stderr
Original file line number Diff line number Diff line change
@@ -1,20 +1,37 @@
error[E0277]: the trait bound `Struct: TraitA` is not satisfied
--> $DIR/false-sealed-traits-note.rs:11:24
--> $DIR/false-sealed-traits-note.rs:12:24
|
LL | impl inner::TraitB for Struct {}
| ^^^^^^ the trait `TraitA` is not implemented for `Struct`
|
help: this trait has no implementations, consider adding one
--> $DIR/false-sealed-traits-note.rs:4:5
--> $DIR/false-sealed-traits-note.rs:5:5
|
LL | pub trait TraitA {}
| ^^^^^^^^^^^^^^^^
note: required by a bound in `TraitB`
--> $DIR/false-sealed-traits-note.rs:6:23
--> $DIR/false-sealed-traits-note.rs:7:23
|
LL | pub trait TraitB: TraitA {}
| ^^^^^^ required by this bound in `TraitB`

error: aborting due to 1 previous error
error[E0277]: the trait bound `C: A` is not satisfied
--> $DIR/false-sealed-traits-note.rs:20:16
|
LL | impl B for C {}
| ^ the trait `A` is not implemented for `C`
|
help: this trait has no implementations, consider adding one
--> $DIR/false-sealed-traits-note.rs:16:5
|
LL | pub trait A {}
| ^^^^^^^^^^^
note: required by a bound in `B`
--> $DIR/false-sealed-traits-note.rs:17:18
|
LL | pub trait B: A {}
| ^ required by this bound in `B`

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0277`.
Loading