Skip to content

Commit ae81fc6

Browse files
committed
Fix ICE
1 parent b5c2470 commit ae81fc6

File tree

2 files changed

+11
-12
lines changed

2 files changed

+11
-12
lines changed

src/librustc_typeck/check/mod.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -4944,13 +4944,17 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
49444944
// `impl Trait` is treated as a normal generic parameter internally,
49454945
// but we don't allow users to specify the parameter's value
49464946
// explicitly, so we have to do some error-checking here.
4947-
suppress_errors.insert(index, AstConv::check_generic_arg_count_for_call(
4947+
let suppress = AstConv::check_generic_arg_count_for_call(
49484948
self.tcx,
49494949
span,
49504950
&generics,
49514951
&seg,
49524952
false, // `is_method_call`
4953-
));
4953+
);
4954+
if suppress {
4955+
self.set_tainted_by_errors(); // See issue #53251.
4956+
}
4957+
suppress_errors.insert(index, suppress);
49544958
}
49554959

49564960
let has_self = path_segs.last().map(|PathSeg(def_id, _)| {

src/test/ui/issue-53251.stderr

+5-10
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,12 @@
1-
error[E0601]: `main` function not found in crate `issue_53251`
2-
|
3-
= note: consider adding a `main` function to `$DIR/issue-53251.rs`
4-
5-
error[E0087]: too many type parameters provided: expected at most 0 type parameters, found 1 type parameter
6-
--> $DIR/issue-53251.rs:21:24
1+
error[E0087]: wrong number of type arguments: expected 0, found 1
2+
--> $DIR/issue-53251.rs:21:17
73
|
84
LL | S::f::<i64>();
9-
| ^^^ expected 0 type parameters
5+
| ^^^^^^^^^^^ unexpected type argument
106
...
117
LL | impl_add!(a b);
128
| --------------- in this macro invocation
139

14-
error: aborting due to 2 previous errors
10+
error: aborting due to previous error
1511

16-
Some errors occurred: E0087, E0601.
17-
For more information about an error, try `rustc --explain E0087`.
12+
For more information about this error, try `rustc --explain E0087`.

0 commit comments

Comments
 (0)