-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Suggest borrowing when trying to coerce unsized type into dyn Trait
#95609
Conversation
r? @nagisa (rust-highfive has picked a reviewer for you, use r? to override) |
compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs
Show resolved
Hide resolved
The only possible improvement I can imagine is moving the “since ...” part to an associated
but otherwise it seems good as is. r=me, with or without changes to the messaging. |
@bors r=nagisa couldn't figure out how to get the note to appear below the suggestion, only above it, which is (imo) more confusing than the inline ", because..." |
📌 Commit 7d7715f has been approved by |
@bors rollup |
Rollup of 7 pull requests Successful merges: - rust-lang#92942 (stabilize windows_process_extensions_raw_arg) - rust-lang#94817 (Release notes for 1.60.0) - rust-lang#95343 (Reduce unnecessary escaping in proc_macro::Literal::character/string) - rust-lang#95431 (Stabilize total_cmp) - rust-lang#95438 (Add SyncUnsafeCell.) - rust-lang#95467 (Windows: Synchronize asynchronous pipe reads and writes) - rust-lang#95609 (Suggest borrowing when trying to coerce unsized type into `dyn Trait`) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
…bank Fix trait object reborrow suggestion Fixes rust-lang#93596 Slightly generalizes the logic we use to suggest fix first implemented in rust-lang#95609, specifically when we have a `Sized` obligation that comes from a struct's unsized tail.
…bank Fix trait object reborrow suggestion Fixes rust-lang#93596 Slightly generalizes the logic we use to suggest fix first implemented in rust-lang#95609, specifically when we have a `Sized` obligation that comes from a struct's unsized tail.
…bank Fix trait object reborrow suggestion Fixes rust-lang#93596 Slightly generalizes the logic we use to suggest fix first implemented in rust-lang#95609, specifically when we have a `Sized` obligation that comes from a struct's unsized tail.
…bank Fix trait object reborrow suggestion Fixes rust-lang#93596 Slightly generalizes the logic we use to suggest fix first implemented in rust-lang#95609, specifically when we have a `Sized` obligation that comes from a struct's unsized tail.
…bank Fix trait object reborrow suggestion Fixes rust-lang#93596 Slightly generalizes the logic we use to suggest fix first implemented in rust-lang#95609, specifically when we have a `Sized` obligation that comes from a struct's unsized tail.
…bank Fix trait object reborrow suggestion Fixes rust-lang#93596 Slightly generalizes the logic we use to suggest fix first implemented in rust-lang#95609, specifically when we have a `Sized` obligation that comes from a struct's unsized tail.
A helpful error in response to #95598, since we can't coerce e.g.
&str
into&dyn Display
, but we can coerce&&str
into&dyn Display
:)Not sure if the suggestion message needs some help. Let me know, and I can refine this PR.