Conversation
|
r? @jackh726 (rust-highfive has picked a reviewer for you, use r? to override) |
c874486 to
c3bf78b
Compare
This comment has been minimized.
This comment has been minimized.
|
@bors try @rust-timer queue |
|
Awaiting bors try build completion. @rustbot label: +S-waiting-on-perf |
|
⌛ Trying commit 82fa1136489005893be02555b865ca6a90d923f3 with merge 1ab52f9b015fe3b11f0862dd6cbf44c426995a28... |
|
☀️ Try build successful - checks-actions |
|
Queued 1ab52f9b015fe3b11f0862dd6cbf44c426995a28 with parent 44fcfb0, future comparison URL. |
|
Finished benchmarking commit (1ab52f9b015fe3b11f0862dd6cbf44c426995a28): comparison URL. Overall result: no relevant changes - 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 benchmark run did not return any relevant results for this metric. Max RSS (memory usage)This benchmark run did not return any relevant results for this metric. CyclesThis benchmark run did not return any relevant results for this metric. |
82fa113 to
4bdd2e4
Compare
|
r? @lcnr |
|
☔ The latest upstream changes (presumably #102618) made this pull request unmergeable. Please resolve the merge conflicts. |
4bdd2e4 to
a1a29a3
Compare
There was a problem hiding this comment.
recording types with escaping bound vars is pretty cursed anyways 🤔 ideally we just don't™. Do you know where that currently happens?
There was a problem hiding this comment.
This happens in nested hir::Ty's, e.g. &'a str in let _: for<'a> fn(&'a str). But I don't think they're relevant to typeck since the outer type has no escaping bound vars. One place where it actually matters is in closures - underscore lifetimes are always late-bound regions (e.g. |_: &'_ str| {}) but we currently handle this in closure.rs by normalizing the complete signature rather than each input type separately.
There was a problem hiding this comment.
this means that self_ctor_substs are already normalized, but are used as substs_raw further down. I would expect this to be a bug (where we again ignore region obligations from user written types)
There was a problem hiding this comment.
SelfCtor type is already checked by item wfcheck, so I don't think we will miss region obligations when normalizing.
There was a problem hiding this comment.
hmm, we can't rely on probe_adt here because we also need the substs 🤔 i guess that's fine then.
While I am not sure whether we could land this, can you add something like the following here?
FIXME: Try to change this to use the unnormalized type here and check the resulting breakage.There was a problem hiding this comment.
This was indeed problematic. I have fixed it in e05158d.
There was a problem hiding this comment.
no, we shouldn't imo
imo we should have never relied on normalization during ast lowering. We won't be able to remove the existing normalization due to backwards compatibility. I think we should just live with the existing inconsistency, potentially even linting when normalization is required to remove it 2030 or whatever
There was a problem hiding this comment.
I tend to agree. The fact that path resolution depends on normalization may be an unintended behavior.
There was a problem hiding this comment.
cc @rust-lang/types I generally don't think we should normalize during astconv to resolve stuff like Self::A if Self is a projection. Examples include
trait Identity {
type Id;
}
impl<T> Identity for T {
type Id = T;
}
enum Foo {
A,
B,
}
trait Trait {
fn return_a() -> Self;
}
impl Trait for <Foo as Identity>::Id {
fn return_a() -> Self {
Self::A
}
}
fn main() {
let x = <<Foo as Identity>::Id>::A;
}We do have to keep supporting this for backwards compatibility however.
I therefore think that we should 1) remove the FIXME here and add a comment for "we cannot normalize inside of a binder" 2) rename this method to probe_adt_normalize_for_backcompat to prevent us from at least adding further uses of that method.
edit: we do normalize for resolve_fully_qualified_call as well it's not as simple as only warning on this method 🤔 idk
src/test/ui/associated-types/bound-region-variant-resolution.rs
Outdated
Show resolved
Hide resolved
|
Thanks ❤️ As this is a breaking change, going to run crater and then go through a t-types FCP. r=me on the impl after some nits @bors try |
|
⌛ Trying commit a1a29a30952de6b1aed11075b0979825595c5275 with merge c4ca63acfd7111dc43e5bc36534474f323ca449a... |
|
☀️ Try build successful - checks-actions |
Projection types in user annotations may contain inference variables. This makes the normalization depend on the unification with the actual type and thus requires a separate TypeOp to track the obligations. Otherwise simply calling `TypeChecker::normalize` would ICE with "unexpected ambiguity"
Delay until user annotations are registered. See the added test.
e05158d to
bf228ac
Compare
|
@bors r+ rollup=never |
|
☀️ Test successful - checks-actions |
|
Finished benchmarking commit (af58fc8): comparison URL. Overall result: ❌✅ regressions and improvements - ACTION NEEDEDNext Steps: If you can justify the regressions found in this perf run, please indicate this with @rustbot label: +perf-regression 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)This benchmark run did not return any relevant results for this metric. CyclesResultsThis 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.
|
|
Mixed results, but overall small in magnitude and relatively scattered. Marking as triaged -- I don't think we need to dig in further. This change fixes a couple bugs, so it's worthwhile to accept small regressions like this. |
See individual commits.
Fixes #101350
Fixes #54940