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

Updated error message E0282 #35366

Merged
merged 1 commit into from
Aug 7, 2016
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
10 changes: 6 additions & 4 deletions src/librustc/traits/error_reporting.rs
Original file line number Diff line number Diff line change
Expand Up @@ -870,10 +870,12 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {


fn need_type_info(&self, span: Span, ty: Ty<'tcx>) {
span_err!(self.tcx.sess, span, E0282,
"unable to infer enough type information about `{}`; \
type annotations or generic parameter binding required",
ty);
let mut err = struct_span_err!(self.tcx.sess, span, E0282,
"unable to infer enough type information about `{}`",
ty);
err.note("type annotations or generic parameter binding required");
err.span_label(span, &format!("cannot infer type for `{}`", ty));
err.emit()
}

fn note_obligation_cause<T>(&self,
Expand Down
4 changes: 3 additions & 1 deletion src/test/compile-fail/issue-12187-1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,7 @@ fn new<T>() -> &'static T {

fn main() {
let &v = new();
//~^ ERROR type annotations or generic parameter binding required
//~^ ERROR unable to infer enough type information about `_` [E0282]
//~| NOTE cannot infer type for `_`
//~| NOTE type annotations or generic parameter binding
}
4 changes: 3 additions & 1 deletion src/test/compile-fail/issue-12187-2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,7 @@ fn new<'r, T>() -> &'r T {

fn main() {
let &v = new();
//~^ ERROR type annotations or generic parameter binding required
//~^ ERROR unable to infer enough type information about `_` [E0282]
//~| NOTE cannot infer type for `_`
//~| NOTE type annotations or generic parameter binding
}
2 changes: 2 additions & 0 deletions src/test/compile-fail/issue-23041.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,6 @@ fn main()
fn bar(x:i32) ->i32 { 3*x };
let b:Box<Any> = Box::new(bar as fn(_)->_);
b.downcast_ref::<fn(_)->_>(); //~ ERROR E0282
//~| NOTE cannot infer type for `_`
//~| NOTE type annotations or generic parameter binding required
}
2 changes: 1 addition & 1 deletion src/test/compile-fail/issue-5062.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@
// except according to those terms.

fn main() { format!("{:?}", None); }
//~^ ERROR type annotations or generic parameter binding required
//~^ ERROR unable to infer enough type information about `_` [E0282]
2 changes: 1 addition & 1 deletion src/test/compile-fail/issue-6458-2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@
fn main() {
// Unconstrained type:
format!("{:?}", None);
//~^ ERROR type annotations or generic parameter binding required
//~^ ERROR unable to infer enough type information about `_` [E0282]
}
4 changes: 3 additions & 1 deletion src/test/compile-fail/issue-6458-3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,7 @@ use std::mem;

fn main() {
mem::transmute(0);
//~^ ERROR type annotations or generic parameter binding required
//~^ ERROR unable to infer enough type information about `_` [E0282]
//~| NOTE cannot infer type for `_`
//~| NOTE type annotations or generic parameter binding
}
4 changes: 3 additions & 1 deletion src/test/compile-fail/issue-6458-4.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@

fn foo(b: bool) -> Result<bool,String> {
Err("bar".to_string());
//~^ ERROR type annotations or generic parameter binding required
//~^ ERROR unable to infer enough type information about `_` [E0282]
//~| NOTE cannot infer type for `_`
//~| NOTE type annotations or generic parameter binding
}

fn main() {
Expand Down
4 changes: 3 additions & 1 deletion src/test/compile-fail/issue-6458.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ pub fn foo<State>(_: TypeWithState<State>) {}

pub fn bar() {
foo(TypeWithState(marker::PhantomData));
//~^ ERROR type annotations or generic parameter binding required
//~^ ERROR unable to infer enough type information about `_` [E0282]
//~| NOTE cannot infer type for `_`
//~| NOTE type annotations or generic parameter binding
}

fn main() {
Expand Down
4 changes: 3 additions & 1 deletion src/test/compile-fail/issue-7813.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,7 @@

fn main() {
let v = &[];
let it = v.iter(); //~ ERROR type annotations or generic parameter binding required
let it = v.iter(); //~ ERROR unable to infer enough type information about `_` [E0282]
//~| NOTE cannot infer type for `_`
//~| NOTE type annotations or generic parameter binding
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ impl foo for Vec<isize> {
fn m1() {
// we couldn't infer the type of the vector just based on calling foo()...
let mut x = Vec::new();
//~^ ERROR type annotations or generic parameter binding required
//~^ ERROR unable to infer enough type information about `_` [E0282]
x.foo();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ where T : Convert<U>

fn a() {
test(22, std::default::Default::default());
//~^ ERROR type annotations or generic parameter binding required
//~^ ERROR unable to infer enough type information about `_` [E0282]
//~| NOTE cannot infer type for `_`
//~| NOTE type annotations or generic parameter binding
}

fn main() {}
4 changes: 3 additions & 1 deletion src/test/compile-fail/unconstrained-none.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,7 @@
// Issue #5062

fn main() {
None; //~ ERROR type annotations or generic parameter binding required
None; //~ ERROR unable to infer enough type information about `_` [E0282]
//~| NOTE cannot infer type for `_`
//~| NOTE type annotations or generic parameter binding
}
4 changes: 3 additions & 1 deletion src/test/compile-fail/unconstrained-ref.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,7 @@ struct S<'a, T:'a> {
}

fn main() {
S { o: &None }; //~ ERROR type annotations or generic parameter binding required
S { o: &None }; //~ ERROR unable to infer enough type information about `_` [E0282]
//~| NOTE cannot infer type for `_`
//~| NOTE type annotations or generic parameter binding
}
4 changes: 3 additions & 1 deletion src/test/compile-fail/vector-no-ann.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,7 @@

fn main() {
let _foo = Vec::new();
//~^ ERROR type annotations or generic parameter binding required
//~^ ERROR unable to infer enough type information about `_` [E0282]
//~| NOTE cannot infer type for `_`
//~| NOTE type annotations or generic parameter binding
}