forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of rust-lang#126297 - jhpratt:rollup-ntic8q6, r=jhpratt
Rollup of 6 pull requests Successful merges: - rust-lang#123374 (DOC: Add FFI example for slice::from_raw_parts()) - rust-lang#126127 (Spell out other trait diagnostic) - rust-lang#126228 (Provide correct parent for nested anon const) - rust-lang#126249 (Simplify `[T; N]::try_map` signature) - rust-lang#126256 (Add {{target}} substitution to compiletest) - rust-lang#126263 (Make issue-122805.rs big endian compatible) r? `@ghost` `@rustbot` modify labels: rollup
- Loading branch information
Showing
48 changed files
with
450 additions
and
362 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
20 changes: 20 additions & 0 deletions
20
tests/ui/const-generics/repeat_expr_hack_gives_right_generics.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,20 @@ | ||
// Given an anon const `a`: `{ N }` and some anon const `b` which references the | ||
// first anon const: `{ [1; a] }`. `b` should not have any generics as it is not | ||
// a simple `N` argument nor is it a repeat expr count. | ||
// | ||
// On the other hand `b` *is* a repeat expr count and so it should inherit its | ||
// parents generics as part of the `const_evaluatable_unchecked` fcw (#76200). | ||
// | ||
// In this specific case however `b`'s parent should be `a` and so it should wind | ||
// up not having any generics after all. If `a` were to inherit its generics from | ||
// the enclosing item then the reference to `a` from `b` would contain generic | ||
// parameters not usable by `b` which would cause us to ICE. | ||
|
||
fn bar<const N: usize>() {} | ||
|
||
fn foo<const N: usize>() { | ||
bar::<{ [1; N] }>(); | ||
//~^ ERROR: generic parameters may not be used in const operations | ||
} | ||
|
||
fn main() {} |
11 changes: 11 additions & 0 deletions
11
tests/ui/const-generics/repeat_expr_hack_gives_right_generics.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,11 @@ | ||
error: generic parameters may not be used in const operations | ||
--> $DIR/repeat_expr_hack_gives_right_generics.rs:16:17 | ||
| | ||
LL | bar::<{ [1; N] }>(); | ||
| ^ cannot perform const operation using `N` | ||
| | ||
= help: const parameters may only be used as standalone arguments, i.e. `N` | ||
= help: add `#![feature(generic_const_exprs)]` to allow generic const expressions | ||
|
||
error: aborting due to 1 previous error | ||
|
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.