-
Notifications
You must be signed in to change notification settings - Fork 13.6k
dont provide fwd declared params to cg defaults #86580
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
Merged
Merged
Changes from 4 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
05dcb78
Dont provide all parent generics to cgdefaults
BoxyUwU b44be27
Moves changes to explicit_preds_of/inferred_outlives_of/generics_of
BoxyUwU e276b86
redo tests
BoxyUwU 8c40360
Put checking if anonct is a default into a method on hir map
BoxyUwU abfd44d
Comments
BoxyUwU d1e5e72
change doc comment
BoxyUwU 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
14 changes: 14 additions & 0 deletions
14
src/test/ui/const-generics/defaults/cec-concrete-default.rs
This file contains hidden or 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,14 @@ | ||
#![feature(const_generics, const_evaluatable_checked, const_generics_defaults)] | ||
#![allow(incomplete_features)] | ||
|
||
struct Foo<const N: usize, const M: usize = { N + 1 }>; | ||
fn no_constraining() -> Foo<10> { | ||
Foo::<10, 11> | ||
} | ||
|
||
pub fn different_than_default() -> Foo<10> { | ||
Foo::<10, 12> | ||
//~^ error: mismatched types | ||
} | ||
|
||
fn main() {} |
12 changes: 12 additions & 0 deletions
12
src/test/ui/const-generics/defaults/cec-concrete-default.stderr
This file contains hidden or 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[E0308]: mismatched types | ||
--> $DIR/cec-concrete-default.rs:10:5 | ||
| | ||
LL | Foo::<10, 12> | ||
| ^^^^^^^^^^^^^ expected `11_usize`, found `12_usize` | ||
| | ||
= note: expected type `11_usize` | ||
found type `12_usize` | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0308`. |
16 changes: 16 additions & 0 deletions
16
src/test/ui/const-generics/defaults/cec-generic-default-mismatched-types.rs
This file contains hidden or 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,16 @@ | ||
#![feature(const_generics, const_evaluatable_checked, const_generics_defaults)] | ||
#![allow(incomplete_features)] | ||
|
||
struct Foo<const N: usize, const M: usize = { N + 1 }>; | ||
fn should_unify<const N: usize>() -> Foo<N> where [(); { N + 1 }]: { | ||
Foo::<N, { N + 1 }> | ||
} | ||
pub fn shouldnt_unify<const N: usize>() -> Foo<N> | ||
where | ||
[(); { N + 1 }]:, | ||
[(); { N + 2 }]:, { | ||
Foo::<N, { N + 2 }> | ||
//~^ error: mismatched types | ||
} | ||
|
||
fn main() {} |
12 changes: 12 additions & 0 deletions
12
src/test/ui/const-generics/defaults/cec-generic-default-mismatched-types.stderr
This file contains hidden or 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[E0308]: mismatched types | ||
--> $DIR/cec-generic-default-mismatched-types.rs:12:5 | ||
| | ||
LL | Foo::<N, { N + 2 }> | ||
| ^^^^^^^^^^^^^^^^^^^ expected `{ N + 1 }`, found `{ N + 2 }` | ||
| | ||
= note: expected type `{ N + 1 }` | ||
found type `{ N + 2 }` | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0308`. |
24 changes: 24 additions & 0 deletions
24
src/test/ui/const-generics/defaults/cec-generic-default.rs
This file contains hidden or 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(const_evaluatable_checked, const_generics, const_generics_defaults)] | ||
#![allow(incomplete_features)] | ||
|
||
pub struct Foo<const N: usize, const M: usize = { N + 1 }>; | ||
pub fn needs_evaluatable_bound<const N1: usize>() -> Foo<N1> { | ||
//~^ error: unconstrained generic constant | ||
loop {} | ||
} | ||
pub fn has_evaluatable_bound<const N1: usize>() -> Foo<N1> where [(); N1 + 1]: { | ||
loop {} | ||
} | ||
|
||
type FooAlias<const N: usize, const NP: usize = { N + 1 }> = [(); NP]; | ||
fn needs_evaluatable_bound_alias<T, const N: usize>() -> FooAlias<N> | ||
{ | ||
//~^^ error: unconstrained generic constant | ||
todo!() | ||
} | ||
fn has_evaluatable_bound_alias<const N: usize>() -> FooAlias<N> | ||
where [(); N + 1]: { | ||
todo!() | ||
} | ||
|
||
fn main() {} |
18 changes: 18 additions & 0 deletions
18
src/test/ui/const-generics/defaults/cec-generic-default.stderr
This file contains hidden or 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,18 @@ | ||
error: unconstrained generic constant | ||
--> $DIR/cec-generic-default.rs:5:54 | ||
| | ||
LL | pub fn needs_evaluatable_bound<const N1: usize>() -> Foo<N1> { | ||
| ^^^^^^^ | ||
| | ||
= help: try adding a `where` bound using this expression: `where [(); { N + 1 }]:` | ||
|
||
error: unconstrained generic constant | ||
--> $DIR/cec-generic-default.rs:14:58 | ||
| | ||
LL | fn needs_evaluatable_bound_alias<T, const N: usize>() -> FooAlias<N> | ||
| ^^^^^^^^^^^ | ||
| | ||
= help: try adding a `where` bound using this expression: `where [(); { N + 1 }]:` | ||
|
||
error: aborting due to 2 previous errors | ||
|
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.
Uh oh!
There was an error while loading. Please reload this page.