-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Normalize associated type projections when checking return type of main #88706
Conversation
r? @nagisa (rust-highfive has picked a reviewer for you, use r? to override) |
This is my first time actually touching anything within typechecking, so please let me know if I accidentally silently broke something or did something wrong. 😅 |
This fixes rust-lang#88609. Previously, the return type of `fn main()` would not have any associated type projections within normalized before checking if it implements the standard library trait `std::process::Termination`. This commit appears to fix it. This feels vaguely symptomatic of a problem in the underlying trait solving engine, but I am not sure how I would solve that. I am unsure why the example in rust-lang#88609 with `assert_impl_termination` and `fn foo()` work, but simply `fn main()` doesn't. The way that I solved this is also probably not the best way to do this, so please let me know if there is a better way to do this. I have added a build-pass regression test for this issue.
This comment has been minimized.
This comment has been minimized.
e69acc7
to
734209e
Compare
r? @jackh726 |
Use register_predicate_obligations rather than a for loop, since I didn't see that before. Also destructure in the `let` rather than projecting the fields individually
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 wanted to think more about this, if there's a better way to do this. But I think this is fine for now.
@bors r+ rollup |
📌 Commit 33a2825 has been approved by |
…arth Rollup of 10 pull requests Successful merges: - rust-lang#88706 (Normalize associated type projections when checking return type of main) - rust-lang#88828 (Use `libc::sigaction()` instead of `sys::signal()` to prevent a deadlock) - rust-lang#88871 (Fix suggestion for nested struct patterns) - rust-lang#89317 (Move generic error message to separate branches) - rust-lang#89351 (for signed wrapping remainder, do not compare lhs with MIN) - rust-lang#89442 (Add check for duplicated doc aliases) - rust-lang#89502 (Fix Lower/UpperExp formatting for integers and precision zero) - rust-lang#89523 (Make `proc_macro_derive_resolution_fallback` a future-breakage lint) - rust-lang#89532 (Document behavior of `MaybeLiveLocals` regarding enums and field-senstivity) - rust-lang#89546 (Make an initial guess for metadata size to reduce buffer resizes) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
This fixes #88609.
Previously, the return type of
fn main()
would not have any associated type projections within normalized before checking if it implements the standard library traitstd::process::Termination
. This commit appears to fix it.This feels vaguely symptomatic of a problem in the underlying trait solving engine, but I am not sure how I would solve that. I am unsure why the example in #88609 with
assert_impl_termination
andfn foo()
work, but simplyfn main()
doesn't. The way that I solved this is also probably not the best way to do this, so please let me know if there is a better way to do this.I have added a build-pass regression test for this issue.