mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-23 15:23:46 +00:00
Updated error message E0282
This commit is contained in:
parent
802d0811a5
commit
19e45799a5
@ -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,
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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]
|
||||
|
@ -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]
|
||||
}
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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() {
|
||||
|
@ -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() {
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
@ -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() {}
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user