-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix generic args specialization for unevaluated MIR constants (#13)
- Loading branch information
1 parent
b243ed7
commit 4b42ac4
Showing
3 changed files
with
26 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
21 changes: 21 additions & 0 deletions
21
checker/tests/run-pass/unevaluated_mir_const_gen_arg_specialization.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 @@ | ||
// This source code is licensed under the MIT license found in the | ||
// LICENSE file in the root directory of this source tree. | ||
|
||
// A test that visits `BlockVisitor::visit_unevaluated_const` with a non-promoted MIR constant | ||
// that resolves to an instance with generic args. | ||
|
||
pub trait MyTrait { | ||
const MY_ASSOC_CONST: u8; | ||
} | ||
|
||
pub struct MyConstGenericImpl<const N: u8>; | ||
|
||
impl<const N: u8> MyTrait for MyConstGenericImpl<N> { | ||
const MY_ASSOC_CONST: u8 = N; | ||
} | ||
|
||
pub fn foo<T>(_x: T) {} | ||
|
||
pub fn main() { | ||
foo(MyConstGenericImpl::<1>::MY_ASSOC_CONST); | ||
} |