about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2023-02-27 06:11:55 +0100
committerGitHub <noreply@github.com>2023-02-27 06:11:55 +0100
commitbade5566daab631611ec7bb47cea7ddf154ee27b (patch)
tree3f985f8bcf10958a89e1d5e717240b5fb6915a80 /tests
parent37338b8d996b05864d74d0a71b2c173bc41f890d (diff)
parent65e56616fc71744b20b02622200d42860561b20c (diff)
downloadrust-bade5566daab631611ec7bb47cea7ddf154ee27b.tar.gz
rust-bade5566daab631611ec7bb47cea7ddf154ee27b.zip
Rollup merge of #108502 - lenko-d:cannot_relate_region, r=compiler-errors
Don't trigger error for ReError when other region is empty.

Fixes [#107988](https://github.com/rust-lang/rust/issues/107988)
Diffstat (limited to 'tests')
-rw-r--r--tests/ui/lifetimes/issue-107988.rs13
-rw-r--r--tests/ui/lifetimes/issue-107988.stderr27
2 files changed, 40 insertions, 0 deletions
diff --git a/tests/ui/lifetimes/issue-107988.rs b/tests/ui/lifetimes/issue-107988.rs
new file mode 100644
index 00000000000..92cb60a06a2
--- /dev/null
+++ b/tests/ui/lifetimes/issue-107988.rs
@@ -0,0 +1,13 @@
+pub trait TraitEngine<'tcx>: 'tcx {}
+
+pub trait TraitEngineExt<'tcx> {
+    fn register_predicate_obligations(&mut self);
+}
+
+impl<T: ?Sized + TraitEngine<'tcx>> TraitEngineExt<'tcx> for T {
+  //~^ ERROR use of undeclared lifetime name `'tcx`
+  //~| ERROR use of undeclared lifetime name `'tcx`
+    fn register_predicate_obligations(&mut self) {}
+}
+
+fn main() {}
diff --git a/tests/ui/lifetimes/issue-107988.stderr b/tests/ui/lifetimes/issue-107988.stderr
new file mode 100644
index 00000000000..c2d8c7050e9
--- /dev/null
+++ b/tests/ui/lifetimes/issue-107988.stderr
@@ -0,0 +1,27 @@
+error[E0261]: use of undeclared lifetime name `'tcx`
+  --> $DIR/issue-107988.rs:7:52
+   |
+LL | impl<T: ?Sized + TraitEngine<'tcx>> TraitEngineExt<'tcx> for T {
+   |      -                                             ^^^^ undeclared lifetime
+   |      |
+   |      help: consider introducing lifetime `'tcx` here: `'tcx,`
+
+error[E0261]: use of undeclared lifetime name `'tcx`
+  --> $DIR/issue-107988.rs:7:30
+   |
+LL | impl<T: ?Sized + TraitEngine<'tcx>> TraitEngineExt<'tcx> for T {
+   |                              ^^^^ undeclared lifetime
+   |
+   = note: for more information on higher-ranked polymorphism, visit https://doc.rust-lang.org/nomicon/hrtb.html
+help: consider making the bound lifetime-generic with a new `'tcx` lifetime
+   |
+LL | impl<T: ?Sized + for<'tcx> TraitEngine<'tcx>> TraitEngineExt<'tcx> for T {
+   |                  +++++++++
+help: consider introducing lifetime `'tcx` here
+   |
+LL | impl<'tcx, T: ?Sized + TraitEngine<'tcx>> TraitEngineExt<'tcx> for T {
+   |      +++++
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0261`.