-
Notifications
You must be signed in to change notification settings - Fork 12.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
649b632
commit 619c605
Showing
3 changed files
with
45 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
src/test/ui/suggestions/imm-ref-trait-object-literal-bound-regions.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// Regression test for #70813 (this used to trigger a debug assertion) | ||
|
||
trait Trait {} | ||
|
||
struct S; | ||
|
||
impl<'a> Trait for &'a mut S {} | ||
|
||
fn foo<X>(_: X) | ||
where | ||
for<'b> &'b X: Trait, | ||
{ | ||
} | ||
|
||
fn main() { | ||
let s = S; | ||
foo::<S>(s); //~ ERROR the trait bound `for<'b> &'b S: Trait` is not satisfied | ||
} |
18 changes: 18 additions & 0 deletions
18
src/test/ui/suggestions/imm-ref-trait-object-literal-bound-regions.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
error[E0277]: the trait bound `for<'b> &'b S: Trait` is not satisfied | ||
--> $DIR/imm-ref-trait-object-literal-bound-regions.rs:17:5 | ||
| | ||
LL | fn foo<X>(_: X) | ||
| --- required by a bound in this | ||
LL | where | ||
LL | for<'b> &'b X: Trait, | ||
| ----- required by this bound in `foo` | ||
... | ||
LL | foo::<S>(s); | ||
| ^^^^^^^^ the trait `for<'b> Trait` is not implemented for `&'b S` | ||
| | ||
= help: the following implementations were found: | ||
<&'a mut S as Trait> | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0277`. |