-
Notifications
You must be signed in to change notification settings - Fork 12.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Retroactively feature gate ConstArgKind::Path
#129246
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just put this as internal since it's only really being added to avoid a beta regression and is not really intended to be a "real" feature since it has no user impact whatsoever