diff options
| author | Dylan DPC <dylan.dpc@gmail.com> | 2020-05-11 22:20:54 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-05-11 22:20:54 +0200 |
| commit | 705671ef4986f47044ad45babc77ce822d2c04d6 (patch) | |
| tree | 126e1bceb3689fbe5a16349f792d370ef628d037 /src/test | |
| parent | dd595fade53937fafe3940c83293654e77c78d8f (diff) | |
| parent | 619c6055e71a5a202cba3f5cb979f17c3581faa3 (diff) | |
| download | rust-705671ef4986f47044ad45babc77ce822d2c04d6.tar.gz rust-705671ef4986f47044ad45babc77ce822d2c04d6.zip | |
Rollup merge of #72019 - matthewjasper:dont-skip-binder, r=davidtwco
Fix debug assertion in error code Closes #70813
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/ui/suggestions/imm-ref-trait-object-literal-bound-regions.rs | 18 | ||||
| -rw-r--r-- | src/test/ui/suggestions/imm-ref-trait-object-literal-bound-regions.stderr | 18 |
2 files changed, 36 insertions, 0 deletions
diff --git a/src/test/ui/suggestions/imm-ref-trait-object-literal-bound-regions.rs b/src/test/ui/suggestions/imm-ref-trait-object-literal-bound-regions.rs new file mode 100644 index 00000000000..319789c4ec2 --- /dev/null +++ b/src/test/ui/suggestions/imm-ref-trait-object-literal-bound-regions.rs @@ -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 +} diff --git a/src/test/ui/suggestions/imm-ref-trait-object-literal-bound-regions.stderr b/src/test/ui/suggestions/imm-ref-trait-object-literal-bound-regions.stderr new file mode 100644 index 00000000000..83de3c4cfe0 --- /dev/null +++ b/src/test/ui/suggestions/imm-ref-trait-object-literal-bound-regions.stderr @@ -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`. |
