-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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 default methods with return-position impl Trait
in trait
#107013
Fix default methods with return-position impl Trait
in trait
#107013
Conversation
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
⌛ Trying commit 5e7bb83 with merge e76d8749244270bde4f1e2b60717e8aa5873cfd4... |
@@ -148,6 +150,22 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> { | |||
|
|||
#[instrument(skip(self), level = "debug")] | |||
fn equate_normalized_input_or_output(&mut self, a: Ty<'tcx>, b: Ty<'tcx>, span: Span) { | |||
let (a, b) = (a, b).fold_with(&mut BottomUpFolder { |
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.
Within a method, treat its own RPITITs as ty::Opaque
.
This probably could be a custom folder so it's more efficient... perf will tell.
@@ -627,6 +628,42 @@ where | |||
self.relate_opaques(a, b) | |||
} | |||
|
|||
// Handle default-body RPITITs |
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.
Within a method, relating one of that method's RPITITs against a concrete type should act just like opaque type inference.
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.
Looked at this for ~10 minutes and I don't understand it '^^ would probably be best to chat about this in sync next week
@@ -52,7 +52,7 @@ impl<'tcx> InferCtxt<'tcx> { | |||
span: Span, | |||
param_env: ty::ParamEnv<'tcx>, | |||
) -> InferOk<'tcx, T> { | |||
if !value.has_opaque_types() { | |||
if !value.has_projections() { |
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 need to handle either RPITITs (projections) and opaques... hopefully this doesn't hurt perf too much :/
☀️ Try build successful - checks-actions |
1 similar comment
☀️ Try build successful - checks-actions |
This comment has been minimized.
This comment has been minimized.
Finished benchmarking commit (e76d8749244270bde4f1e2b60717e8aa5873cfd4): comparison URL. Overall result: ❌ regressions - no action neededBenchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR may lead to changes in compiler perf. @bors rollup=never Instruction countThis is a highly reliable metric that was used to determine the overall result at the top of this comment.
Max RSS (memory usage)ResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesThis benchmark run did not return any relevant results for this metric. |
@@ -0,0 +1 @@ | |||
B |
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.
instead of printing stuff return a bool
and assert that it is correct?
@@ -627,6 +628,42 @@ where | |||
self.relate_opaques(a, b) | |||
} | |||
|
|||
// Handle default-body RPITITs |
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.
Looked at this for ~10 minutes and I don't understand it '^^ would probably be best to chat about this in sync next week
talked about this in sync. the current approach is not quite right. We probably want to extend the param env with a @rustbot author |
…lt-constraint, r=oli-obk Add a test for default trait method with RPITITs This didn't work in rust-lang#107013, but now that rust-lang#108203 has landed, let's make sure we don't regress it. r? types
Fixes #107002
Removes this weird hack in projection... and replaces it with some other hacks in HIR and MIR typeck.
r? types
Specifically, we should only be able to observe the opaque for a default method in the body of that method itself. For example: