Skip to content

Conversation

@WaffleLapkin
Copy link
Member

... and minor cleanup.

r? lcnr

The code supporting it is extremely confusing. At the same time, we have
no plans to use this scheme, so there is no value in supporting it.
@WaffleLapkin WaffleLapkin added the F-never_type `#![feature(never_type)]` label Nov 12, 2025
@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Nov 12, 2025
@rust-log-analyzer

This comment has been minimized.

@WaffleLapkin
Copy link
Member Author

I have really low confidence in the never type tests, IMO they require a major refactoring, as a lot of them are based on outdated ideas and features...

@rust-log-analyzer

This comment has been minimized.

@jackh726
Copy link
Member

For the tests, I would expect us to have revisions for edition 2021 and edition 2024 (for the different fallbacks)

@WaffleLapkin
Copy link
Member Author

@jackh726 I'm not sure 2021vs2015 is relevant. But either way, yes, I agree that we should have tests for both current fallback behaviors based on the edition. I'll make a followup which cleans up the tests, wanna make sure that we have relevant and comprehensive tests.

@rust-log-analyzer

This comment has been minimized.

the only diagnostic that was using this field specifically сares for the
never type fallback, not the integer fallback.
I think in this case the early return is harder to read than just an if.
"if fallback hasn't occured we don't do..."
this is about context dependant case which I removed a few commits back
... now that it's always the same for a certain crate
Comment on lines +56 to +58
// phase of fallback. This means that we only replace
// inference variables with their underlying opaque types as a
// last resort.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

existing, but I do not understand that comment?

Do you understand what this wants to say. It feels like this is a general "if fallback occurred, previously stalled goals may make progress again".

I really don't see how there's anything specific to opaques here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't get it either .-.

the example below is supposed to explain this, but I still don't get it

});
let unit_obligation = obligation.with(tcx, predicate);
if self.predicate_may_hold(&unit_obligation) {
// FIXME: make a new issue for this
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you elaborate on that FIXME? it feels unactionable for anyone who isn't you right now... or maybe just do that if you can xd

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, I opened #148922 and linked it from here. I tried my best to write a good explanation, but it's just confusing :(

@@ -1,9 +1,8 @@
//@ revisions: nofallback fallback
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

want to rename the revisions to "unit_fallback never_fallback"?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In a follow up

fallback_to(self.tcx.types.unit);
}
DivergingFallbackBehavior::ContextDependent => {
if found_infer_var_info.self_in_trait && found_infer_var_info.output {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

found_infer_var_info is dead code now?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you mean InferVarInfo? Yes, it is. Removed.

@lcnr lcnr added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Nov 13, 2025
@jackh726
Copy link
Member

@jackh726 I'm not sure 2021vs2015 is relevant. But either way, yes, I agree that we should have tests for both current fallback behaviors based on the edition. I'll make a followup which cleans up the tests, wanna make sure that we have relevant and comprehensive tests.

I don't think we need to worry about 2015, just 2024 vs 2021 since that highlights the difference in fallback behavior.

@WaffleLapkin
Copy link
Member Author

@rustbot review

@rustbot rustbot removed the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Nov 13, 2025
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Nov 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

F-never_type `#![feature(never_type)]` S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants