diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2022-06-06 08:37:00 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-06-06 08:37:00 +0200 |
| commit | f2b3808920bdb8803acc04a8946e1d99edaf7514 (patch) | |
| tree | 9dc3af9077f69589cbe4bfeca5917667a12a4b44 /src | |
| parent | 77f0209fde995458d39dbd5f58699b8ddfd04452 (diff) | |
| parent | bacd8adeda36fd3ddbea0328f375595872f1e08c (diff) | |
| download | rust-f2b3808920bdb8803acc04a8946e1d99edaf7514.tar.gz rust-f2b3808920bdb8803acc04a8946e1d99edaf7514.zip | |
Rollup merge of #97683 - cjgillot:no-apit-hrtb, r=nagisa
Fail gracefully when encountering an HRTB in APIT. Fixes https://github.com/rust-lang/rust/issues/96954 ~The first commit will be merged as part of https://github.com/rust-lang/rust/pull/97415~
Diffstat (limited to 'src')
| -rw-r--r-- | src/test/ui/impl-trait/universal_wrong_hrtb.rs | 8 | ||||
| -rw-r--r-- | src/test/ui/impl-trait/universal_wrong_hrtb.stderr | 14 |
2 files changed, 22 insertions, 0 deletions
diff --git a/src/test/ui/impl-trait/universal_wrong_hrtb.rs b/src/test/ui/impl-trait/universal_wrong_hrtb.rs new file mode 100644 index 00000000000..b9551c2ceb0 --- /dev/null +++ b/src/test/ui/impl-trait/universal_wrong_hrtb.rs @@ -0,0 +1,8 @@ +trait Trait<'a> { + type Assoc; +} + +fn test_argument_position(x: impl for<'a> Trait<'a, Assoc = impl Copy + 'a>) {} +//~^ ERROR `impl Trait` can only mention lifetimes bound at the fn or impl level + +fn main() {} diff --git a/src/test/ui/impl-trait/universal_wrong_hrtb.stderr b/src/test/ui/impl-trait/universal_wrong_hrtb.stderr new file mode 100644 index 00000000000..37eb8dfa1a1 --- /dev/null +++ b/src/test/ui/impl-trait/universal_wrong_hrtb.stderr @@ -0,0 +1,14 @@ +error: `impl Trait` can only mention lifetimes bound at the fn or impl level + --> $DIR/universal_wrong_hrtb.rs:5:73 + | +LL | fn test_argument_position(x: impl for<'a> Trait<'a, Assoc = impl Copy + 'a>) {} + | ^^ + | +note: lifetime declared here + --> $DIR/universal_wrong_hrtb.rs:5:39 + | +LL | fn test_argument_position(x: impl for<'a> Trait<'a, Assoc = impl Copy + 'a>) {} + | ^^ + +error: aborting due to previous error + |
