-
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
Do not eagerly reject inference vars when trying to resolve method calls. #126316
base: master
Are you sure you want to change the base?
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
…r-errors Avoid a bunch of booleans in favor of Result<(), ErrorGuaranteed> as that more robustly proves that an error has been emitted pulled out of rust-lang#126316 This PR cannot have any effect on compilation. All it does is shift a `Ty::new_misc_error` to a `span_delayed_bug` and preserve the `ErrorGuaranteed` in all other cases
Rollup merge of rust-lang#126317 - oli-obk:recursive_rpit4, r=compiler-errors Avoid a bunch of booleans in favor of Result<(), ErrorGuaranteed> as that more robustly proves that an error has been emitted pulled out of rust-lang#126316 This PR cannot have any effect on compilation. All it does is shift a `Ty::new_misc_error` to a `span_delayed_bug` and preserve the `ErrorGuaranteed` in all other cases
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment has been minimized.
This comment has been minimized.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as resolved.
This comment was marked as resolved.
This comment has been minimized.
This comment has been minimized.
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.
want to take some time to look at when exactly we don't error if there's an auto-deref step resulting in an infer var, will get to this next week hopefully
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
b9e0e6c
to
52d9ace
Compare
This comment has been minimized.
This comment has been minimized.
39dd4bd
to
6aa66e4
Compare
@@ -1,31 +1,15 @@ | |||
error[E0282]: type annotations needed | |||
--> $DIR/hidden-type-is-opaque-2.rs:10:17 | |||
error[E0599]: no method named `reify_as` found for type `_` in the current scope |
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.
errors like this are pretty useless and should be fixed before landing the PR
pub fn parse() -> Option<Vec<()>> { | ||
let iter = std::iter::once(Some(())).map(|o| o.map(Into::into)); | ||
let items = iter.collect::<Option<Box<_>>>()?; //~ ERROR E0282 | ||
//~^ NOTE this is an inference error on crate `time` caused by an API change in Rust 1.80.0; update `time` to version `>=0.3.35` | ||
let items = iter.collect::<Option<Box<_>>>()?; | ||
Some(items.into()) | ||
//~^ NOTE type must be known at this point | ||
} |
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.
This PR fixes the time
inference regression caused by #99969
I can see how that happens, but it's best effort, as with most inference errors or fixes we can't make long term guarantees...
fn shines_a_beacon_through_the_darkness() { | ||
let x: Option<_> = None; //~ ERROR type annotations needed | ||
let x: Option<_> = None; | ||
x.unwrap().method_that_could_exist_on_some_type(); | ||
//~^ ERROR no method named `method_that_could_exist_on_some_type` found for type `_` | ||
} |
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.
as per the comment above, this diagnostic needs to be fixed again
6aa66e4
to
6e73868
Compare
…en types of opaque types."" This reverts commit ad00868.
☔ The latest upstream changes (presumably #134052) made this pull request unmergeable. Please resolve the merge conflicts. |
6e73868
to
d6c0560
Compare
Reintroduces the changes reverted in #126258 and fixes the regression in the old solver.
The new solver will still fail on
because while type checking the method call
.parse()
, when looking for candidates, we end up not finding any, as the only information we have is that there's an unresolvedAliasTy(opaque, infer_var)
floating around while looking for a method call oninfer_var
.This obviously seems fixable by looking at said obligation, but I'd prefer to tackle that separately (I got half an impl locally, but there are multiple paths forward that we should discuss)
r? @lcnr @compiler-errors
I'm going to split out the effect-free cleanups and the inference changes to separate PRs, so we can review them in isolation, but with the goal of enabling this PR to land