-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Fix PostBorrowckAnalysis
for old solver
#135899
base: master
Are you sure you want to change the base?
Fix PostBorrowckAnalysis
for old solver
#135899
Conversation
@@ -36,5 +36,21 @@ note: this opaque type is in the signature | |||
LL | type Bar = impl std::fmt::Display; | |||
| ^^^^^^^^^^^^^^^^^^^^^^ | |||
|
|||
error: aborting due to 3 previous errors | |||
error: the constant `N` is not of type `{type error}` |
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.
See the comment:
// FIXME: We should reveal the TAITs that end up in where clauses here, otherwise we
// will not be able to match param-env candidates in the old solver, since we don't
// have eq-modulo-normalization. This is less of a problem than it seems, since this
// only matters if we have TAITs in where where clauses, which isn't achievable with
// RPIT anyways.
@@ -6,5 +6,21 @@ LL | async fn test<const N: crate::Bar>() { | |||
| | |||
= note: the only supported types are integers, `bool`, and `char` | |||
|
|||
error: aborting due to 1 previous error | |||
error: the constant `N` is not of type `u32` |
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.
See the comment:
See the comment:
// FIXME: We should reveal the TAITs that end up in where clauses here, otherwise we
// will not be able to match param-env candidates in the old solver, since we don't
// have eq-modulo-normalization. This is less of a problem than it seems, since this
// only matters if we have TAITs in where where clauses, which isn't achievable with
// RPIT anyways.
@@ -1,7 +1,5 @@ | |||
// ICE failed to resolve instance for ... | |||
// issue: rust-lang/rust#123145 | |||
//@ build-fail |
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.
This now cycles in check_opaque_well_formed
, since now we actually reveal impl Handler
when proving that it satisfies its own item bounds. This seems desirable to me.
let generic_ty = self.cx().type_of(data.def_id); | ||
let mut concrete_ty = generic_ty.instantiate(self.cx(), args); | ||
|
||
if concrete_ty == ty { |
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.
This recursiveness check sucks, but it prevents bad error messages.
Ty::new_error_with_message(self.cx(), self.cause.span, "recursive opaque type"); | ||
} | ||
|
||
let concrete_ty = fold_regions(self.cx(), concrete_ty, |re, _dbi| match re.kind() { |
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.
I wonder if we should consolidate all of these "replace erasing with infer" so that we only need to change it in one place when we start using a real binder...
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.
yeah, we probably should 😁
The job Click to see the possible cause of the failure (guessed by this bot)
|
💀 I guess I'll minimize that ^ |
@@ -128,10 +129,10 @@ pub(super) fn needs_normalization<'tcx, T: TypeVisitable<TyCtxt<'tcx>>>( | |||
// so we can ignore those. | |||
match infcx.typing_mode() { | |||
// FIXME(#132279): We likely want to reveal opaques during post borrowck analysis |
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.
outdated
@@ -224,28 +258,20 @@ impl<'a, 'b, 'tcx> TypeFolder<TyCtxt<'tcx>> for AssocTypeNormalizer<'a, 'b, 'tcx | |||
// Only normalize `impl Trait` outside of type inference, usually in codegen. | |||
match self.selcx.infcx.typing_mode() { | |||
// FIXME(#132279): We likely want to reveal opaques during post borrowck analysis |
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.
outdated
@@ -973,9 +973,6 @@ impl<'tcx> InferCtxt<'tcx> { | |||
TypingMode::Analysis { defining_opaque_types } => { | |||
id.into().as_local().is_some_and(|def_id| defining_opaque_types.contains(&def_id)) | |||
} | |||
// FIXME(#132279): This function is quite weird in post-analysis | |||
// and post-borrowck analysis mode. We may need to modify its uses | |||
// to support PostBorrowckAnalysis in the old solver as well. |
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.
why remove this FIXME 🤔 I feel like ideally we just never call this function outside of TypingMode::Analysis
, not sure whether that's possible, might be kinda ugly to implement
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.
some nits, i'd like to see a crater run here after u've figured out the ci failure
☔ The latest upstream changes (presumably #134824) made this pull request unmergeable. Please resolve the merge conflicts. |
branch name is typo'dThis "fixes" the
PostBorrowckAnalysis
mode for the old solver, and begins to use it incheck_opaque_well_formed
andcheck_coroutine_obligations
.There are several curiosities here that result.
r? lcnr