Fix suggestion for mutability mismatch between trait def and trait impl - #161827
Fix suggestion for mutability mismatch between trait def and trait impl#161827GuillaumeGomez wants to merge 1 commit into
Conversation
b9e27f2 to
2f32fc5
Compare
There was a problem hiding this comment.
(for context: #t-compiler/help > Wrong Ty "scope"(?) in suggestion @ 💬)
It looks like the real problem here is there's no functionality (or we're unaware of it) for "what is the proper path to item X to use it in scope Y". Can you find or create something like that rather than have all of this just to support one case of a type error?
| pub use crate::ty::diagnostics::*; | ||
| use crate::ty::fast_reject::SimplifiedType; | ||
| use crate::ty::layout::{FnAbiError, LayoutError}; | ||
| pub use crate::ty::print::guess_def_namespace; |
There was a problem hiding this comment.
this (and the function being made pub) looks vestigial
There was a problem hiding this comment.
Removed (so I can have a "clean" state for the next step).
2f32fc5 to
ac9bfb0
Compare
Agreed, the solution I came up with is not satisfying. So I'd love to create this new API, but I will likely need some help. |
This code:
emits:
Which is wrong. This PR fixes it. However the
Tydoesn't hold a context (or at least not a correct one) allowing to have a correct path to theXtype. So instead, in case of a mutability mismatch, we (try to) retrieve the code snippet, and remove/add themutkeyword. If we fail to, we revert to the current behaviour.r? @mejrs