mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-23 07:14:28 +00:00
add and update tests
This commit is contained in:
parent
728d257839
commit
5ddad99a56
@ -2,7 +2,9 @@ error: expected one of `!`, `(`, `+`, `,`, `::`, `<`, or `>`, found `=`
|
||||
--> $DIR/trait-path-expected-token.rs:8:33
|
||||
|
|
||||
LL | fn f1<'a>(arg : Box<dyn X<Y = B = &'a ()>>) {}
|
||||
| ^ expected one of 7 possible tokens
|
||||
| - ^ expected one of 7 possible tokens
|
||||
| |
|
||||
| maybe try to close unmatched angle bracket
|
||||
|
||||
warning: the feature `generic_associated_types` is incomplete and may not be safe to use and/or cause compiler crashes
|
||||
--> $DIR/trait-path-expected-token.rs:1:12
|
||||
|
@ -17,7 +17,7 @@ mod error2 {
|
||||
}
|
||||
|
||||
fn f2<'a>(arg : Box<dyn X< { 1 } = 32 >>) {}
|
||||
//~^ ERROR: only types can be used in associated type constraints
|
||||
//~^ ERROR: expected one of
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
@ -6,11 +6,13 @@ LL | fn f1<'a>(arg : Box<dyn X< 1 = 32 >>) {}
|
||||
| |
|
||||
| while parsing a const generic argument starting here
|
||||
|
||||
error: only types can be used in associated type constraints
|
||||
--> $DIR/trait-path-expressions.rs:19:30
|
||||
error: expected one of `,`, `:`, or `>`, found `=`
|
||||
--> $DIR/trait-path-expressions.rs:19:36
|
||||
|
|
||||
LL | fn f2<'a>(arg : Box<dyn X< { 1 } = 32 >>) {}
|
||||
| ^^^^^
|
||||
| - ^ expected one of `,`, `:`, or `>`
|
||||
| |
|
||||
| maybe try to close unmatched angle bracket
|
||||
|
||||
warning: the feature `generic_associated_types` is incomplete and may not be safe to use and/or cause compiler crashes
|
||||
--> $DIR/trait-path-expressions.rs:1:12
|
||||
|
@ -28,7 +28,9 @@ error: expected one of `>`, a const expression, lifetime, or type, found `=`
|
||||
--> $DIR/trait-path-missing-gen_arg.rs:17:30
|
||||
|
|
||||
LL | fn f1<'a>(arg : Box<dyn X< = 32 >>) {}
|
||||
| ^ expected one of `>`, a const expression, lifetime, or type
|
||||
| - ^ expected one of `>`, const, lifetime, or type
|
||||
| |
|
||||
| maybe try to close unmatched angle bracket
|
||||
|
||||
warning: the feature `generic_associated_types` is incomplete and may not be safe to use and/or cause compiler crashes
|
||||
--> $DIR/trait-path-missing-gen_arg.rs:1:12
|
||||
|
@ -7,7 +7,7 @@ const _: () = {
|
||||
}
|
||||
|
||||
fn f1<'a>(arg : Box<dyn X<X::Y = u32>>) {}
|
||||
//~^ ERROR: paths with multiple segments cannot be used in associated type constraints
|
||||
//~^ ERROR: expected one of
|
||||
};
|
||||
|
||||
const _: () = {
|
||||
@ -18,7 +18,7 @@ const _: () = {
|
||||
trait Z {}
|
||||
|
||||
impl<T : X<<Self as X>::Y<'a> = &'a u32>> Z for T {}
|
||||
//~^ ERROR: qualified paths cannot be used in associated type constraints
|
||||
//~^ ERROR: expected one of
|
||||
};
|
||||
|
||||
const _: () = {
|
||||
@ -29,7 +29,7 @@ const _: () = {
|
||||
trait Z {}
|
||||
|
||||
impl<T : X<X::Y<'a> = &'a u32>> Z for T {}
|
||||
//~^ ERROR: paths with multiple segments cannot be used in associated type constraints
|
||||
//~^ ERROR: expected one of
|
||||
};
|
||||
|
||||
fn main() {}
|
||||
|
@ -1,22 +1,26 @@
|
||||
error: paths with multiple segments cannot be used in associated type constraints
|
||||
--> $DIR/trait-path-segments.rs:9:31
|
||||
error: expected one of `!`, `(`, `+`, `,`, `::`, `:`, `<`, or `>`, found `=`
|
||||
--> $DIR/trait-path-segments.rs:9:36
|
||||
|
|
||||
LL | fn f1<'a>(arg : Box<dyn X<X::Y = u32>>) {}
|
||||
| ^^^^
|
||||
| - ^ expected one of 8 possible tokens
|
||||
| |
|
||||
| maybe try to close unmatched angle bracket
|
||||
|
||||
error: qualified paths cannot be used in associated type constraints
|
||||
--> $DIR/trait-path-segments.rs:20:16
|
||||
error: expected one of `,`, `::`, `:`, or `>`, found `=`
|
||||
--> $DIR/trait-path-segments.rs:20:35
|
||||
|
|
||||
LL | impl<T : X<<Self as X>::Y<'a> = &'a u32>> Z for T {}
|
||||
| ^^^^^^^^^-^^^^^^^^
|
||||
| - ^ expected one of `,`, `::`, `:`, or `>`
|
||||
| |
|
||||
| not allowed in associated type constraints
|
||||
| maybe try to close unmatched angle bracket
|
||||
|
||||
error: paths with multiple segments cannot be used in associated type constraints
|
||||
--> $DIR/trait-path-segments.rs:31:16
|
||||
error: expected one of `!`, `+`, `,`, `::`, `:`, or `>`, found `=`
|
||||
--> $DIR/trait-path-segments.rs:31:25
|
||||
|
|
||||
LL | impl<T : X<X::Y<'a> = &'a u32>> Z for T {}
|
||||
| ^^^^^^^^
|
||||
| - ^ expected one of `!`, `+`, `,`, `::`, `:`, or `>`
|
||||
| |
|
||||
| maybe try to close unmatched angle bracket
|
||||
|
||||
warning: the feature `generic_associated_types` is incomplete and may not be safe to use and/or cause compiler crashes
|
||||
--> $DIR/trait-path-segments.rs:1:12
|
||||
|
@ -7,17 +7,17 @@ trait X {
|
||||
|
||||
const _: () = {
|
||||
fn f<'a>(arg : Box<dyn X< [u8; 1] = u32>>) {}
|
||||
//~^ ERROR: only path types can be used in associated type constraints
|
||||
//~^ ERROR: expected one of
|
||||
};
|
||||
|
||||
const _: () = {
|
||||
fn f1<'a>(arg : Box<dyn X<(Y<'a>) = &'a ()>>) {}
|
||||
//~^ ERROR: only path types can be used in associated type constraints
|
||||
//~^ ERROR: expected one of
|
||||
};
|
||||
|
||||
const _: () = {
|
||||
fn f1<'a>(arg : Box<dyn X< 'a = u32 >>) {}
|
||||
//~^ ERROR: only types can be used in associated type constraints
|
||||
//~^ ERROR: expected one of
|
||||
};
|
||||
|
||||
fn main() {}
|
||||
|
@ -1,20 +1,26 @@
|
||||
error: only path types can be used in associated type constraints
|
||||
--> $DIR/trait-path-types.rs:9:29
|
||||
error: expected one of `,`, `:`, or `>`, found `=`
|
||||
--> $DIR/trait-path-types.rs:9:37
|
||||
|
|
||||
LL | fn f<'a>(arg : Box<dyn X< [u8; 1] = u32>>) {}
|
||||
| ^^^^^^^
|
||||
| - ^ expected one of `,`, `:`, or `>`
|
||||
| |
|
||||
| maybe try to close unmatched angle bracket
|
||||
|
||||
error: only path types can be used in associated type constraints
|
||||
--> $DIR/trait-path-types.rs:14:29
|
||||
error: expected one of `,`, `:`, or `>`, found `=`
|
||||
--> $DIR/trait-path-types.rs:14:37
|
||||
|
|
||||
LL | fn f1<'a>(arg : Box<dyn X<(Y<'a>) = &'a ()>>) {}
|
||||
| ^^^^^^^
|
||||
| - ^ expected one of `,`, `:`, or `>`
|
||||
| |
|
||||
| maybe try to close unmatched angle bracket
|
||||
|
||||
error: only types can be used in associated type constraints
|
||||
--> $DIR/trait-path-types.rs:19:30
|
||||
error: expected one of `,`, `:`, or `>`, found `=`
|
||||
--> $DIR/trait-path-types.rs:19:33
|
||||
|
|
||||
LL | fn f1<'a>(arg : Box<dyn X< 'a = u32 >>) {}
|
||||
| ^^
|
||||
| -- ^ expected one of `,`, `:`, or `>`
|
||||
| |
|
||||
| maybe try to close unmatched angle bracket
|
||||
|
||||
warning: the feature `generic_associated_types` is incomplete and may not be safe to use and/or cause compiler crashes
|
||||
--> $DIR/trait-path-types.rs:1:12
|
||||
|
@ -1,6 +1,8 @@
|
||||
fn main () {
|
||||
let sr: Vec<(u32, _, _) = vec![];
|
||||
//~^ ERROR only path types can be used in associated type constraints
|
||||
//~^ ERROR expected one of
|
||||
|
||||
let sr2: Vec<(u32, _, _)> = sr.iter().map(|(faction, th_sender, th_receiver)| {}).collect();
|
||||
//~^ ERROR a value of type `Vec<(u32, _, _)>` cannot be built
|
||||
|
||||
}
|
||||
|
@ -1,13 +1,14 @@
|
||||
error: only path types can be used in associated type constraints
|
||||
--> $DIR/issue-34334.rs:2:17
|
||||
error: expected one of `,`, `:`, or `>`, found `=`
|
||||
--> $DIR/issue-34334.rs:2:29
|
||||
|
|
||||
LL | let sr: Vec<(u32, _, _) = vec![];
|
||||
| -- ^^^^^^^^^^^
|
||||
| |
|
||||
| -- - ^ expected one of `,`, `:`, or `>`
|
||||
| | |
|
||||
| | maybe try to close unmatched angle bracket
|
||||
| while parsing the type for `sr`
|
||||
|
||||
error[E0277]: a value of type `Vec<(u32, _, _)>` cannot be built from an iterator over elements of type `()`
|
||||
--> $DIR/issue-34334.rs:4:87
|
||||
--> $DIR/issue-34334.rs:5:87
|
||||
|
|
||||
LL | let sr2: Vec<(u32, _, _)> = sr.iter().map(|(faction, th_sender, th_receiver)| {}).collect();
|
||||
| ^^^^^^^ value of type `Vec<(u32, _, _)>` cannot be built from `std::iter::Iterator<Item=()>`
|
||||
|
@ -0,0 +1,23 @@
|
||||
struct Foo<T1, T2> {
|
||||
_a : T1,
|
||||
_b : T2,
|
||||
}
|
||||
|
||||
fn test1<T>(arg : T) {
|
||||
let v : Vec<(u32,_) = vec![];
|
||||
//~^ ERROR: expected one of
|
||||
//~| ERROR: type annotations needed
|
||||
}
|
||||
|
||||
fn test2<T1, T2>(arg1 : T1, arg2 : T2) {
|
||||
let foo : Foo::<T1, T2 = Foo {_a : arg1, _b : arg2};
|
||||
//~^ ERROR: expected one of
|
||||
}
|
||||
|
||||
fn test3<'a>(arg : &'a u32) {
|
||||
let v : Vec<'a = vec![];
|
||||
//~^ ERROR: expected one of
|
||||
//~| ERROR: type annotations needed for `Vec<T>`
|
||||
}
|
||||
|
||||
fn main() {}
|
@ -0,0 +1,49 @@
|
||||
error: expected one of `,`, `:`, or `>`, found `=`
|
||||
--> $DIR/missing-closing-angle-bracket-eq-constraint.rs:7:23
|
||||
|
|
||||
LL | let v : Vec<(u32,_) = vec![];
|
||||
| - - ^ expected one of `,`, `:`, or `>`
|
||||
| | |
|
||||
| | maybe try to close unmatched angle bracket
|
||||
| while parsing the type for `v`
|
||||
|
||||
error: expected one of `!`, `(`, `+`, `,`, `::`, `<`, or `>`, found `{`
|
||||
--> $DIR/missing-closing-angle-bracket-eq-constraint.rs:13:32
|
||||
|
|
||||
LL | let foo : Foo::<T1, T2 = Foo {_a : arg1, _b : arg2};
|
||||
| --- ^ expected one of 7 possible tokens
|
||||
| |
|
||||
| while parsing the type for `foo`
|
||||
|
||||
error: expected one of `,`, `:`, or `>`, found `=`
|
||||
--> $DIR/missing-closing-angle-bracket-eq-constraint.rs:18:18
|
||||
|
|
||||
LL | let v : Vec<'a = vec![];
|
||||
| - -- ^ expected one of `,`, `:`, or `>`
|
||||
| | |
|
||||
| | maybe try to close unmatched angle bracket
|
||||
| while parsing the type for `v`
|
||||
|
||||
error[E0282]: type annotations needed for `Vec<T>`
|
||||
--> $DIR/missing-closing-angle-bracket-eq-constraint.rs:7:25
|
||||
|
|
||||
LL | let v : Vec<(u32,_) = vec![];
|
||||
| - ^^^^^^ cannot infer type for type parameter `T`
|
||||
| |
|
||||
| consider giving `v` the explicit type `Vec<T>`, where the type parameter `T` is specified
|
||||
|
|
||||
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0282]: type annotations needed for `Vec<T>`
|
||||
--> $DIR/missing-closing-angle-bracket-eq-constraint.rs:18:20
|
||||
|
|
||||
LL | let v : Vec<'a = vec![];
|
||||
| - ^^^^^^ cannot infer type for type parameter `T`
|
||||
| |
|
||||
| consider giving `v` the explicit type `Vec<T>`, where the type parameter `T` is specified
|
||||
|
|
||||
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: aborting due to 5 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0282`.
|
@ -0,0 +1,4 @@
|
||||
fn main() {
|
||||
let v : Vec::<Vec<(u32,_,_)> = vec![vec![]];
|
||||
//~^ ERROR: expected one of
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
error: expected one of `,` or `>`, found `;`
|
||||
--> $DIR/nested-missing-closing-angle-bracket.rs:2:46
|
||||
|
|
||||
LL | let v : Vec::<Vec<(u32,_,_)> = vec![vec![]];
|
||||
| - while parsing the type for `v` ^ expected one of `,` or `>`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
Loading…
Reference in New Issue
Block a user