-
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
Add revisions for -Zlower-impl-trait-in-trait-to-assoc-ty fixed tests #109193
Conversation
Moving forward, can you not commit a separate "Add revisions to fixed tests" commit? If any of the first 3 commits fixes a UI test, then that UI test should be associated with each commit that fixes it. If the commit doesn't fix any UI tests, then it can probably be squashed together with the other commits that fully fix a test or not. Basically I want to see-- Commit A
Commit B
It's hard to tell what is fixed by what, especially because there are not many comments in this PR really. |
@@ -396,10 +396,29 @@ impl<'tcx> InferCtxt<'tcx> { | |||
/// defining scope. | |||
#[instrument(skip(self), level = "trace", ret)] | |||
fn opaque_type_origin_unchecked(&self, def_id: LocalDefId) -> OpaqueTyOrigin { |
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.
It makes me uncomfortable that we're calling opaque_type_origin_unchecked
on an associated type. That's probably wrong...
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.
Going to check why is being called.
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 think this is fixed alternatively by #109198, and should make it so that we don't need to modify opaque_type_origin_unchecked
at all.
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.
Can you tell me how #109198 avoid calling this function?. I see in the logs that this is coming from check_fn.
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.
Given some -> impl Trait
in trait, let's call that opaque def-id#1
(DefKind::Opaque
). We later synthesize a def-id#2
, which is an associated type (DefKind::AssocTy
).
In typeck_with_fallback
, we normalize ty::Alias(ty::Projection, def-id#2)
in the original trait signature to ty::Alias(ty::Opaque, def-id#2)
instead of ty::Alias(ty::Opaque, def-id#1)
, because of this FIXME:
rust/compiler/rustc_ty_utils/src/ty.rs
Lines 271 to 272 in c5c4340
// FIXME(-Zlower-impl-trait-in-trait-to-assoc-ty) need to project to the opaque, could | |
// get it via type_of + subst. |
rust/compiler/rustc_ty_utils/src/ty.rs
Lines 287 to 295 in c5c4340
self.predicates.push( | |
ty::Binder::bind_with_vars( | |
ty::ProjectionPredicate { | |
projection_ty: alias_ty, | |
term: self.tcx.mk_alias(ty::Opaque, alias_ty).into(), | |
}, | |
self.bound_vars, | |
) | |
.to_predicate(self.tcx), |
That's wrong, because def-id#2
is an associated type.
That passes a signature with the return type of ty::Alias(ty::Opaque, def-id#2)
to check_fn
, which passes it to replace_opaque_types_with_inference_vars
. That tries to call opaque_type_origin
on def-id#2
(reminder: an associated type) which ICEs.
That is what I fixed in #109198.
@@ -2231,6 +2231,10 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> { | |||
// ambiguous impls. The latter *ought* to be a | |||
// coherence violation, so we don't report it here. | |||
|
|||
if self.tcx.opt_rpitit_info(obligation.cause.body_id.to_def_id()).is_some() { |
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.
It's not generally sound to skip reporting an error here, without at least delaying a bug or something else. Can you explain why you're doing this?
We need all the changes to make the working tests pass. Each commit was making this tests ICE in a new part of the code :). |
This comment has been minimized.
This comment has been minimized.
37bf391
to
6405704
Compare
This comment has been minimized.
This comment has been minimized.
6405704
to
f1c9e2d
Compare
@compiler-errors only the last commit is relevant. Maybe you can even fetch that one up and place it in #109198 ? |
my pr already got rolled up into a rollup lol r=me when it's landed @bors rollup |
f1c9e2d
to
0df8c92
Compare
This thing is going to fail until #109198 is merged and we rebase on top of it. |
This comment has been minimized.
This comment has been minimized.
0df8c92
to
3634851
Compare
This comment has been minimized.
This comment has been minimized.
3634851
to
ae78e9b
Compare
@bors r=compiler-errors |
…er-errors Add revisions for -Zlower-impl-trait-in-trait-to-assoc-ty fixed tests Needs to go on top of rust-lang#109198 r? `@compiler-errors`
This comment has been minimized.
This comment has been minimized.
@bors r- Something is odd here. |
ae78e9b
to
e0302bb
Compare
Now yes ... @bors r=compiler-errors |
…er-errors Add revisions for -Zlower-impl-trait-in-trait-to-assoc-ty fixed tests Needs to go on top of rust-lang#109198 r? `@compiler-errors`
…iaskrgr Rollup of 8 pull requests Successful merges: - rust-lang#107416 (Error code E0794 for late-bound lifetime parameter error.) - rust-lang#108772 (Speed up tidy quite a lot) - rust-lang#109193 (Add revisions for -Zlower-impl-trait-in-trait-to-assoc-ty fixed tests) - rust-lang#109234 (Tweak implementation of overflow checking assertions) - rust-lang#109238 (Fix generics mismatch errors for RPITITs on -Zlower-impl-trait-in-trait-to-assoc-ty) - rust-lang#109283 (rustdoc: reduce allocations in `visibility_to_src_with_space`) - rust-lang#109287 (Use `size_of_val` instead of manual calculation) - rust-lang#109288 (Stabilise `unix_socket_abstract`) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Needs to go on top of #109198
r? @compiler-errors