about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorEsteban Küber <esteban@kuber.com.ar>2018-08-13 15:28:18 -0700
committerEsteban Küber <esteban@kuber.com.ar>2018-08-13 15:28:18 -0700
commit397db46ae3b3d0451dd4edacc2d43af4aa38e4f2 (patch)
tree239098eed68af8726a352042386e50832413c36c /src
parent0aa8d0320266b5579428312095fe49af05ada972 (diff)
downloadrust-397db46ae3b3d0451dd4edacc2d43af4aa38e4f2.tar.gz
rust-397db46ae3b3d0451dd4edacc2d43af4aa38e4f2.zip
Mark prior failure to avoid ICE
Fix #53251
Diffstat (limited to 'src')
-rw-r--r--src/librustc_typeck/check/mod.rs1
-rw-r--r--src/test/ui/issue-53251.rs28
-rw-r--r--src/test/ui/issue-53251.stderr17
3 files changed, 46 insertions, 0 deletions
diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs
index 9b6772e2dbb..43edb235044 100644
--- a/src/librustc_typeck/check/mod.rs
+++ b/src/librustc_typeck/check/mod.rs
@@ -5154,6 +5154,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
         } else {
             None
         } {
+            self.set_tainted_by_errors(); // #53251
             err.span_label(span, format!("expected {}", expected_text)).emit();
         }
 
diff --git a/src/test/ui/issue-53251.rs b/src/test/ui/issue-53251.rs
new file mode 100644
index 00000000000..aa9da744566
--- /dev/null
+++ b/src/test/ui/issue-53251.rs
@@ -0,0 +1,28 @@
+// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+struct S;
+
+impl S {
+    fn f() {}
+}
+
+macro_rules! impl_add {
+    ($($n:ident)*) => {
+        $(
+            fn $n() {
+                S::f::<i64>();
+                //~^ ERROR too many type parameters provided
+            }
+        )*
+    }
+}
+
+impl_add!(a b);
diff --git a/src/test/ui/issue-53251.stderr b/src/test/ui/issue-53251.stderr
new file mode 100644
index 00000000000..bf99e73f0d9
--- /dev/null
+++ b/src/test/ui/issue-53251.stderr
@@ -0,0 +1,17 @@
+error[E0601]: `main` function not found in crate `issue_53251`
+   |
+   = note: consider adding a `main` function to `$DIR/issue-53251.rs`
+
+error[E0087]: too many type parameters provided: expected at most 0 type parameters, found 1 type parameter
+  --> $DIR/issue-53251.rs:21:24
+   |
+LL |                 S::f::<i64>();
+   |                        ^^^ expected 0 type parameters
+...
+LL | impl_add!(a b);
+   | --------------- in this macro invocation
+
+error: aborting due to 2 previous errors
+
+Some errors occurred: E0087, E0601.
+For more information about an error, try `rustc --explain E0087`.