leak_check in rustc_const_eval::util::relate_types - #155883
Conversation
|
|
This comment has been minimized.
This comment has been minimized.
| impl Trait for F1 { | ||
| type Assoc = i64; | ||
| } | ||
| #[expect(coherence_leak_check)] |
There was a problem hiding this comment.
What does this do...?
There was a problem hiding this comment.
it expects the coherence_leak_check lint. That lint is in a horrible state but fixing the lint doesn't seem too useful given that this thing is currently still in flux and updating it properly is non-trivial 😅
There was a problem hiding this comment.
Ah, your fix makes this code emit a lint (#56105). That doesn't seem to make much sense but 🤷 sure whatever.
de223eb to
715e75d
Compare
|
r=me based on the tests passing. Up to you if you want to get a review from someone who actually knows what all these type system queries do. ;) |
| ocx.evaluate_obligations_error_on_ambiguity().is_empty() | ||
|
|
||
| if ocx.evaluate_obligations_error_on_ambiguity().is_empty() { | ||
| infcx.leak_check(ty::UniverseIndex::ROOT, None).is_ok() |
There was a problem hiding this comment.
| infcx.leak_check(ty::UniverseIndex::ROOT, None).is_ok() | |
| // Ensure there are no pending lifetime constraints. This is needed to avoid issues like | |
| // <https://github.com/rust-lang/rust/issues/155477>. | |
| infcx.leak_check(ty::UniverseIndex::ROOT, None).is_ok() |
This comment has been minimized.
This comment has been minimized.
|
looks like this exposes a place where validation uses equality instead of subtyping? don't have the time to look into that rn, but prolly just need to change the variance/used function at the place where this ICEs |
|
@rustbot author |
|
Reminder, once the PR becomes ready for a review, use |
This comment has been minimized.
This comment has been minimized.
|
affected test with just fn foo(_: &str) {}
fn main() {
let lhs = foo as fn(&'static str);
let rhs = foo as for<'a> fn(&'a str);
let _ = lhs == rhs;
} |
|
looking at the MIR https://gist.github.com/lcnr/0b3dde206b3c47989e30a9bbcfbdc3cf we just equate MIR validation then checks whether |
715e75d to
d475155
Compare
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
|
started a zulip thread for this as I don't have the capacity to impl this myself https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/subtyping.20in.20MIR.20building.20for.20builtin.20binary.20ops/with/618977123 |
|
The job Click to see the possible cause of the failure (guessed by this bot) |
fixes #155477. we should really figure out an API where people don't have to manually call
leak_checkfor their code to be correct. I don't really know what that API should be for now, but the status quo sucks xxsame issue was recently fixed when checking that the return type of
fn mainimplementsTerminationin #151377r? BoxyUwU