-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
generic_arg_infer: placeholder in signature err
- Loading branch information
Showing
38 changed files
with
402 additions
and
235 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 0 additions & 12 deletions
12
src/test/ui/const-generics/generic_arg_infer/array-in-sig.rs
This file was deleted.
Oops, something went wrong.
9 changes: 0 additions & 9 deletions
9
src/test/ui/const-generics/generic_arg_infer/array-in-sig.stderr
This file was deleted.
Oops, something went wrong.
61 changes: 61 additions & 0 deletions
61
src/test/ui/const-generics/generic_arg_infer/in-signature.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
#![crate_type = "rlib"] | ||
#![feature(generic_arg_infer)] | ||
|
||
struct Foo<const N: usize>; | ||
struct Bar<T, const N: usize>(T); | ||
|
||
fn arr_fn() -> [u8; _] { | ||
//~^ ERROR the placeholder `_` is not allowed within types on item signatures for return types | ||
[0; 3] | ||
} | ||
|
||
fn ty_fn() -> Bar<i32, _> { | ||
//~^ ERROR the placeholder `_` is not allowed within types on item signatures for return types | ||
Bar::<i32, 3>(0) | ||
} | ||
|
||
fn ty_fn_mixed() -> Bar<_, _> { | ||
//~^ ERROR the placeholder `_` is not allowed within types on item signatures for return types | ||
Bar::<i32, 3>(0) | ||
} | ||
|
||
const ARR_CT: [u8; _] = [0; 3]; | ||
//~^ ERROR the placeholder `_` is not allowed within types on item signatures for constants | ||
static ARR_STATIC: [u8; _] = [0; 3]; | ||
//~^ ERROR the placeholder `_` is not allowed within types on item signatures for static variables | ||
const TY_CT: Bar<i32, _> = Bar::<i32, 3>(0); | ||
//~^ ERROR the placeholder `_` is not allowed within types on item signatures for constants | ||
static TY_STATIC: Bar<i32, _> = Bar::<i32, 3>(0); | ||
//~^ ERROR the placeholder `_` is not allowed within types on item signatures for static variables | ||
const TY_CT_MIXED: Bar<_, _> = Bar::<i32, 3>(0); | ||
//~^ ERROR the placeholder `_` is not allowed within types on item signatures for constants | ||
static TY_STATIC_MIXED: Bar<_, _> = Bar::<i32, 3>(0); | ||
//~^ ERROR the placeholder `_` is not allowed within types on item signatures for static variables | ||
trait ArrAssocConst { | ||
const ARR: [u8; _]; | ||
//~^ ERROR the placeholder `_` is not allowed within types on item signatures for constants | ||
} | ||
trait TyAssocConst { | ||
const ARR: Bar<i32, _>; | ||
//~^ ERROR the placeholder `_` is not allowed within types on item signatures for constants | ||
} | ||
trait TyAssocConstMixed { | ||
const ARR: Bar<_, _>; | ||
//~^ ERROR the placeholder `_` is not allowed within types on item signatures for constants | ||
} | ||
|
||
trait AssocTy { | ||
type Assoc; | ||
} | ||
impl AssocTy for i8 { | ||
type Assoc = [u8; _]; | ||
//~^ ERROR the placeholder `_` is not allowed within types on item signatures for associated types | ||
} | ||
impl AssocTy for i16 { | ||
type Assoc = Bar<i32, _>; | ||
//~^ ERROR the placeholder `_` is not allowed within types on item signatures for associated types | ||
} | ||
impl AssocTy for i32 { | ||
type Assoc = Bar<_, _>; | ||
//~^ ERROR the placeholder `_` is not allowed within types on item signatures for associated types | ||
} |
119 changes: 119 additions & 0 deletions
119
src/test/ui/const-generics/generic_arg_infer/in-signature.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
error[E0121]: the placeholder `_` is not allowed within types on item signatures for return types | ||
--> $DIR/in-signature.rs:7:21 | ||
| | ||
LL | fn arr_fn() -> [u8; _] { | ||
| -----^- | ||
| | | | ||
| | not allowed in type signatures | ||
| help: replace with the correct return type: `[u8; 3]` | ||
|
||
error[E0121]: the placeholder `_` is not allowed within types on item signatures for return types | ||
--> $DIR/in-signature.rs:12:24 | ||
| | ||
LL | fn ty_fn() -> Bar<i32, _> { | ||
| ---------^- | ||
| | | | ||
| | not allowed in type signatures | ||
| help: replace with the correct return type: `Bar<i32, 3_usize>` | ||
|
||
error[E0121]: the placeholder `_` is not allowed within types on item signatures for return types | ||
--> $DIR/in-signature.rs:17:25 | ||
| | ||
LL | fn ty_fn_mixed() -> Bar<_, _> { | ||
| ----^--^- | ||
| | | | | ||
| | | not allowed in type signatures | ||
| | not allowed in type signatures | ||
| help: replace with the correct return type: `Bar<i32, 3_usize>` | ||
|
||
error[E0121]: the placeholder `_` is not allowed within types on item signatures for constants | ||
--> $DIR/in-signature.rs:22:15 | ||
| | ||
LL | const ARR_CT: [u8; _] = [0; 3]; | ||
| ^^^^^^^ not allowed in type signatures | ||
|
||
error[E0121]: the placeholder `_` is not allowed within types on item signatures for static variables | ||
--> $DIR/in-signature.rs:24:20 | ||
| | ||
LL | static ARR_STATIC: [u8; _] = [0; 3]; | ||
| ^^^^^^^ not allowed in type signatures | ||
|
||
error[E0121]: the placeholder `_` is not allowed within types on item signatures for constants | ||
--> $DIR/in-signature.rs:26:14 | ||
| | ||
LL | const TY_CT: Bar<i32, _> = Bar::<i32, 3>(0); | ||
| ^^^^^^^^^^^ | ||
| | | ||
| not allowed in type signatures | ||
| help: replace with the correct type: `Bar<i32, 3_usize>` | ||
|
||
error[E0121]: the placeholder `_` is not allowed within types on item signatures for static variables | ||
--> $DIR/in-signature.rs:28:19 | ||
| | ||
LL | static TY_STATIC: Bar<i32, _> = Bar::<i32, 3>(0); | ||
| ^^^^^^^^^^^ | ||
| | | ||
| not allowed in type signatures | ||
| help: replace with the correct type: `Bar<i32, 3_usize>` | ||
|
||
error[E0121]: the placeholder `_` is not allowed within types on item signatures for constants | ||
--> $DIR/in-signature.rs:30:20 | ||
| | ||
LL | const TY_CT_MIXED: Bar<_, _> = Bar::<i32, 3>(0); | ||
| ^^^^^^^^^ | ||
| | | ||
| not allowed in type signatures | ||
| help: replace with the correct type: `Bar<i32, 3_usize>` | ||
|
||
error[E0121]: the placeholder `_` is not allowed within types on item signatures for static variables | ||
--> $DIR/in-signature.rs:32:25 | ||
| | ||
LL | static TY_STATIC_MIXED: Bar<_, _> = Bar::<i32, 3>(0); | ||
| ^^^^^^^^^ | ||
| | | ||
| not allowed in type signatures | ||
| help: replace with the correct type: `Bar<i32, 3_usize>` | ||
|
||
error[E0121]: the placeholder `_` is not allowed within types on item signatures for constants | ||
--> $DIR/in-signature.rs:35:21 | ||
| | ||
LL | const ARR: [u8; _]; | ||
| ^ not allowed in type signatures | ||
|
||
error[E0121]: the placeholder `_` is not allowed within types on item signatures for constants | ||
--> $DIR/in-signature.rs:39:25 | ||
| | ||
LL | const ARR: Bar<i32, _>; | ||
| ^ not allowed in type signatures | ||
|
||
error[E0121]: the placeholder `_` is not allowed within types on item signatures for constants | ||
--> $DIR/in-signature.rs:43:20 | ||
| | ||
LL | const ARR: Bar<_, _>; | ||
| ^ ^ not allowed in type signatures | ||
| | | ||
| not allowed in type signatures | ||
|
||
error[E0121]: the placeholder `_` is not allowed within types on item signatures for associated types | ||
--> $DIR/in-signature.rs:51:23 | ||
| | ||
LL | type Assoc = [u8; _]; | ||
| ^ not allowed in type signatures | ||
|
||
error[E0121]: the placeholder `_` is not allowed within types on item signatures for associated types | ||
--> $DIR/in-signature.rs:55:27 | ||
| | ||
LL | type Assoc = Bar<i32, _>; | ||
| ^ not allowed in type signatures | ||
|
||
error[E0121]: the placeholder `_` is not allowed within types on item signatures for associated types | ||
--> $DIR/in-signature.rs:59:22 | ||
| | ||
LL | type Assoc = Bar<_, _>; | ||
| ^ ^ not allowed in type signatures | ||
| | | ||
| not allowed in type signatures | ||
|
||
error: aborting due to 15 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0121`. |
Oops, something went wrong.