diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2021-11-13 22:35:04 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-11-13 22:35:04 +0100 |
| commit | e273fab434f6accf42b3bbcd37e900db26b36cba (patch) | |
| tree | 5a85163953da3a5d45a4aef84151830b15a37993 /src/test | |
| parent | b35af0d04ddbfbbb5b616f1dac1bdad5a6e00cd6 (diff) | |
| parent | 875024ca6b1ae63f2dbcf95f5a6208bcc36fe49d (diff) | |
| download | rust-e273fab434f6accf42b3bbcd37e900db26b36cba.tar.gz rust-e273fab434f6accf42b3bbcd37e900db26b36cba.zip | |
Rollup merge of #90840 - BoxyUwU:lolripme, r=jackh726
relate lifetime in `TypeOutlives` bounds on drop impls Fixes #90838
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/ui/dropck/relate_lt_in_type_outlives_bound.rs | 13 | ||||
| -rw-r--r-- | src/test/ui/dropck/relate_lt_in_type_outlives_bound.stderr | 17 |
2 files changed, 30 insertions, 0 deletions
diff --git a/src/test/ui/dropck/relate_lt_in_type_outlives_bound.rs b/src/test/ui/dropck/relate_lt_in_type_outlives_bound.rs new file mode 100644 index 00000000000..42530d31730 --- /dev/null +++ b/src/test/ui/dropck/relate_lt_in_type_outlives_bound.rs @@ -0,0 +1,13 @@ +struct Wrapper<'a, T>(&'a T) +where + T: 'a; + +impl<'a, T> Drop for Wrapper<'a, T> +where + T: 'static, + //~^ error: `Drop` impl requires `T: 'static` but the struct it is implemented for does not +{ + fn drop(&mut self) {} +} + +fn main() {} diff --git a/src/test/ui/dropck/relate_lt_in_type_outlives_bound.stderr b/src/test/ui/dropck/relate_lt_in_type_outlives_bound.stderr new file mode 100644 index 00000000000..5176684e153 --- /dev/null +++ b/src/test/ui/dropck/relate_lt_in_type_outlives_bound.stderr @@ -0,0 +1,17 @@ +error[E0367]: `Drop` impl requires `T: 'static` but the struct it is implemented for does not + --> $DIR/relate_lt_in_type_outlives_bound.rs:7:8 + | +LL | T: 'static, + | ^^^^^^^ + | +note: the implementor must specify the same requirement + --> $DIR/relate_lt_in_type_outlives_bound.rs:1:1 + | +LL | / struct Wrapper<'a, T>(&'a T) +LL | | where +LL | | T: 'a; + | |__________^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0367`. |
