-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Normalize in infcx instead of globally for Option::as_deref
suggestion
#112303
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
Conversation
The projection may contain inference variables. These inference variables are local to the local inference context. Using `tcx.normalize_erasing_regions` doesn't work here because this method is global and does not have access to the inference context. It's therefore unable to deal with the inference variables. We normalize in the local inference context instead, which knowns about the inference variables.
LL - fn generic_ref<T>(_: &T) -> Option<()> { | ||
LL + fn generic_ref<T>(_: T) -> Option<()> { | ||
| | ||
help: call `Option::as_deref()` first |
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 now shows up because of the first commit :)
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.
good enough. i wonder if this should be changed to use ObligationCtxt::normalize
but probably does not matter.
@bors r+ rollup |
…iaskrgr Rollup of 6 pull requests Successful merges: - rust-lang#112081 (Avoid ICE on `#![doc(test(...)]` with literal parameter) - rust-lang#112196 (Resolve vars in result from `scrape_region_constraints`) - rust-lang#112303 (Normalize in infcx instead of globally for `Option::as_deref` suggestion) - rust-lang#112316 (Ensure space is inserted after keyword in `unused_delims`) - rust-lang#112318 (Merge method, type and const object safety checks) - rust-lang#112322 (Don't mention `IMPLIED_BOUNDS_ENTAILMENT` if signatures reference error) Failed merges: - rust-lang#112251 (rustdoc: convert `if let Some()` that always matches to variable) r? `@ghost` `@rustbot` modify labels: rollup
fixes #112293
The projection may contain inference variables. These inference variables are local to the local inference context. Using
tcx.normalize_erasing_regions
doesn't work here because this method is global and does not have access to the inference context. It's therefore unable to deal with the inference variables. We normalize in the local inference context instead, which knowns about the inference variables.The test looks a little different than the issue example, I made it more minimal and verified that it still ICEs on nightly.
Also contains a drive-by fix to properly compare the types.
r? @compiler-errors