about summary refs log tree commit diff
diff options
context:
space:
mode:
authorvarkor <github@varkor.com>2018-08-20 00:39:58 +0100
committervarkor <github@varkor.com>2018-08-20 00:39:58 +0100
commitae81fc61d0ec0978a4b67a1c2627cf99f9c1d653 (patch)
tree91c7f63ea2dbd848a36ca8a75118feb2a7b75925
parentb5c2470ba3a3cb94450a522af34aabd20f1cb7b4 (diff)
downloadrust-ae81fc61d0ec0978a4b67a1c2627cf99f9c1d653.tar.gz
rust-ae81fc61d0ec0978a4b67a1c2627cf99f9c1d653.zip
Fix ICE
-rw-r--r--src/librustc_typeck/check/mod.rs8
-rw-r--r--src/test/ui/issue-53251.stderr15
2 files changed, 11 insertions, 12 deletions
diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs
index 6d4d5188e31..8703b99b959 100644
--- a/src/librustc_typeck/check/mod.rs
+++ b/src/librustc_typeck/check/mod.rs
@@ -4944,13 +4944,17 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
             // `impl Trait` is treated as a normal generic parameter internally,
             // but we don't allow users to specify the parameter's value
             // explicitly, so we have to do some error-checking here.
-            suppress_errors.insert(index, AstConv::check_generic_arg_count_for_call(
+            let suppress = AstConv::check_generic_arg_count_for_call(
                 self.tcx,
                 span,
                 &generics,
                 &seg,
                 false, // `is_method_call`
-            ));
+            );
+            if suppress {
+                self.set_tainted_by_errors(); // See issue #53251.
+            }
+            suppress_errors.insert(index, suppress);
         }
 
         let has_self = path_segs.last().map(|PathSeg(def_id, _)| {
diff --git a/src/test/ui/issue-53251.stderr b/src/test/ui/issue-53251.stderr
index bf99e73f0d9..b36e9645e17 100644
--- a/src/test/ui/issue-53251.stderr
+++ b/src/test/ui/issue-53251.stderr
@@ -1,17 +1,12 @@
-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
+error[E0087]: wrong number of type arguments: expected 0, found 1
+  --> $DIR/issue-53251.rs:21:17
    |
 LL |                 S::f::<i64>();
-   |                        ^^^ expected 0 type parameters
+   |                 ^^^^^^^^^^^ unexpected type argument
 ...
 LL | impl_add!(a b);
    | --------------- in this macro invocation
 
-error: aborting due to 2 previous errors
+error: aborting due to previous error
 
-Some errors occurred: E0087, E0601.
-For more information about an error, try `rustc --explain E0087`.
+For more information about this error, try `rustc --explain E0087`.