-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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 #92149 - fee1-dead:cache-fix, r=oli-obk
Fix bad caching of `~const Drop` bounds Fixes #92111.
- Loading branch information
Showing
3 changed files
with
41 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// Regression test for #92111. | ||
// | ||
// The issue was that we normalize trait bounds before caching | ||
// results of selection. Checking that `impl NoDrop for S` requires | ||
// checking `S: !Drop` because it cannot overlap with the blanket | ||
// impl. Then we save the (unsatisfied) result from checking `S: Drop`. | ||
// Then the call to `a` checks whether `S: ~const Drop` but we normalize | ||
// it to `S: Drop` which the cache claims to be unsatisfied. | ||
// | ||
// check-pass | ||
|
||
#![feature(const_trait_impl)] | ||
#![feature(const_fn_trait_bound)] | ||
|
||
pub trait Tr {} | ||
|
||
#[allow(drop_bounds)] | ||
impl<T: Drop> Tr for T {} | ||
|
||
#[derive(Debug)] | ||
pub struct S(i32); | ||
|
||
impl Tr for S {} | ||
|
||
const fn a<T: ~const Drop>(t: T) {} | ||
|
||
fn main() { | ||
a(S(0)); | ||
} |