Rollup merge of #79032 - lcnr:arg-count, r=varkor
improve type const mismatch errors Doesn't completely remove `check_generic_arg_count` as that would have required some more complex changes but instead checks type and const params in only one step. Also moved the help added by `@JulianKnodt` in #75611 to `generic_arg_mismatch_err`. r? `@varkor` cc `@petrochenkov`
This commit is contained in:
commit
835faa532f
27 changed files with 211 additions and 302 deletions
9
src/test/ui/const-generics/const-param-shadowing.rs
Normal file
9
src/test/ui/const-generics/const-param-shadowing.rs
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
#![feature(min_const_generics)]
|
||||
|
||||
type N = u32;
|
||||
struct Foo<const M: usize>;
|
||||
fn test<const N: usize>() -> Foo<N> { //~ ERROR type provided when
|
||||
Foo
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
14
src/test/ui/const-generics/const-param-shadowing.stderr
Normal file
14
src/test/ui/const-generics/const-param-shadowing.stderr
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
error[E0747]: type provided when a constant was expected
|
||||
--> $DIR/const-param-shadowing.rs:5:34
|
||||
|
|
||||
LL | fn test<const N: usize>() -> Foo<N> {
|
||||
| ^
|
||||
|
|
||||
help: if this generic argument was intended as a const parameter, try surrounding it with braces:
|
||||
|
|
||||
LL | fn test<const N: usize>() -> Foo<{ N }> {
|
||||
| ^ ^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0747`.
|
||||
|
|
@ -1,3 +1,4 @@
|
|||
fn main() {
|
||||
let _: Vec<&str, "a"> = Vec::new(); //~ ERROR wrong number of const arguments
|
||||
let _: Vec<&str, "a"> = Vec::new();
|
||||
//~^ ERROR wrong number of generic arguments
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
error[E0107]: wrong number of const arguments: expected 0, found 1
|
||||
error[E0107]: wrong number of generic arguments: expected 1, found 2
|
||||
--> $DIR/invalid-constant-in-args.rs:2:22
|
||||
|
|
||||
LL | let _: Vec<&str, "a"> = Vec::new();
|
||||
|
|
|
|||
|
|
@ -20,20 +20,16 @@ impl<const CF: CompileFlag, T> Example<CF, T> {
|
|||
pub fn main() {
|
||||
test_1::<CompileFlag::A>();
|
||||
//~^ ERROR: expected type, found variant
|
||||
//~| ERROR: wrong number of const arguments
|
||||
//~| ERROR: wrong number of type arguments
|
||||
//~| ERROR: type provided when a constant was expected
|
||||
|
||||
test_2::<_, CompileFlag::A>(0);
|
||||
//~^ ERROR: expected type, found variant
|
||||
//~| ERROR: wrong number of const arguments
|
||||
//~| ERROR: wrong number of type arguments
|
||||
//~| ERROR: type provided when a constant was expected
|
||||
|
||||
let _: Example<CompileFlag::A, _> = Example { x: 0 };
|
||||
//~^ ERROR: expected type, found variant
|
||||
//~| ERROR: wrong number of const arguments
|
||||
//~| ERROR: wrong number of type arguments
|
||||
//~| ERROR: type provided when a constant was expected
|
||||
|
||||
let _: Example<Example::ASSOC_FLAG, _> = Example { x: 0 };
|
||||
//~^ ERROR: wrong number of const arguments
|
||||
//~| ERROR: wrong number of type arguments
|
||||
//~^ ERROR: type provided when a constant was expected
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ LL | test_1::<CompileFlag::A>();
|
|||
| help: try using the variant's enum: `CompileFlag`
|
||||
|
||||
error[E0573]: expected type, found variant `CompileFlag::A`
|
||||
--> $DIR/invalid-enum.rs:26:15
|
||||
--> $DIR/invalid-enum.rs:25:15
|
||||
|
|
||||
LL | test_2::<_, CompileFlag::A>(0);
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
|
@ -17,7 +17,7 @@ LL | test_2::<_, CompileFlag::A>(0);
|
|||
| help: try using the variant's enum: `CompileFlag`
|
||||
|
||||
error[E0573]: expected type, found variant `CompileFlag::A`
|
||||
--> $DIR/invalid-enum.rs:31:18
|
||||
--> $DIR/invalid-enum.rs:29:18
|
||||
|
|
||||
LL | let _: Example<CompileFlag::A, _> = Example { x: 0 };
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
|
@ -25,75 +25,51 @@ LL | let _: Example<CompileFlag::A, _> = Example { x: 0 };
|
|||
| not a type
|
||||
| help: try using the variant's enum: `CompileFlag`
|
||||
|
||||
error[E0107]: wrong number of const arguments: expected 1, found 0
|
||||
--> $DIR/invalid-enum.rs:31:10
|
||||
error[E0747]: type provided when a constant was expected
|
||||
--> $DIR/invalid-enum.rs:29:18
|
||||
|
|
||||
LL | let _: Example<CompileFlag::A, _> = Example { x: 0 };
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ expected 1 const argument
|
||||
|
||||
error[E0107]: wrong number of type arguments: expected at most 1, found 2
|
||||
--> $DIR/invalid-enum.rs:31:10
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
|
||||
LL | let _: Example<CompileFlag::A, _> = Example { x: 0 };
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ expected at most 1 type argument
|
||||
|
|
||||
help: If this generic argument was intended as a const parameter, try surrounding it with braces:
|
||||
help: if this generic argument was intended as a const parameter, try surrounding it with braces:
|
||||
|
|
||||
LL | let _: Example<{ CompileFlag::A }, _> = Example { x: 0 };
|
||||
| ^ ^
|
||||
|
||||
error[E0107]: wrong number of const arguments: expected 1, found 0
|
||||
--> $DIR/invalid-enum.rs:36:10
|
||||
error[E0747]: type provided when a constant was expected
|
||||
--> $DIR/invalid-enum.rs:33:18
|
||||
|
|
||||
LL | let _: Example<Example::ASSOC_FLAG, _> = Example { x: 0 };
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected 1 const argument
|
||||
|
||||
error[E0107]: wrong number of type arguments: expected at most 1, found 2
|
||||
--> $DIR/invalid-enum.rs:36:10
|
||||
| ^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
LL | let _: Example<Example::ASSOC_FLAG, _> = Example { x: 0 };
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected at most 1 type argument
|
||||
|
|
||||
help: If this generic argument was intended as a const parameter, try surrounding it with braces:
|
||||
help: if this generic argument was intended as a const parameter, try surrounding it with braces:
|
||||
|
|
||||
LL | let _: Example<{ Example::ASSOC_FLAG }, _> = Example { x: 0 };
|
||||
| ^ ^
|
||||
|
||||
error[E0107]: wrong number of const arguments: expected 1, found 0
|
||||
--> $DIR/invalid-enum.rs:21:3
|
||||
|
|
||||
LL | test_1::<CompileFlag::A>();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ expected 1 const argument
|
||||
|
||||
error[E0107]: wrong number of type arguments: expected 0, found 1
|
||||
error[E0747]: type provided when a constant was expected
|
||||
--> $DIR/invalid-enum.rs:21:12
|
||||
|
|
||||
LL | test_1::<CompileFlag::A>();
|
||||
| ^^^^^^^^^^^^^^ unexpected type argument
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
|
||||
help: If this generic argument was intended as a const parameter, try surrounding it with braces:
|
||||
help: if this generic argument was intended as a const parameter, try surrounding it with braces:
|
||||
|
|
||||
LL | test_1::<{ CompileFlag::A }>();
|
||||
| ^ ^
|
||||
|
||||
error[E0107]: wrong number of const arguments: expected 1, found 0
|
||||
--> $DIR/invalid-enum.rs:26:3
|
||||
error[E0747]: type provided when a constant was expected
|
||||
--> $DIR/invalid-enum.rs:25:15
|
||||
|
|
||||
LL | test_2::<_, CompileFlag::A>(0);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected 1 const argument
|
||||
|
||||
error[E0107]: wrong number of type arguments: expected 1, found 2
|
||||
--> $DIR/invalid-enum.rs:26:15
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
|
||||
LL | test_2::<_, CompileFlag::A>(0);
|
||||
| ^^^^^^^^^^^^^^ unexpected type argument
|
||||
|
|
||||
help: If this generic argument was intended as a const parameter, try surrounding it with braces:
|
||||
help: if this generic argument was intended as a const parameter, try surrounding it with braces:
|
||||
|
|
||||
LL | test_2::<_, { CompileFlag::A }>(0);
|
||||
| ^ ^
|
||||
|
||||
error: aborting due to 11 previous errors
|
||||
error: aborting due to 7 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0107, E0573.
|
||||
For more information about an error, try `rustc --explain E0107`.
|
||||
Some errors have detailed explanations: E0573, E0747.
|
||||
For more information about an error, try `rustc --explain E0573`.
|
||||
|
|
|
|||
|
|
@ -4,17 +4,11 @@ error[E0770]: the type of const parameters must not depend on other generic para
|
|||
LL | fn foo<const N: usize, const A: [u8; N]>() {}
|
||||
| ^ the type must not depend on the parameter `N`
|
||||
|
||||
error[E0107]: wrong number of const arguments: expected 2, found 1
|
||||
--> $DIR/issue-62878.rs:11:5
|
||||
|
|
||||
LL | foo::<_, {[1]}>();
|
||||
| ^^^^^^^^^^^^^^^ expected 2 const arguments
|
||||
|
||||
error[E0107]: wrong number of type arguments: expected 0, found 1
|
||||
error[E0747]: type provided when a constant was expected
|
||||
--> $DIR/issue-62878.rs:11:11
|
||||
|
|
||||
LL | foo::<_, {[1]}>();
|
||||
| ^ unexpected type argument
|
||||
| ^
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/issue-62878.rs:11:15
|
||||
|
|
@ -22,7 +16,7 @@ error[E0308]: mismatched types
|
|||
LL | foo::<_, {[1]}>();
|
||||
| ^^^ expected `usize`, found array `[{integer}; 1]`
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0107, E0308, E0770.
|
||||
For more information about an error, try `rustc --explain E0107`.
|
||||
Some errors have detailed explanations: E0308, E0747, E0770.
|
||||
For more information about an error, try `rustc --explain E0308`.
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ fn foo<const N: usize, const A: [u8; N]>() {}
|
|||
|
||||
fn main() {
|
||||
foo::<_, {[1]}>();
|
||||
//[full]~^ ERROR wrong number of const arguments
|
||||
//[full]~| ERROR wrong number of type arguments
|
||||
//[full]~^ ERROR type provided when a constant was expected
|
||||
//[full]~| ERROR mismatched types
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,5 +13,5 @@ fn test<T, const P: usize>() where Bool<{core::mem::size_of::<T>() > 4}>: True {
|
|||
|
||||
fn main() {
|
||||
test::<2>();
|
||||
//~^ ERROR wrong number of type
|
||||
//~^ ERROR wrong number of generic arguments
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
error[E0107]: wrong number of type arguments: expected 1, found 0
|
||||
error[E0107]: wrong number of generic arguments: expected 2, found 1
|
||||
--> $DIR/issue-76595.rs:15:5
|
||||
|
|
||||
LL | test::<2>();
|
||||
| ^^^^^^^^^ expected 1 type argument
|
||||
| ^^^^^^^^^ expected 2 generic arguments
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
|||
|
|
@ -13,8 +13,7 @@ fn b() {
|
|||
foo::<BAR + BAR>();
|
||||
//~^ ERROR expected trait, found constant `BAR`
|
||||
//~| ERROR expected trait, found constant `BAR`
|
||||
//~| ERROR wrong number of const arguments: expected 1, found 0
|
||||
//~| ERROR wrong number of type arguments: expected 0, found 1
|
||||
//~| ERROR type provided when a constant was expected
|
||||
//~| WARN trait objects without an explicit `dyn` are deprecated
|
||||
}
|
||||
fn c() {
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ LL | foo::<{ BAR + 3 }>();
|
|||
| ^ ^
|
||||
|
||||
error: expressions must be enclosed in braces to be used as const generic arguments
|
||||
--> $DIR/const-expression-suggest-missing-braces.rs:21:11
|
||||
--> $DIR/const-expression-suggest-missing-braces.rs:20:11
|
||||
|
|
||||
LL | foo::<3 + 3>();
|
||||
| ^^^^^
|
||||
|
|
@ -21,7 +21,7 @@ LL | foo::<{ 3 + 3 }>();
|
|||
| ^ ^
|
||||
|
||||
error: expected one of `,` or `>`, found `-`
|
||||
--> $DIR/const-expression-suggest-missing-braces.rs:24:15
|
||||
--> $DIR/const-expression-suggest-missing-braces.rs:23:15
|
||||
|
|
||||
LL | foo::<BAR - 3>();
|
||||
| ^ expected one of `,` or `>`
|
||||
|
|
@ -32,7 +32,7 @@ LL | foo::<{ BAR - 3 }>();
|
|||
| ^ ^
|
||||
|
||||
error: expected one of `,` or `>`, found `-`
|
||||
--> $DIR/const-expression-suggest-missing-braces.rs:27:15
|
||||
--> $DIR/const-expression-suggest-missing-braces.rs:26:15
|
||||
|
|
||||
LL | foo::<BAR - BAR>();
|
||||
| ^ expected one of `,` or `>`
|
||||
|
|
@ -43,7 +43,7 @@ LL | foo::<{ BAR - BAR }>();
|
|||
| ^ ^
|
||||
|
||||
error: expressions must be enclosed in braces to be used as const generic arguments
|
||||
--> $DIR/const-expression-suggest-missing-braces.rs:30:11
|
||||
--> $DIR/const-expression-suggest-missing-braces.rs:29:11
|
||||
|
|
||||
LL | foo::<100 - BAR>();
|
||||
| ^^^^^^^^^
|
||||
|
|
@ -54,7 +54,7 @@ LL | foo::<{ 100 - BAR }>();
|
|||
| ^ ^
|
||||
|
||||
error: expected one of `,` or `>`, found `(`
|
||||
--> $DIR/const-expression-suggest-missing-braces.rs:33:19
|
||||
--> $DIR/const-expression-suggest-missing-braces.rs:32:19
|
||||
|
|
||||
LL | foo::<bar<i32>()>();
|
||||
| ^ expected one of `,` or `>`
|
||||
|
|
@ -65,7 +65,7 @@ LL | foo::<{ bar<i32>() }>();
|
|||
| ^ ^
|
||||
|
||||
error: expected one of `,` or `>`, found `(`
|
||||
--> $DIR/const-expression-suggest-missing-braces.rs:36:21
|
||||
--> $DIR/const-expression-suggest-missing-braces.rs:35:21
|
||||
|
|
||||
LL | foo::<bar::<i32>()>();
|
||||
| ^ expected one of `,` or `>`
|
||||
|
|
@ -76,7 +76,7 @@ LL | foo::<{ bar::<i32>() }>();
|
|||
| ^ ^
|
||||
|
||||
error: expected one of `,` or `>`, found `(`
|
||||
--> $DIR/const-expression-suggest-missing-braces.rs:39:21
|
||||
--> $DIR/const-expression-suggest-missing-braces.rs:38:21
|
||||
|
|
||||
LL | foo::<bar::<i32>() + BAR>();
|
||||
| ^ expected one of `,` or `>`
|
||||
|
|
@ -87,7 +87,7 @@ LL | foo::<{ bar::<i32>() + BAR }>();
|
|||
| ^ ^
|
||||
|
||||
error: expected one of `,` or `>`, found `(`
|
||||
--> $DIR/const-expression-suggest-missing-braces.rs:42:21
|
||||
--> $DIR/const-expression-suggest-missing-braces.rs:41:21
|
||||
|
|
||||
LL | foo::<bar::<i32>() - BAR>();
|
||||
| ^ expected one of `,` or `>`
|
||||
|
|
@ -98,7 +98,7 @@ LL | foo::<{ bar::<i32>() - BAR }>();
|
|||
| ^ ^
|
||||
|
||||
error: expected one of `,` or `>`, found `-`
|
||||
--> $DIR/const-expression-suggest-missing-braces.rs:45:15
|
||||
--> $DIR/const-expression-suggest-missing-braces.rs:44:15
|
||||
|
|
||||
LL | foo::<BAR - bar::<i32>()>();
|
||||
| ^ expected one of `,` or `>`
|
||||
|
|
@ -109,7 +109,7 @@ LL | foo::<{ BAR - bar::<i32>() }>();
|
|||
| ^ ^
|
||||
|
||||
error: expected one of `,` or `>`, found `-`
|
||||
--> $DIR/const-expression-suggest-missing-braces.rs:48:15
|
||||
--> $DIR/const-expression-suggest-missing-braces.rs:47:15
|
||||
|
|
||||
LL | foo::<BAR - bar::<i32>()>();
|
||||
| ^ expected one of `,` or `>`
|
||||
|
|
@ -139,19 +139,13 @@ LL | foo::<BAR + BAR>();
|
|||
|
|
||||
= note: `#[warn(bare_trait_objects)]` on by default
|
||||
|
||||
error[E0107]: wrong number of const arguments: expected 1, found 0
|
||||
--> $DIR/const-expression-suggest-missing-braces.rs:13:5
|
||||
|
|
||||
LL | foo::<BAR + BAR>();
|
||||
| ^^^^^^^^^^^^^^^^ expected 1 const argument
|
||||
|
||||
error[E0107]: wrong number of type arguments: expected 0, found 1
|
||||
error[E0747]: type provided when a constant was expected
|
||||
--> $DIR/const-expression-suggest-missing-braces.rs:13:11
|
||||
|
|
||||
LL | foo::<BAR + BAR>();
|
||||
| ^^^^^^^^^ unexpected type argument
|
||||
| ^^^^^^^^^
|
||||
|
||||
error: aborting due to 15 previous errors; 1 warning emitted
|
||||
error: aborting due to 14 previous errors; 1 warning emitted
|
||||
|
||||
Some errors have detailed explanations: E0107, E0404.
|
||||
For more information about an error, try `rustc --explain E0107`.
|
||||
Some errors have detailed explanations: E0404, E0747.
|
||||
For more information about an error, try `rustc --explain E0404`.
|
||||
|
|
|
|||
|
|
@ -14,11 +14,9 @@ trait Marker<const N: usize> {}
|
|||
impl<const N: usize> Marker<N> for Example<N> {}
|
||||
|
||||
fn make_marker() -> impl Marker<gimme_a_const!(marker)> {
|
||||
//~^ ERROR wrong number of const
|
||||
//~| ERROR wrong number of type
|
||||
//~^ ERROR: type provided when a constant was expected
|
||||
Example::<gimme_a_const!(marker)>
|
||||
//~^ ERROR wrong number of const
|
||||
//~| ERROR wrong number of type
|
||||
//~^ ERROR: type provided when a constant was expected
|
||||
}
|
||||
|
||||
fn from_marker(_: impl Marker<{
|
||||
|
|
@ -38,11 +36,9 @@ fn main() {
|
|||
}>;
|
||||
|
||||
let _fail = Example::<external_macro!()>;
|
||||
//~^ ERROR wrong number of const
|
||||
//~| ERROR wrong number of type
|
||||
//~^ ERROR: type provided when a constant was expected
|
||||
|
||||
let _fail = Example::<gimme_a_const!()>;
|
||||
//~^ ERROR wrong number of const
|
||||
//~| ERROR wrong number of type
|
||||
//~^ ERROR: type provided when a constant was expected
|
||||
//~| ERROR unexpected end of macro invocation
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
error: expected type, found `{`
|
||||
--> $DIR/macro-fail.rs:33:27
|
||||
--> $DIR/macro-fail.rs:31:27
|
||||
|
|
||||
LL | fn make_marker() -> impl Marker<gimme_a_const!(marker)> {
|
||||
| ----------------------
|
||||
|
|
@ -13,7 +13,7 @@ LL | ($rusty: ident) => {{ let $rusty = 3; *&$rusty }}
|
|||
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: expected type, found `{`
|
||||
--> $DIR/macro-fail.rs:33:27
|
||||
--> $DIR/macro-fail.rs:31:27
|
||||
|
|
||||
LL | Example::<gimme_a_const!(marker)>
|
||||
| ----------------------
|
||||
|
|
@ -46,7 +46,7 @@ LL | let _fail = Example::<external_macro!()>;
|
|||
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: unexpected end of macro invocation
|
||||
--> $DIR/macro-fail.rs:44:25
|
||||
--> $DIR/macro-fail.rs:41:25
|
||||
|
|
||||
LL | macro_rules! gimme_a_const {
|
||||
| -------------------------- when calling this macro
|
||||
|
|
@ -54,54 +54,30 @@ LL | macro_rules! gimme_a_const {
|
|||
LL | let _fail = Example::<gimme_a_const!()>;
|
||||
| ^^^^^^^^^^^^^^^^ missing tokens in macro arguments
|
||||
|
||||
error[E0107]: wrong number of const arguments: expected 1, found 0
|
||||
--> $DIR/macro-fail.rs:16:26
|
||||
|
|
||||
LL | fn make_marker() -> impl Marker<gimme_a_const!(marker)> {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected 1 const argument
|
||||
|
||||
error[E0107]: wrong number of type arguments: expected 0, found 1
|
||||
error[E0747]: type provided when a constant was expected
|
||||
--> $DIR/macro-fail.rs:16:33
|
||||
|
|
||||
LL | fn make_marker() -> impl Marker<gimme_a_const!(marker)> {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^ unexpected type argument
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error[E0107]: wrong number of const arguments: expected 1, found 0
|
||||
--> $DIR/macro-fail.rs:19:3
|
||||
error[E0747]: type provided when a constant was expected
|
||||
--> $DIR/macro-fail.rs:18:13
|
||||
|
|
||||
LL | Example::<gimme_a_const!(marker)>
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected 1 const argument
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error[E0107]: wrong number of type arguments: expected 0, found 1
|
||||
--> $DIR/macro-fail.rs:19:13
|
||||
|
|
||||
LL | Example::<gimme_a_const!(marker)>
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^ unexpected type argument
|
||||
|
||||
error[E0107]: wrong number of const arguments: expected 1, found 0
|
||||
--> $DIR/macro-fail.rs:40:15
|
||||
error[E0747]: type provided when a constant was expected
|
||||
--> $DIR/macro-fail.rs:38:25
|
||||
|
|
||||
LL | let _fail = Example::<external_macro!()>;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected 1 const argument
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
||||
error[E0107]: wrong number of type arguments: expected 0, found 1
|
||||
--> $DIR/macro-fail.rs:40:25
|
||||
|
|
||||
LL | let _fail = Example::<external_macro!()>;
|
||||
| ^^^^^^^^^^^^^^^^^ unexpected type argument
|
||||
|
||||
error[E0107]: wrong number of const arguments: expected 1, found 0
|
||||
--> $DIR/macro-fail.rs:44:15
|
||||
error[E0747]: type provided when a constant was expected
|
||||
--> $DIR/macro-fail.rs:41:25
|
||||
|
|
||||
LL | let _fail = Example::<gimme_a_const!()>;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected 1 const argument
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
||||
error[E0107]: wrong number of type arguments: expected 0, found 1
|
||||
--> $DIR/macro-fail.rs:44:25
|
||||
|
|
||||
LL | let _fail = Example::<gimme_a_const!()>;
|
||||
| ^^^^^^^^^^^^^^^^ unexpected type argument
|
||||
error: aborting due to 8 previous errors
|
||||
|
||||
error: aborting due to 12 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0107`.
|
||||
For more information about this error, try `rustc --explain E0747`.
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
error[E0107]: wrong number of type arguments: expected at most 2, found 3
|
||||
--> $DIR/generic-impl-more-params-with-defaults.rs:13:5
|
||||
--> $DIR/generic-impl-more-params-with-defaults.rs:13:24
|
||||
|
|
||||
LL | Vec::<isize, Heap, bool>::new();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected at most 2 type arguments
|
||||
| ^^^^ unexpected type argument
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
error[E0107]: wrong number of type arguments: expected at most 2, found 3
|
||||
--> $DIR/generic-type-more-params-with-defaults.rs:9:12
|
||||
--> $DIR/generic-type-more-params-with-defaults.rs:9:29
|
||||
|
|
||||
LL | let _: Vec<isize, Heap, bool>;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^ expected at most 2 type arguments
|
||||
| ^^^^ unexpected type argument
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
|||
|
|
@ -3,8 +3,6 @@ error[E0747]: type provided when a lifetime was expected
|
|||
|
|
||||
LL | .collect::<Vec<S<_, 'a>>>();
|
||||
| ^
|
||||
|
|
||||
= note: lifetime arguments must be provided before type arguments
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
|||
|
|
@ -3,8 +3,6 @@ error[E0747]: type provided when a lifetime was expected
|
|||
|
|
||||
LL | fn bar<'a, 'b, 'c, T>(x: foo::X<'a, T, 'b, 'c>) {}
|
||||
| ^
|
||||
|
|
||||
= note: lifetime arguments must be provided before type arguments
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
|||
|
|
@ -32,8 +32,8 @@ pub mod foo2 {
|
|||
fn test_glob2() {
|
||||
use foo2::*;
|
||||
|
||||
let _x: Box<Bar>; //~ ERROR wrong number of const arguments: expected 0, found 1
|
||||
//~^ ERROR wrong number of type arguments: expected at least 1, found 0
|
||||
let _x: Box<Bar>;
|
||||
//~^ ERROR constant provided when a type was expected
|
||||
}
|
||||
|
||||
// neither public
|
||||
|
|
|
|||
|
|
@ -52,19 +52,13 @@ help: consider importing this trait
|
|||
LL | use foo1::Bar;
|
||||
|
|
||||
|
||||
error[E0107]: wrong number of const arguments: expected 0, found 1
|
||||
error[E0747]: constant provided when a type was expected
|
||||
--> $DIR/privacy-ns1.rs:35:17
|
||||
|
|
||||
LL | let _x: Box<Bar>;
|
||||
| ^^^ unexpected const argument
|
||||
| ^^^
|
||||
|
||||
error[E0107]: wrong number of type arguments: expected at least 1, found 0
|
||||
--> $DIR/privacy-ns1.rs:35:13
|
||||
|
|
||||
LL | let _x: Box<Bar>;
|
||||
| ^^^^^^^^ expected at least 1 type argument
|
||||
error: aborting due to 4 previous errors
|
||||
|
||||
error: aborting due to 5 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0107, E0412, E0423, E0425.
|
||||
For more information about an error, try `rustc --explain E0107`.
|
||||
Some errors have detailed explanations: E0412, E0423, E0425, E0747.
|
||||
For more information about an error, try `rustc --explain E0412`.
|
||||
|
|
|
|||
|
|
@ -38,16 +38,14 @@ pub mod foo2 {
|
|||
fn test_single2() {
|
||||
use foo2::Bar;
|
||||
|
||||
let _x : Box<Bar>; //~ ERROR wrong number of const arguments: expected 0, found 1
|
||||
//~^ ERROR wrong number of type arguments: expected at least 1, found 0
|
||||
let _x : Box<Bar>; //~ ERROR constant provided when a type was expected
|
||||
let _x : Bar(); //~ ERROR expected type, found function `Bar`
|
||||
}
|
||||
|
||||
fn test_list2() {
|
||||
use foo2::{Bar,Baz};
|
||||
|
||||
let _x: Box<Bar>; //~ ERROR wrong number of const arguments: expected 0, found 1
|
||||
//~^ ERROR wrong number of type arguments: expected at least 1, found 0
|
||||
let _x: Box<Bar>; //~ ERROR constant provided when a type was expected
|
||||
}
|
||||
|
||||
// neither public
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ LL | use foo2::Bar;
|
|||
|
|
||||
|
||||
error[E0573]: expected type, found function `Bar`
|
||||
--> $DIR/privacy-ns2.rs:43:14
|
||||
--> $DIR/privacy-ns2.rs:42:14
|
||||
|
|
||||
LL | let _x : Bar();
|
||||
| ^^^^^ not a type
|
||||
|
|
@ -43,66 +43,54 @@ LL | use foo1::Bar;
|
|||
|
|
||||
|
||||
error[E0603]: trait `Bar` is private
|
||||
--> $DIR/privacy-ns2.rs:63:15
|
||||
--> $DIR/privacy-ns2.rs:61:15
|
||||
|
|
||||
LL | use foo3::Bar;
|
||||
| ^^^ private trait
|
||||
|
|
||||
note: the trait `Bar` is defined here
|
||||
--> $DIR/privacy-ns2.rs:55:5
|
||||
--> $DIR/privacy-ns2.rs:53:5
|
||||
|
|
||||
LL | trait Bar {
|
||||
| ^^^^^^^^^
|
||||
|
||||
error[E0603]: trait `Bar` is private
|
||||
--> $DIR/privacy-ns2.rs:67:15
|
||||
--> $DIR/privacy-ns2.rs:65:15
|
||||
|
|
||||
LL | use foo3::Bar;
|
||||
| ^^^ private trait
|
||||
|
|
||||
note: the trait `Bar` is defined here
|
||||
--> $DIR/privacy-ns2.rs:55:5
|
||||
--> $DIR/privacy-ns2.rs:53:5
|
||||
|
|
||||
LL | trait Bar {
|
||||
| ^^^^^^^^^
|
||||
|
||||
error[E0603]: trait `Bar` is private
|
||||
--> $DIR/privacy-ns2.rs:74:16
|
||||
--> $DIR/privacy-ns2.rs:72:16
|
||||
|
|
||||
LL | use foo3::{Bar,Baz};
|
||||
| ^^^ private trait
|
||||
|
|
||||
note: the trait `Bar` is defined here
|
||||
--> $DIR/privacy-ns2.rs:55:5
|
||||
--> $DIR/privacy-ns2.rs:53:5
|
||||
|
|
||||
LL | trait Bar {
|
||||
| ^^^^^^^^^
|
||||
|
||||
error[E0107]: wrong number of const arguments: expected 0, found 1
|
||||
error[E0747]: constant provided when a type was expected
|
||||
--> $DIR/privacy-ns2.rs:41:18
|
||||
|
|
||||
LL | let _x : Box<Bar>;
|
||||
| ^^^ unexpected const argument
|
||||
| ^^^
|
||||
|
||||
error[E0107]: wrong number of type arguments: expected at least 1, found 0
|
||||
--> $DIR/privacy-ns2.rs:41:14
|
||||
|
|
||||
LL | let _x : Box<Bar>;
|
||||
| ^^^^^^^^ expected at least 1 type argument
|
||||
|
||||
error[E0107]: wrong number of const arguments: expected 0, found 1
|
||||
--> $DIR/privacy-ns2.rs:49:17
|
||||
error[E0747]: constant provided when a type was expected
|
||||
--> $DIR/privacy-ns2.rs:48:17
|
||||
|
|
||||
LL | let _x: Box<Bar>;
|
||||
| ^^^ unexpected const argument
|
||||
| ^^^
|
||||
|
||||
error[E0107]: wrong number of type arguments: expected at least 1, found 0
|
||||
--> $DIR/privacy-ns2.rs:49:13
|
||||
|
|
||||
LL | let _x: Box<Bar>;
|
||||
| ^^^^^^^^ expected at least 1 type argument
|
||||
error: aborting due to 8 previous errors
|
||||
|
||||
error: aborting due to 10 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0107, E0423, E0573, E0603.
|
||||
For more information about an error, try `rustc --explain E0107`.
|
||||
Some errors have detailed explanations: E0423, E0573, E0603, E0747.
|
||||
For more information about an error, try `rustc --explain E0423`.
|
||||
|
|
|
|||
|
|
@ -107,16 +107,12 @@ error[E0747]: type provided when a lifetime was expected
|
|||
|
|
||||
LL | struct Al<'a, T, M: OneWithLifetime<A=(), T, 'a>> {
|
||||
| ^
|
||||
|
|
||||
= note: lifetime arguments must be provided before type arguments
|
||||
|
||||
error[E0747]: type provided when a lifetime was expected
|
||||
--> $DIR/suggest-move-types.rs:48:71
|
||||
|
|
||||
LL | struct Bl<'a, 'b, 'c, T, U, V, M: ThreeWithLifetime<A=(), B=(), C=(), T, U, V, 'a, 'b, 'c>> {
|
||||
| ^
|
||||
|
|
||||
= note: lifetime arguments must be provided before type arguments
|
||||
|
||||
error[E0747]: lifetime provided when a type was expected
|
||||
--> $DIR/suggest-move-types.rs:65:56
|
||||
|
|
|
|||
|
|
@ -27,8 +27,6 @@ error[E0747]: type provided when a lifetime was expected
|
|||
|
|
||||
LL | let _: S<dyn 'static +, 'static>;
|
||||
| ^^^^^^^^^^^^^
|
||||
|
|
||||
= note: lifetime arguments must be provided before type arguments
|
||||
|
||||
error: aborting due to 5 previous errors
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue