Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mark prior failure to avoid ICE #53317

Merged
merged 1 commit into from
Aug 14, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/librustc_typeck/check/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down
28 changes: 28 additions & 0 deletions src/test/ui/issue-53251.rs
Original file line number Diff line number Diff line change
@@ -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);
17 changes: 17 additions & 0 deletions src/test/ui/issue-53251.stderr
Original file line number Diff line number Diff line change
@@ -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`.