Skip to content

Commit 3fa28cb

Browse files
committed
Add a new ui test and update existing ones
1 parent 7aff6ad commit 3fa28cb

25 files changed

+70
-58
lines changed

src/test/compile-fail/issue-12187-1.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ fn new<T>() -> &'static T {
1414

1515
fn main() {
1616
let &v = new();
17-
//~^ ERROR unable to fully infer type(s) [E0282]
18-
//~| NOTE cannot infer type
19-
//~| NOTE type annotations or generic parameter binding
17+
//~^ ERROR type annotations needed [E0282]
18+
//~| NOTE cannot infer type for `_`
2019
}

src/test/compile-fail/issue-12187-2.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ fn new<'r, T>() -> &'r T {
1414

1515
fn main() {
1616
let &v = new();
17-
//~^ ERROR unable to fully infer type(s) [E0282]
18-
//~| NOTE cannot infer type
19-
//~| NOTE type annotations or generic parameter binding
17+
//~^ ERROR type annotations needed [E0282]
18+
//~| NOTE cannot infer type for `_`
2019
}

src/test/compile-fail/issue-16966.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// error-pattern:type annotations or generic parameter binding required
11+
// error-pattern:type annotations needed
1212
fn main() {
1313
panic!(
1414
std::default::Default::default()

src/test/compile-fail/issue-17551.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@ use std::marker;
1313
struct B<T>(marker::PhantomData<T>);
1414

1515
fn main() {
16-
let foo = B(marker::PhantomData); //~ ERROR unable to fully infer type(s)
16+
let foo = B(marker::PhantomData); //~ ERROR type annotations needed
1717
let closure = || foo;
1818
}

src/test/compile-fail/issue-18159.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@
99
// except according to those terms.
1010

1111
fn main() {
12-
let x; //~ ERROR unable to fully infer type(s)
12+
let x; //~ ERROR type annotations needed
1313
}

src/test/compile-fail/issue-23041.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,5 @@ fn main()
1414
fn bar(x:i32) ->i32 { 3*x };
1515
let b:Box<Any> = Box::new(bar as fn(_)->_);
1616
b.downcast_ref::<fn(_)->_>(); //~ ERROR E0282
17-
//~| NOTE cannot infer type
18-
//~| NOTE type annotations or generic parameter binding required
17+
//~| NOTE cannot infer type for `_`
1918
}

src/test/compile-fail/issue-23046.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,6 @@ pub fn let_<'var, VAR, F: for<'v: 'var> Fn(Expr<'v, VAR>) -> Expr<'v, VAR>>
2525

2626
fn main() {
2727
let ex = |x| {
28-
let_(add(x,x), |y| { //~ ERROR unable to fully infer type(s)
28+
let_(add(x,x), |y| { //~ ERROR type annotations needed
2929
let_(add(x, x), |x|x)})};
3030
}

src/test/compile-fail/issue-24013.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@ fn main() {
1313
let a = 1;
1414
let b = 2;
1515
unsafe {swap::<&mut _>(transmute(&a), transmute(&b))};
16-
//~^ ERROR unable to fully infer type(s)
16+
//~^ ERROR type annotations needed
1717
}

src/test/compile-fail/issue-5062.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@
99
// except according to those terms.
1010

1111
fn main() { format!("{:?}", None); }
12-
//~^ ERROR unable to fully infer type(s) [E0282]
12+
//~^ ERROR type annotations needed [E0282]

src/test/compile-fail/issue-6458-2.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@
1111
fn main() {
1212
// Unconstrained type:
1313
format!("{:?}", None);
14-
//~^ ERROR unable to fully infer type(s) [E0282]
14+
//~^ ERROR type annotations needed [E0282]
1515
}

src/test/compile-fail/issue-6458-3.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ use std::mem;
1212

1313
fn main() {
1414
mem::transmute(0);
15-
//~^ ERROR unable to fully infer type(s) [E0282]
16-
//~| NOTE cannot infer type
17-
//~| NOTE type annotations or generic parameter binding
15+
//~^ ERROR type annotations needed [E0282]
16+
//~| NOTE cannot infer type for `U`
1817
}

src/test/compile-fail/issue-6458.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,8 @@ pub fn foo<State>(_: TypeWithState<State>) {}
1717

1818
pub fn bar() {
1919
foo(TypeWithState(marker::PhantomData));
20-
//~^ ERROR unable to fully infer type(s) [E0282]
21-
//~| NOTE cannot infer type
22-
//~| NOTE type annotations or generic parameter binding
20+
//~^ ERROR type annotations needed [E0282]
21+
//~| NOTE cannot infer type for `State`
2322
}
2423

2524
fn main() {

src/test/compile-fail/issue-7813.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@
1010

1111
fn main() {
1212
let v = &[];
13-
let it = v.iter(); //~ ERROR unable to fully infer type(s) [E0282]
14-
//~| NOTE cannot infer type
15-
//~| NOTE annotating the type for the variable `it` would help
16-
//~| NOTE type annotations or generic parameter binding
13+
let it = v.iter(); //~ ERROR type annotations needed [E0282]
14+
//~| NOTE cannot infer type for `T`
15+
//~| NOTE consider giving `it` a type
1716
}

src/test/compile-fail/method-ambig-one-trait-unknown-int-type.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ impl foo for Vec<isize> {
3232
fn m1() {
3333
// we couldn't infer the type of the vector just based on calling foo()...
3434
let mut x = Vec::new();
35-
//~^ ERROR unable to fully infer type(s) [E0282]
35+
//~^ ERROR type annotations needed [E0282]
3636
x.foo();
3737
}
3838

src/test/compile-fail/traits-multidispatch-convert-ambig-dest.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,8 @@ where T : Convert<U>
3434

3535
fn a() {
3636
test(22, std::default::Default::default());
37-
//~^ ERROR unable to fully infer type(s) [E0282]
38-
//~| NOTE cannot infer type
39-
//~| NOTE type annotations or generic parameter binding
37+
//~^ ERROR type annotations needed [E0282]
38+
//~| NOTE cannot infer type for `U`
4039
}
4140

4241
fn main() {}

src/test/compile-fail/unconstrained-none.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
// Issue #5062
1212

1313
fn main() {
14-
None; //~ ERROR unable to fully infer type(s) [E0282]
15-
//~| NOTE cannot infer type
16-
//~| NOTE type annotations or generic parameter binding
14+
None; //~ ERROR type annotations needed [E0282]
15+
//~| NOTE cannot infer type for `T`
1716
}

src/test/compile-fail/unconstrained-ref.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ struct S<'a, T:'a> {
1313
}
1414

1515
fn main() {
16-
S { o: &None }; //~ ERROR unable to fully infer type(s) [E0282]
17-
//~| NOTE cannot infer type
18-
//~| NOTE type annotations or generic parameter binding
16+
S { o: &None }; //~ ERROR type annotations needed [E0282]
17+
//~| NOTE cannot infer type for `T`
1918
}

src/test/compile-fail/vector-no-ann.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@
1111

1212
fn main() {
1313
let _foo = Vec::new();
14-
//~^ ERROR unable to fully infer type(s) [E0282]
15-
//~| NOTE cannot infer type
16-
//~| NOTE annotating the type for the variable `_foo` would help
17-
//~| NOTE type annotations or generic parameter binding
14+
//~^ ERROR type annotations needed [E0282]
15+
//~| NOTE cannot infer type for `T`
16+
//~| NOTE consider giving `_foo` a type
1817
}
+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
fn main() {
12+
let (x,) = (vec![],);
13+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
error[E0282]: type annotations needed
2+
--> $DIR/issue-38812-2.rs:12:17
3+
|
4+
12 | let (x,) = (vec![],);
5+
| ---- ^^^^^^ cannot infer type for `T`
6+
| |
7+
| consider giving a type to pattern
8+
|
9+
= note: this error originates in a macro outside of the current crate
10+
11+
error: aborting due to previous error
12+

src/test/ui/codemap_tests/repair_span_std_macros.rs src/test/ui/codemap_tests/issue-38812.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
22
// file at the top-level directory of this distribution and at
33
// http://rust-lang.org/COPYRIGHT.
44
//
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
error[E0282]: type annotations needed
2+
--> $DIR/issue-38812.rs:12:13
3+
|
4+
12 | let x = vec![];
5+
| - ^^^^^^ cannot infer type for `T`
6+
| |
7+
| consider giving `x` a type
8+
|
9+
= note: this error originates in a macro outside of the current crate
10+
11+
error: aborting due to previous error
12+

src/test/ui/codemap_tests/repair_span_std_macros.stderr

-13
This file was deleted.

src/test/ui/missing-items/missing-type-parameter.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
22
// file at the top-level directory of this distribution and at
33
// http://rust-lang.org/COPYRIGHT.
44
//
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
error[E0282]: unable to fully infer type(s)
1+
error[E0282]: type annotations needed
22
--> $DIR/missing-type-parameter.rs:14:5
33
|
44
14 | foo();
5-
| ^^^ cannot infer type
6-
|
7-
= note: type annotations or generic parameter binding required
5+
| ^^^ cannot infer type for `X`
86

97
error: aborting due to previous error
108

0 commit comments

Comments
 (0)