about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorNiko Matsakis <niko@alum.mit.edu>2019-07-02 14:23:38 -0400
committerNiko Matsakis <niko@alum.mit.edu>2019-07-02 14:23:38 -0400
commitf7e00a55bba51de1d58f829b562f9aff05d543f3 (patch)
treea658b2a8a52bf4f11f1cc07530a1b2a0e6646f20 /src
parent0c2c2416bfc312f9d119b6ec13773d9e6a49ee90 (diff)
downloadrust-f7e00a55bba51de1d58f829b562f9aff05d543f3.tar.gz
rust-f7e00a55bba51de1d58f829b562f9aff05d543f3.zip
fix ICE with delay-span-bug
Diffstat (limited to 'src')
-rw-r--r--src/librustc/infer/opaque_types/mod.rs9
-rw-r--r--src/test/ui/async-await/multiple-lifetimes/ret-impl-trait-one.nll.stderr15
-rw-r--r--src/test/ui/impl-trait/multiple-lifetimes/ordinary-bounds-unrelated.nll.stderr9
-rw-r--r--src/test/ui/impl-trait/multiple-lifetimes/ordinary-bounds-unsuited.nll.stderr9
4 files changed, 39 insertions, 3 deletions
diff --git a/src/librustc/infer/opaque_types/mod.rs b/src/librustc/infer/opaque_types/mod.rs
index 55eb2963875..f43e3fa0b77 100644
--- a/src/librustc/infer/opaque_types/mod.rs
+++ b/src/librustc/infer/opaque_types/mod.rs
@@ -656,10 +656,13 @@ pub fn unexpected_hidden_region_diagnostic(
             // error reporting, which in turn should have prevented us
             // from getting trying to infer the hidden type
             // completely.
-            span_bug!(
+            tcx.sess.delay_span_bug(
                 span,
-                "hidden type captures unexpected lifetime `{:?}` but no region inference failure",
-                hidden_region,
+                &format!(
+                    "hidden type captures unexpected lifetime `{:?}` \
+                     but no region inference failure",
+                    hidden_region,
+                ),
             );
         }
     }
diff --git a/src/test/ui/async-await/multiple-lifetimes/ret-impl-trait-one.nll.stderr b/src/test/ui/async-await/multiple-lifetimes/ret-impl-trait-one.nll.stderr
new file mode 100644
index 00000000000..b4d5d3ec051
--- /dev/null
+++ b/src/test/ui/async-await/multiple-lifetimes/ret-impl-trait-one.nll.stderr
@@ -0,0 +1,15 @@
+error: lifetime may not live long enough
+  --> $DIR/ret-impl-trait-one.rs:12:80
+   |
+LL |   async fn async_ret_impl_trait1<'a, 'b>(a: &'a u8, b: &'b u8) -> impl Trait<'a> {
+   |  ________________________________--__--__________________________________________^
+   | |                                |   |
+   | |                                |   lifetime `'b` defined here
+   | |                                lifetime `'a` defined here
+LL | |
+LL | |     (a, b)
+LL | | }
+   | |_^ function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'b`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/impl-trait/multiple-lifetimes/ordinary-bounds-unrelated.nll.stderr b/src/test/ui/impl-trait/multiple-lifetimes/ordinary-bounds-unrelated.nll.stderr
new file mode 100644
index 00000000000..a255c48ec6e
--- /dev/null
+++ b/src/test/ui/impl-trait/multiple-lifetimes/ordinary-bounds-unrelated.nll.stderr
@@ -0,0 +1,9 @@
+error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
+  --> $DIR/ordinary-bounds-unrelated.rs:18:74
+   |
+LL | fn upper_bounds<'a, 'b, 'c, 'd, 'e>(a: Ordinary<'a>, b: Ordinary<'b>) -> impl Trait<'d, 'e>
+   |                                                                          ^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0700`.
diff --git a/src/test/ui/impl-trait/multiple-lifetimes/ordinary-bounds-unsuited.nll.stderr b/src/test/ui/impl-trait/multiple-lifetimes/ordinary-bounds-unsuited.nll.stderr
new file mode 100644
index 00000000000..af42ed1c5c1
--- /dev/null
+++ b/src/test/ui/impl-trait/multiple-lifetimes/ordinary-bounds-unsuited.nll.stderr
@@ -0,0 +1,9 @@
+error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
+  --> $DIR/ordinary-bounds-unsuited.rs:20:62
+   |
+LL | fn upper_bounds<'a, 'b>(a: Ordinary<'a>, b: Ordinary<'b>) -> impl Trait<'a, 'b>
+   |                                                              ^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0700`.