-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
Don't check unsize goal in MIR validation when opaques remain #130989
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -595,6 +595,17 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> { | |
&self, | ||
pred: impl Upcast<TyCtxt<'tcx>, ty::Predicate<'tcx>>, | ||
) -> bool { | ||
let pred: ty::Predicate<'tcx> = pred.upcast(self.tcx); | ||
|
||
// We sometimes have to use `defining_opaque_types` for predicates | ||
// to succeed here and figuring out how exactly that should work | ||
// is annoying. It is harmless enough to just not validate anything | ||
// in that case. We still check this after analysis as all opaque | ||
// types have been revealed at this point. | ||
if pred.has_opaque_types() { | ||
return true; | ||
} | ||
Comment on lines
+605
to
+607
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm slightly concerned because we use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remember that this is just validation I added, and we validate MIR after opaques are revealed. I'm not totally certain if I understand the concern here. |
||
|
||
let infcx = self.tcx.infer_ctxt().build(); | ||
let ocx = ObligationCtxt::new(&infcx); | ||
ocx.register_obligation(Obligation::new( | ||
|
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
//@ check-pass | ||
compiler-errors marked this conversation as resolved.
Show resolved
Hide resolved
|
||
//@ compile-flags: -Zvalidate-mir | ||
|
||
fn hello() -> &'static [impl Sized; 0] { | ||
if false { | ||
let x = hello(); | ||
let _: &[i32] = x; | ||
} | ||
&[] | ||
} | ||
|
||
fn main() {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we not enforce this in some way?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't enforce it anyways for
mir_assign_valid_types
, so I don't see any reason to do so. I also don't think it would be easy to do.