forked from rust-lang/rust
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#87854 - BoxyUwU:var-None, r=oli-obk
correctly handle enum variants in `opt_const_param_of` Fixes rust-lang#87542 `opt_const_param_of` was returning `None` for args on an enum variant `Enum::Variant::<10>` because we called `generics_of` on the enum variant which has no generics. r? ````@oli-obk````
- Loading branch information
Showing
2 changed files
with
29 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// check-pass | ||
enum Foo<const N: usize> { | ||
Variant, | ||
Variant2(), | ||
Variant3{}, | ||
} | ||
|
||
struct Bar<const N: usize>; | ||
struct Bar2<const N: usize>(); | ||
struct Bar3<const N: usize> {} | ||
|
||
fn main() { | ||
let _ = Foo::Variant::<1>; | ||
let _ = Foo::Variant2::<1>(); | ||
let _ = Foo::Variant3::<1>{}; | ||
|
||
let _ = Foo::<1>::Variant; | ||
let _ = Foo::<1>::Variant2(); | ||
let _ = Foo::<1>::Variant3{}; | ||
|
||
let _ = Bar::<1>; | ||
let _ = Bar2::<1>(); | ||
let _ = Bar3::<1>{}; | ||
} |