Do not suggest angle brackets when there are no type arguments

This commit is contained in:
Esteban Küber 2019-01-20 02:45:38 -08:00
parent d37a6d83e1
commit 2ab6cefccf
14 changed files with 45 additions and 48 deletions

View file

@ -1,10 +1,10 @@
error[E0214]: parenthesized parameters may only be used with a trait
error[E0214]: parenthesized type parameters may only be used with a `Fn` trait
--> $DIR/E0214.rs:2:15
|
LL | let v: Vec(&str) = vec!["foo"];
| ^^^^^^
| |
| only traits may use parentheses
| only `Fn` traits may use parentheses
| help: use angle brackets instead: `<&str>`
error: aborting due to previous error

View file

@ -1,5 +1,5 @@
fn main() {
let v: Vec(&str) = vec!['1', '2'];
//~^ ERROR parenthesized parameters may only be used with a trait
//~^ ERROR parenthesized type parameters may only be used with a `Fn` trait
//~| ERROR mismatched types
}

View file

@ -1,10 +1,10 @@
error[E0214]: parenthesized parameters may only be used with a trait
error[E0214]: parenthesized type parameters may only be used with a `Fn` trait
--> $DIR/issue-23589.rs:2:15
|
LL | let v: Vec(&str) = vec!['1', '2'];
| ^^^^^^
| |
| only traits may use parentheses
| only `Fn` traits may use parentheses
| help: use angle brackets instead: `<&str>`
error[E0308]: mismatched types

View file

@ -2,11 +2,11 @@
fn main() {
{ fn f<X: ::std::marker()::Send>() {} }
//~^ ERROR parenthesized parameters may only be used with a trait
//~^ ERROR parenthesized type parameters may only be used with a `Fn` trait
//~| WARN previously accepted
{ fn f() -> impl ::std::marker()::Send { } }
//~^ ERROR parenthesized parameters may only be used with a trait
//~^ ERROR parenthesized type parameters may only be used with a `Fn` trait
//~| WARN previously accepted
}
@ -14,5 +14,5 @@ fn main() {
struct X;
impl ::std::marker()::Copy for X {}
//~^ ERROR parenthesized parameters may only be used with a trait
//~^ ERROR parenthesized type parameters may only be used with a `Fn` trait
//~| WARN previously accepted

View file

@ -1,4 +1,4 @@
error: parenthesized parameters may only be used with a trait
error: parenthesized type parameters may only be used with a `Fn` trait
--> $DIR/issue-32995-2.rs:4:28
|
LL | { fn f<X: ::std::marker()::Send>() {} }
@ -8,7 +8,7 @@ LL | { fn f<X: ::std::marker()::Send>() {} }
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #42238 <https://github.com/rust-lang/rust/issues/42238>
error: parenthesized parameters may only be used with a trait
error: parenthesized type parameters may only be used with a `Fn` trait
--> $DIR/issue-32995-2.rs:8:35
|
LL | { fn f() -> impl ::std::marker()::Send { } }
@ -17,7 +17,7 @@ LL | { fn f() -> impl ::std::marker()::Send { } }
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #42238 <https://github.com/rust-lang/rust/issues/42238>
error: parenthesized parameters may only be used with a trait
error: parenthesized type parameters may only be used with a `Fn` trait
--> $DIR/issue-32995-2.rs:16:19
|
LL | impl ::std::marker()::Copy for X {}

View file

@ -2,32 +2,32 @@
fn main() {
let x: usize() = 1;
//~^ ERROR parenthesized parameters may only be used with a trait
//~^ ERROR parenthesized type parameters may only be used with a `Fn` trait
//~| WARN previously accepted
let b: ::std::boxed()::Box<_> = Box::new(1);
//~^ ERROR parenthesized parameters may only be used with a trait
//~^ ERROR parenthesized type parameters may only be used with a `Fn` trait
//~| WARN previously accepted
let p = ::std::str::()::from_utf8(b"foo").unwrap();
//~^ ERROR parenthesized parameters may only be used with a trait
//~^ ERROR parenthesized type parameters may only be used with a `Fn` trait
//~| WARN previously accepted
let p = ::std::str::from_utf8::()(b"foo").unwrap();
//~^ ERROR parenthesized parameters may only be used with a trait
//~^ ERROR parenthesized type parameters may only be used with a `Fn` trait
//~| WARN previously accepted
let o : Box<::std::marker()::Send> = Box::new(1);
//~^ ERROR parenthesized parameters may only be used with a trait
//~^ ERROR parenthesized type parameters may only be used with a `Fn` trait
//~| WARN previously accepted
let o : Box<Send + ::std::marker()::Sync> = Box::new(1);
//~^ ERROR parenthesized parameters may only be used with a trait
//~^ ERROR parenthesized type parameters may only be used with a `Fn` trait
//~| WARN previously accepted
}
fn foo<X:Default>() {
let d : X() = Default::default();
//~^ ERROR parenthesized parameters may only be used with a trait
//~^ ERROR parenthesized type parameters may only be used with a `Fn` trait
//~| WARN previously accepted
}

View file

@ -1,4 +1,4 @@
error: parenthesized parameters may only be used with a trait
error: parenthesized type parameters may only be used with a `Fn` trait
--> $DIR/issue-32995.rs:4:17
|
LL | let x: usize() = 1;
@ -8,7 +8,7 @@ LL | let x: usize() = 1;
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #42238 <https://github.com/rust-lang/rust/issues/42238>
error: parenthesized parameters may only be used with a trait
error: parenthesized type parameters may only be used with a `Fn` trait
--> $DIR/issue-32995.rs:8:24
|
LL | let b: ::std::boxed()::Box<_> = Box::new(1);
@ -17,7 +17,7 @@ LL | let b: ::std::boxed()::Box<_> = Box::new(1);
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #42238 <https://github.com/rust-lang/rust/issues/42238>
error: parenthesized parameters may only be used with a trait
error: parenthesized type parameters may only be used with a `Fn` trait
--> $DIR/issue-32995.rs:12:25
|
LL | let p = ::std::str::()::from_utf8(b"foo").unwrap();
@ -26,7 +26,7 @@ LL | let p = ::std::str::()::from_utf8(b"foo").unwrap();
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #42238 <https://github.com/rust-lang/rust/issues/42238>
error: parenthesized parameters may only be used with a trait
error: parenthesized type parameters may only be used with a `Fn` trait
--> $DIR/issue-32995.rs:16:36
|
LL | let p = ::std::str::from_utf8::()(b"foo").unwrap();
@ -35,7 +35,7 @@ LL | let p = ::std::str::from_utf8::()(b"foo").unwrap();
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #42238 <https://github.com/rust-lang/rust/issues/42238>
error: parenthesized parameters may only be used with a trait
error: parenthesized type parameters may only be used with a `Fn` trait
--> $DIR/issue-32995.rs:20:30
|
LL | let o : Box<::std::marker()::Send> = Box::new(1);
@ -44,7 +44,7 @@ LL | let o : Box<::std::marker()::Send> = Box::new(1);
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #42238 <https://github.com/rust-lang/rust/issues/42238>
error: parenthesized parameters may only be used with a trait
error: parenthesized type parameters may only be used with a `Fn` trait
--> $DIR/issue-32995.rs:24:37
|
LL | let o : Box<Send + ::std::marker()::Sync> = Box::new(1);
@ -53,7 +53,7 @@ LL | let o : Box<Send + ::std::marker()::Sync> = Box::new(1);
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #42238 <https://github.com/rust-lang/rust/issues/42238>
error: parenthesized parameters may only be used with a trait
error: parenthesized type parameters may only be used with a `Fn` trait
--> $DIR/issue-32995.rs:30:14
|
LL | let d : X() = Default::default();

View file

@ -6,7 +6,7 @@ struct Bar<A> {
fn bar() {
let x: Box<Bar()> = panic!();
//~^ ERROR parenthesized parameters may only be used with a trait
//~^ ERROR parenthesized type parameters may only be used with a `Fn` trait
//~| ERROR wrong number of type arguments: expected 1, found 0
}

View file

@ -1,11 +1,8 @@
error[E0214]: parenthesized parameters may only be used with a trait
error[E0214]: parenthesized type parameters may only be used with a `Fn` trait
--> $DIR/unboxed-closure-sugar-used-on-struct-1.rs:8:19
|
LL | let x: Box<Bar()> = panic!();
| ^^
| |
| only traits may use parentheses
| help: use angle brackets instead: `<>`
| ^^ only `Fn` traits may use parentheses
error[E0107]: wrong number of type arguments: expected 1, found 0
--> $DIR/unboxed-closure-sugar-used-on-struct-1.rs:8:16

View file

@ -12,7 +12,7 @@ fn bar() {
let b = Bar::<isize, usize>::new(); // OK
let b = Bar::(isize, usize)::new(); // OK too (for the parser)
//~^ ERROR parenthesized parameters may only be used with a trait
//~^ ERROR parenthesized type parameters may only be used with a `Fn` trait
}
fn main() {}

View file

@ -1,10 +1,10 @@
error[E0214]: parenthesized parameters may only be used with a trait
error[E0214]: parenthesized type parameters may only be used with a `Fn` trait
--> $DIR/unboxed-closure-sugar-used-on-struct-3.rs:14:18
|
LL | let b = Bar::(isize, usize)::new(); // OK too (for the parser)
| ^^^^^^^^^^^^^^
| |
| only traits may use parentheses
| only `Fn` traits may use parentheses
| help: use angle brackets instead: `<isize, usize>`
error: aborting due to previous error

View file

@ -5,7 +5,7 @@ struct Bar<A> {
}
fn foo(b: Box<Bar()>) {
//~^ ERROR parenthesized parameters may only be used with a trait
//~^ ERROR parenthesized type parameters may only be used with a `Fn` trait
//~| ERROR wrong number of type arguments: expected 1, found 0
}

View file

@ -1,11 +1,8 @@
error[E0214]: parenthesized parameters may only be used with a trait
error[E0214]: parenthesized type parameters may only be used with a `Fn` trait
--> $DIR/unboxed-closure-sugar-used-on-struct.rs:7:18
|
LL | fn foo(b: Box<Bar()>) {
| ^^
| |
| only traits may use parentheses
| help: use angle brackets instead: `<>`
| ^^ only `Fn` traits may use parentheses
error[E0107]: wrong number of type arguments: expected 1, found 0
--> $DIR/unboxed-closure-sugar-used-on-struct.rs:7:15