-
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.
Retroactively feature gate
ConstArgKind::Path
- Loading branch information
Showing
40 changed files
with
419 additions
and
202 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 was deleted.
Oops, something went wrong.
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
20 changes: 17 additions & 3 deletions
20
tests/ui/coherence/negative-coherence/generic_const_type_mismatch.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 |
---|---|---|
@@ -1,11 +1,25 @@ | ||
error[E0119]: conflicting implementations of trait `Trait` for type `[(); _]` | ||
--> $DIR/generic_const_type_mismatch.rs:8:1 | ||
--> $DIR/generic_const_type_mismatch.rs:9:1 | ||
| | ||
LL | impl<const N: u8> Trait for [(); N] {} | ||
| ----------------------------------- first implementation here | ||
LL | | ||
LL | impl<const N: i8> Trait for [(); N] {} | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `[(); _]` | ||
|
||
error: aborting due to 1 previous error | ||
error[E0308]: mismatched types | ||
--> $DIR/generic_const_type_mismatch.rs:7:34 | ||
| | ||
LL | impl<const N: u8> Trait for [(); N] {} | ||
| ^ expected `usize`, found `u8` | ||
|
||
error[E0308]: mismatched types | ||
--> $DIR/generic_const_type_mismatch.rs:9:34 | ||
| | ||
LL | impl<const N: i8> Trait for [(); N] {} | ||
| ^ expected `usize`, found `i8` | ||
|
||
error: aborting due to 3 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0119`. | ||
Some errors have detailed explanations: E0119, E0308. | ||
For more information about an error, try `rustc --explain E0119`. |
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
21 changes: 21 additions & 0 deletions
21
tests/ui/const-generics/early/trivial-const-arg-macro-nested.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,21 @@ | ||
//@ check-pass | ||
|
||
// This is a regression test for #128016. | ||
|
||
macro_rules! len_inner { | ||
() => { | ||
BAR | ||
}; | ||
} | ||
|
||
macro_rules! len { | ||
() => { | ||
len_inner!() | ||
}; | ||
} | ||
|
||
const BAR: usize = 0; | ||
|
||
fn main() { | ||
let val: [bool; len!()] = []; | ||
} |
13 changes: 13 additions & 0 deletions
13
tests/ui/const-generics/early/trivial-const-arg-macro-param.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 @@ | ||
//@ check-pass | ||
|
||
macro_rules! len { | ||
($x:ident) => { | ||
$x | ||
}; | ||
} | ||
|
||
fn bar<const N: usize>() { | ||
let val: [bool; len!(N)] = [true; N]; | ||
} | ||
|
||
fn main() {} |
13 changes: 13 additions & 0 deletions
13
tests/ui/const-generics/early/trivial-const-arg-macro-res-error.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 @@ | ||
// This is a regression test for #128016. | ||
|
||
macro_rules! len { | ||
() => { | ||
target | ||
//~^ ERROR cannot find value `target` | ||
}; | ||
} | ||
|
||
fn main() { | ||
let val: [str; len!()] = []; | ||
//~^ ERROR the size for values | ||
} |
24 changes: 24 additions & 0 deletions
24
tests/ui/const-generics/early/trivial-const-arg-macro-res-error.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,24 @@ | ||
error[E0425]: cannot find value `target` in this scope | ||
--> $DIR/trivial-const-arg-macro-res-error.rs:5:9 | ||
| | ||
LL | target | ||
| ^^^^^^ not found in this scope | ||
... | ||
LL | let val: [str; len!()] = []; | ||
| ------ in this macro invocation | ||
| | ||
= note: this error originates in the macro `len` (in Nightly builds, run with -Z macro-backtrace for more info) | ||
|
||
error[E0277]: the size for values of type `str` cannot be known at compilation time | ||
--> $DIR/trivial-const-arg-macro-res-error.rs:11:14 | ||
| | ||
LL | let val: [str; len!()] = []; | ||
| ^^^^^^^^^^^^^ doesn't have a size known at compile-time | ||
| | ||
= help: the trait `Sized` is not implemented for `str` | ||
= note: slice and array elements must have `Sized` type | ||
|
||
error: aborting due to 2 previous errors | ||
|
||
Some errors have detailed explanations: E0277, E0425. | ||
For more information about an error, try `rustc --explain E0277`. |
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,15 @@ | ||
//@ check-pass | ||
|
||
// This is a regression test for #128016. | ||
|
||
macro_rules! len { | ||
() => { | ||
BAR | ||
}; | ||
} | ||
|
||
const BAR: usize = 0; | ||
|
||
fn main() { | ||
let val: [bool; len!()] = []; | ||
} |
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
Oops, something went wrong.