-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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 #86987 - lcnr:const-default-eval-bound, r=oli-obk
only check cg defaults wf once instantiated the previous fixmes here didn't make too much sense as I didn't yet fully understand the code further below. That code only runs if the predicates using our generic param default are fully concrete after substituting our default, which never happens if our default is generic. r? `@oli-obk` `@BoxyUwU`
- Loading branch information
Showing
6 changed files
with
31 additions
and
38 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
6 changes: 6 additions & 0 deletions
6
src/test/ui/const-generics/const_evaluatable_checked/unused-complex-default-expr.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,6 @@ | ||
// check-pass | ||
#![feature(const_generics, const_evaluatable_checked, const_generics_defaults)] | ||
#![allow(incomplete_features)] | ||
struct Foo<const N: usize, const M: usize = { N + 1 }>; | ||
struct Bar<const N: usize>(Foo<N, 3>); | ||
fn main() {} |
18 changes: 0 additions & 18 deletions
18
src/test/ui/const-generics/defaults/complex-generic-default-expr.full.stderr
This file was deleted.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
src/test/ui/const-generics/defaults/complex-generic-default-expr.min.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
7 changes: 3 additions & 4 deletions
7
src/test/ui/const-generics/defaults/complex-generic-default-expr.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 |
---|---|---|
@@ -1,14 +1,13 @@ | ||
// revisions: full min | ||
//[full] check-pass | ||
#![cfg_attr(full, feature(const_generics))] | ||
#![feature(const_generics_defaults)] | ||
#![allow(incomplete_features)] | ||
|
||
struct Foo<const N: usize, const M: usize = { N + 1 }>; | ||
//[full]~^ ERROR constant expression depends on a generic parameter | ||
//[min]~^^ ERROR generic parameters may not be used in const operations | ||
//[min]~^ ERROR generic parameters may not be used in const operations | ||
|
||
struct Bar<T, const TYPE_SIZE: usize = { std::mem::size_of::<T>() }>(T); | ||
//[full]~^ ERROR constant expression depends on a generic parameter | ||
//[min]~^^ ERROR generic parameters may not be used in const operations | ||
//[min]~^ ERROR generic parameters may not be used in const operations | ||
|
||
fn main() {} |