Add a new ui test and update existing ones
This commit is contained in:
parent
7aff6add92
commit
3fa28cb206
25 changed files with 70 additions and 58 deletions
|
@ -14,7 +14,6 @@ fn new<T>() -> &'static T {
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let &v = new();
|
let &v = new();
|
||||||
//~^ ERROR unable to fully infer type(s) [E0282]
|
//~^ ERROR type annotations needed [E0282]
|
||||||
//~| NOTE cannot infer type
|
//~| NOTE cannot infer type for `_`
|
||||||
//~| NOTE type annotations or generic parameter binding
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,6 @@ fn new<'r, T>() -> &'r T {
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let &v = new();
|
let &v = new();
|
||||||
//~^ ERROR unable to fully infer type(s) [E0282]
|
//~^ ERROR type annotations needed [E0282]
|
||||||
//~| NOTE cannot infer type
|
//~| NOTE cannot infer type for `_`
|
||||||
//~| NOTE type annotations or generic parameter binding
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
// error-pattern:type annotations or generic parameter binding required
|
// error-pattern:type annotations needed
|
||||||
fn main() {
|
fn main() {
|
||||||
panic!(
|
panic!(
|
||||||
std::default::Default::default()
|
std::default::Default::default()
|
||||||
|
|
|
@ -13,6 +13,6 @@ use std::marker;
|
||||||
struct B<T>(marker::PhantomData<T>);
|
struct B<T>(marker::PhantomData<T>);
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let foo = B(marker::PhantomData); //~ ERROR unable to fully infer type(s)
|
let foo = B(marker::PhantomData); //~ ERROR type annotations needed
|
||||||
let closure = || foo;
|
let closure = || foo;
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,5 +9,5 @@
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let x; //~ ERROR unable to fully infer type(s)
|
let x; //~ ERROR type annotations needed
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,5 @@ fn main()
|
||||||
fn bar(x:i32) ->i32 { 3*x };
|
fn bar(x:i32) ->i32 { 3*x };
|
||||||
let b:Box<Any> = Box::new(bar as fn(_)->_);
|
let b:Box<Any> = Box::new(bar as fn(_)->_);
|
||||||
b.downcast_ref::<fn(_)->_>(); //~ ERROR E0282
|
b.downcast_ref::<fn(_)->_>(); //~ ERROR E0282
|
||||||
//~| NOTE cannot infer type
|
//~| NOTE cannot infer type for `_`
|
||||||
//~| NOTE type annotations or generic parameter binding required
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,6 @@ pub fn let_<'var, VAR, F: for<'v: 'var> Fn(Expr<'v, VAR>) -> Expr<'v, VAR>>
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let ex = |x| {
|
let ex = |x| {
|
||||||
let_(add(x,x), |y| { //~ ERROR unable to fully infer type(s)
|
let_(add(x,x), |y| { //~ ERROR type annotations needed
|
||||||
let_(add(x, x), |x|x)})};
|
let_(add(x, x), |x|x)})};
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,5 +13,5 @@ fn main() {
|
||||||
let a = 1;
|
let a = 1;
|
||||||
let b = 2;
|
let b = 2;
|
||||||
unsafe {swap::<&mut _>(transmute(&a), transmute(&b))};
|
unsafe {swap::<&mut _>(transmute(&a), transmute(&b))};
|
||||||
//~^ ERROR unable to fully infer type(s)
|
//~^ ERROR type annotations needed
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,4 +9,4 @@
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
fn main() { format!("{:?}", None); }
|
fn main() { format!("{:?}", None); }
|
||||||
//~^ ERROR unable to fully infer type(s) [E0282]
|
//~^ ERROR type annotations needed [E0282]
|
||||||
|
|
|
@ -11,5 +11,5 @@
|
||||||
fn main() {
|
fn main() {
|
||||||
// Unconstrained type:
|
// Unconstrained type:
|
||||||
format!("{:?}", None);
|
format!("{:?}", None);
|
||||||
//~^ ERROR unable to fully infer type(s) [E0282]
|
//~^ ERROR type annotations needed [E0282]
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,6 @@ use std::mem;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
mem::transmute(0);
|
mem::transmute(0);
|
||||||
//~^ ERROR unable to fully infer type(s) [E0282]
|
//~^ ERROR type annotations needed [E0282]
|
||||||
//~| NOTE cannot infer type
|
//~| NOTE cannot infer type for `U`
|
||||||
//~| NOTE type annotations or generic parameter binding
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,9 +17,8 @@ pub fn foo<State>(_: TypeWithState<State>) {}
|
||||||
|
|
||||||
pub fn bar() {
|
pub fn bar() {
|
||||||
foo(TypeWithState(marker::PhantomData));
|
foo(TypeWithState(marker::PhantomData));
|
||||||
//~^ ERROR unable to fully infer type(s) [E0282]
|
//~^ ERROR type annotations needed [E0282]
|
||||||
//~| NOTE cannot infer type
|
//~| NOTE cannot infer type for `State`
|
||||||
//~| NOTE type annotations or generic parameter binding
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
|
|
@ -10,8 +10,7 @@
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let v = &[];
|
let v = &[];
|
||||||
let it = v.iter(); //~ ERROR unable to fully infer type(s) [E0282]
|
let it = v.iter(); //~ ERROR type annotations needed [E0282]
|
||||||
//~| NOTE cannot infer type
|
//~| NOTE cannot infer type for `T`
|
||||||
//~| NOTE annotating the type for the variable `it` would help
|
//~| NOTE consider giving `it` a type
|
||||||
//~| NOTE type annotations or generic parameter binding
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@ impl foo for Vec<isize> {
|
||||||
fn m1() {
|
fn m1() {
|
||||||
// we couldn't infer the type of the vector just based on calling foo()...
|
// we couldn't infer the type of the vector just based on calling foo()...
|
||||||
let mut x = Vec::new();
|
let mut x = Vec::new();
|
||||||
//~^ ERROR unable to fully infer type(s) [E0282]
|
//~^ ERROR type annotations needed [E0282]
|
||||||
x.foo();
|
x.foo();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,9 +34,8 @@ where T : Convert<U>
|
||||||
|
|
||||||
fn a() {
|
fn a() {
|
||||||
test(22, std::default::Default::default());
|
test(22, std::default::Default::default());
|
||||||
//~^ ERROR unable to fully infer type(s) [E0282]
|
//~^ ERROR type annotations needed [E0282]
|
||||||
//~| NOTE cannot infer type
|
//~| NOTE cannot infer type for `U`
|
||||||
//~| NOTE type annotations or generic parameter binding
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {}
|
fn main() {}
|
||||||
|
|
|
@ -11,7 +11,6 @@
|
||||||
// Issue #5062
|
// Issue #5062
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
None; //~ ERROR unable to fully infer type(s) [E0282]
|
None; //~ ERROR type annotations needed [E0282]
|
||||||
//~| NOTE cannot infer type
|
//~| NOTE cannot infer type for `T`
|
||||||
//~| NOTE type annotations or generic parameter binding
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,6 @@ struct S<'a, T:'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
S { o: &None }; //~ ERROR unable to fully infer type(s) [E0282]
|
S { o: &None }; //~ ERROR type annotations needed [E0282]
|
||||||
//~| NOTE cannot infer type
|
//~| NOTE cannot infer type for `T`
|
||||||
//~| NOTE type annotations or generic parameter binding
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,8 +11,7 @@
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let _foo = Vec::new();
|
let _foo = Vec::new();
|
||||||
//~^ ERROR unable to fully infer type(s) [E0282]
|
//~^ ERROR type annotations needed [E0282]
|
||||||
//~| NOTE cannot infer type
|
//~| NOTE cannot infer type for `T`
|
||||||
//~| NOTE annotating the type for the variable `_foo` would help
|
//~| NOTE consider giving `_foo` a type
|
||||||
//~| NOTE type annotations or generic parameter binding
|
|
||||||
}
|
}
|
||||||
|
|
13
src/test/ui/codemap_tests/issue-38812-2.rs
Normal file
13
src/test/ui/codemap_tests/issue-38812-2.rs
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
// Copyright 2017 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.
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
let (x,) = (vec![],);
|
||||||
|
}
|
12
src/test/ui/codemap_tests/issue-38812-2.stderr
Normal file
12
src/test/ui/codemap_tests/issue-38812-2.stderr
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
error[E0282]: type annotations needed
|
||||||
|
--> $DIR/issue-38812-2.rs:12:17
|
||||||
|
|
|
||||||
|
12 | let (x,) = (vec![],);
|
||||||
|
| ---- ^^^^^^ cannot infer type for `T`
|
||||||
|
| |
|
||||||
|
| consider giving a type to pattern
|
||||||
|
|
|
||||||
|
= note: this error originates in a macro outside of the current crate
|
||||||
|
|
||||||
|
error: aborting due to previous error
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
|
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
|
||||||
// file at the top-level directory of this distribution and at
|
// file at the top-level directory of this distribution and at
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
// http://rust-lang.org/COPYRIGHT.
|
||||||
//
|
//
|
12
src/test/ui/codemap_tests/issue-38812.stderr
Normal file
12
src/test/ui/codemap_tests/issue-38812.stderr
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
error[E0282]: type annotations needed
|
||||||
|
--> $DIR/issue-38812.rs:12:13
|
||||||
|
|
|
||||||
|
12 | let x = vec![];
|
||||||
|
| - ^^^^^^ cannot infer type for `T`
|
||||||
|
| |
|
||||||
|
| consider giving `x` a type
|
||||||
|
|
|
||||||
|
= note: this error originates in a macro outside of the current crate
|
||||||
|
|
||||||
|
error: aborting due to previous error
|
||||||
|
|
|
@ -1,13 +0,0 @@
|
||||||
error[E0282]: unable to fully infer type(s)
|
|
||||||
--> $DIR/repair_span_std_macros.rs:12:13
|
|
||||||
|
|
|
||||||
12 | let x = vec![];
|
|
||||||
| - ^^^^^^ cannot infer type
|
|
||||||
| |
|
|
||||||
| annotating the type for the variable `x` would help
|
|
||||||
|
|
|
||||||
= note: type annotations or generic parameter binding required
|
|
||||||
= note: this error originates in a macro outside of the current crate
|
|
||||||
|
|
||||||
error: aborting due to previous error
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
|
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
|
||||||
// file at the top-level directory of this distribution and at
|
// file at the top-level directory of this distribution and at
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
// http://rust-lang.org/COPYRIGHT.
|
||||||
//
|
//
|
||||||
|
|
|
@ -1,10 +1,8 @@
|
||||||
error[E0282]: unable to fully infer type(s)
|
error[E0282]: type annotations needed
|
||||||
--> $DIR/missing-type-parameter.rs:14:5
|
--> $DIR/missing-type-parameter.rs:14:5
|
||||||
|
|
|
|
||||||
14 | foo();
|
14 | foo();
|
||||||
| ^^^ cannot infer type
|
| ^^^ cannot infer type for `X`
|
||||||
|
|
|
||||||
= note: type annotations or generic parameter binding required
|
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue