Skip to content

Commit c356247

Browse files
authored
Rollup merge of rust-lang#144240 - yuk1ty:false-sealed-traits-note-reported-in-another-issue, r=fee1-dead
Add more test case to check if the false note related to sealed trait suppressed Closes rust-lang#143121 I started to fix the issue but I found that this one has already been addressed in this PR (rust-lang#143431). I added an additional test to prove the reported thing has been resolved just in case. I think we can discard this pull request if there's no need to add such kind of tests👍🏻
2 parents cc918b4 + 0aa6170 commit c356247

File tree

2 files changed

+32
-5
lines changed

2 files changed

+32
-5
lines changed

tests/ui/privacy/sealed-traits/false-sealed-traits-note.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
// We should not emit sealed traits note, see issue #143392
1+
// We should not emit sealed traits note, see issue #143392 and #143121
22

3+
/// Reported in #143392
34
mod inner {
45
pub trait TraitA {}
56

@@ -10,4 +11,13 @@ struct Struct;
1011

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

14+
/// Reported in #143121
15+
mod x {
16+
pub trait A {}
17+
pub trait B: A {}
18+
19+
pub struct C;
20+
impl B for C {} //~ ERROR the trait bound `C: A` is not satisfied [E0277]
21+
}
22+
1323
fn main(){}
Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,37 @@
11
error[E0277]: the trait bound `Struct: TraitA` is not satisfied
2-
--> $DIR/false-sealed-traits-note.rs:11:24
2+
--> $DIR/false-sealed-traits-note.rs:12:24
33
|
44
LL | impl inner::TraitB for Struct {}
55
| ^^^^^^ the trait `TraitA` is not implemented for `Struct`
66
|
77
help: this trait has no implementations, consider adding one
8-
--> $DIR/false-sealed-traits-note.rs:4:5
8+
--> $DIR/false-sealed-traits-note.rs:5:5
99
|
1010
LL | pub trait TraitA {}
1111
| ^^^^^^^^^^^^^^^^
1212
note: required by a bound in `TraitB`
13-
--> $DIR/false-sealed-traits-note.rs:6:23
13+
--> $DIR/false-sealed-traits-note.rs:7:23
1414
|
1515
LL | pub trait TraitB: TraitA {}
1616
| ^^^^^^ required by this bound in `TraitB`
1717

18-
error: aborting due to 1 previous error
18+
error[E0277]: the trait bound `C: A` is not satisfied
19+
--> $DIR/false-sealed-traits-note.rs:20:16
20+
|
21+
LL | impl B for C {}
22+
| ^ the trait `A` is not implemented for `C`
23+
|
24+
help: this trait has no implementations, consider adding one
25+
--> $DIR/false-sealed-traits-note.rs:16:5
26+
|
27+
LL | pub trait A {}
28+
| ^^^^^^^^^^^
29+
note: required by a bound in `B`
30+
--> $DIR/false-sealed-traits-note.rs:17:18
31+
|
32+
LL | pub trait B: A {}
33+
| ^ required by this bound in `B`
34+
35+
error: aborting due to 2 previous errors
1936

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

0 commit comments

Comments
 (0)