-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Remove blanket silencing of "type annotation needed" errors #64746
Remove blanket silencing of "type annotation needed" errors #64746
Conversation
Remove blanket check for existence of other errors before emitting "type annotation needed" errors, and add some eager checks to avoid adding obligations when they refer to types that reference `[type error]` in order to reduce unneded errors.
r? @cramertj (rust_highfive has picked a reviewer for you, use r? to override) |
@@ -1155,6 +1157,15 @@ impl<'a, 'tcx> Instantiator<'a, 'tcx> { | |||
); | |||
debug!("instantiate_opaque_types: ty_var={:?}", ty_var); | |||
|
|||
for predicate in &bounds.predicates { |
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.
We could make a method returning -> bool
here and use if stuff.obligation_references_error() { return ty_var; }
here.
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 didn't want to hide the O(n)
behavior of the added code so that I could maybe nerd-snipe someone to point me a place where we could do the same with no added time ^_^
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.
Can't you just leave a doc comment about the O(n)
complexity? This is in diagnostics code anyways so what does O(n)
matter?
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.
Because it it needs to go over the predicates vec twice instead of once for every case. This is to add the obligations, which may or may not be met.
@bors r+ |
📌 Commit b7ca1c5 has been approved by |
…ns-on-err, r=cramertj Remove blanket silencing of "type annotation needed" errors Remove blanket check for existence of other errors before emitting "type annotation needed" errors, and add some eager checks to avoid adding obligations when they refer to types that reference `[type error]` in order to reduce unneeded errors. Fix rust-lang#64084.
Rollup of 7 pull requests Successful merges: - #64324 (rustc: Fix mixing crates with different `share_generics`) - #64428 (Error explanation e0524) - #64481 (A more explanatory thread local storage panic message) - #64599 (Rustdoc render async function re-export) - #64743 (Update cargo) - #64746 (Remove blanket silencing of "type annotation needed" errors) - #64753 (Don't emit explain with json short messages.) Failed merges: r? @ghost
Rustup to rust-lang/rust#64746 changelog: none
Remove blanket check for existence of other errors before emitting "type annotation needed" errors, and add some eager checks to avoid adding obligations when they refer to types that reference
[type error]
in order to reduce unneeded errors.Fix #64084.