Skip to content

Commit b287806

Browse files
Add regression test for #79458
1 parent 859463b commit b287806

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

src/test/ui/traits/issue-79458.rs

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// Negative implementations should not be shown in trait suggestions.
2+
// This is a regression test of #79458.
3+
4+
#[derive(Clone)]
5+
struct Foo<'a, T> {
6+
bar: &'a mut T
7+
//~^ ERROR the trait bound `&mut T: Clone` is not satisfied
8+
}
9+
10+
fn main() {}

src/test/ui/traits/issue-79458.stderr

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
error[E0277]: the trait bound `&mut T: Clone` is not satisfied
2+
--> $DIR/issue-79458.rs:6:5
3+
|
4+
LL | bar: &'a mut T
5+
| ^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `&mut T`
6+
|
7+
= help: the following implementations were found:
8+
<&T as Clone>
9+
= note: `Clone` is implemented for `&T`, but not for `&mut T`
10+
= note: required by `clone`
11+
= note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
12+
13+
error: aborting due to previous error
14+
15+
For more information about this error, try `rustc --explain E0277`.

0 commit comments

Comments
 (0)