-
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.
- Loading branch information
1 parent
3605675
commit 8759f00
Showing
30 changed files
with
257 additions
and
97 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
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
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
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
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
1 change: 1 addition & 0 deletions
1
src/test/ui/const-generics/min_const_generics/inferred_const.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
12 changes: 12 additions & 0 deletions
12
src/test/ui/feature-gates/feature-gate-generic_arg_infer.normal.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,12 @@ | ||
error[E0747]: type provided when a constant was expected | ||
--> $DIR/feature-gate-generic_arg_infer.rs:11:20 | ||
| | ||
LL | let _x = foo::<_>([1,2]); | ||
| ^ | ||
| | ||
= help: const arguments cannot yet be inferred with `_` | ||
= help: add `#![feature(generic_arg_infer)]` to the crate attributes to enable | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0747`. |
13 changes: 13 additions & 0 deletions
13
src/test/ui/feature-gates/feature-gate-generic_arg_infer.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,13 @@ | ||
// [feature] run-pass | ||
// revisions: normal feature | ||
|
||
#![cfg_attr(feature, feature(generic_arg_infer))] | ||
|
||
fn foo<const N: usize>(_: [u8; N]) -> [u8; N] { | ||
[0; N] | ||
} | ||
|
||
fn main() { | ||
let _x = foo::<_>([1,2]); | ||
//[normal]~^ ERROR: type provided when a constant was expected | ||
} |
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,24 @@ | ||
#![feature(generic_arg_infer)] | ||
|
||
struct All<'a, T, const N: usize> { | ||
v: &'a T, | ||
} | ||
|
||
struct BadInfer<_>; | ||
//~^ ERROR expected identifier | ||
//~| ERROR parameter `_` is never used | ||
|
||
fn all_fn<'a, T, const N: usize>() {} | ||
|
||
fn bad_infer_fn<_>() {} | ||
//~^ ERROR expected identifier | ||
|
||
|
||
fn main() { | ||
let a: All<_, _, _>; | ||
all_fn(); | ||
let v: [u8; _]; | ||
//~^ ERROR in expressions | ||
let v: [u8; 10] = [0; _]; | ||
//~^ ERROR in expressions | ||
} |
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,36 @@ | ||
error: expected identifier, found reserved identifier `_` | ||
--> $DIR/infer-arg-test.rs:7:17 | ||
| | ||
LL | struct BadInfer<_>; | ||
| ^ expected identifier, found reserved identifier | ||
|
||
error: expected identifier, found reserved identifier `_` | ||
--> $DIR/infer-arg-test.rs:13:17 | ||
| | ||
LL | fn bad_infer_fn<_>() {} | ||
| ^ expected identifier, found reserved identifier | ||
|
||
error: in expressions, `_` can only be used on the left-hand side of an assignment | ||
--> $DIR/infer-arg-test.rs:20:15 | ||
| | ||
LL | let v: [u8; _]; | ||
| ^ `_` not allowed here | ||
|
||
error: in expressions, `_` can only be used on the left-hand side of an assignment | ||
--> $DIR/infer-arg-test.rs:22:25 | ||
| | ||
LL | let v: [u8; 10] = [0; _]; | ||
| ^ `_` not allowed here | ||
|
||
error[E0392]: parameter `_` is never used | ||
--> $DIR/infer-arg-test.rs:7:17 | ||
| | ||
LL | struct BadInfer<_>; | ||
| ^ unused parameter | ||
| | ||
= help: consider removing `_`, referring to it in a field, or using a marker such as `PhantomData` | ||
= help: if you intended `_` to be a const parameter, use `const _: usize` instead | ||
|
||
error: aborting due to 5 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0392`. |
Oops, something went wrong.