-
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 reborrowing unsized value when borrowed trait object wanted #93596
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
A-suggestion-diagnostics
Area: Suggestions generated by the compiler applied by `cargo fix`
A-traits
Area: Trait system
C-enhancement
Category: An issue proposing an enhancement or a PR with one.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Comments
ijackson
added
A-diagnostics
Area: Messages for errors, warnings, and lints
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
labels
Feb 2, 2022
@rustbot modify labels +A-suggestion-diagnostics +A-traits |
rustbot
added
A-suggestion-diagnostics
Area: Suggestions generated by the compiler applied by `cargo fix`
A-traits
Area: Trait system
labels
Feb 2, 2022
@rustbot modify labels +C-enhancement |
rustbot
added
the
C-enhancement
Category: An issue proposing an enhancement or a PR with one.
label
Feb 2, 2022
Dylan-DPC
added a commit
to Dylan-DPC/rust
that referenced
this issue
Jun 22, 2022
…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.
compiler-errors
added a commit
to compiler-errors/rust
that referenced
this issue
Jun 23, 2022
…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.
compiler-errors
added a commit
to compiler-errors/rust
that referenced
this issue
Jun 25, 2022
…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.
Dylan-DPC
added a commit
to Dylan-DPC/rust
that referenced
this issue
Jun 25, 2022
…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.
JohnTitor
added a commit
to JohnTitor/rust
that referenced
this issue
Jun 25, 2022
…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.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
A-suggestion-diagnostics
Area: Suggestions generated by the compiler applied by `cargo fix`
A-traits
Area: Trait system
C-enhancement
Category: An issue proposing an enhancement or a PR with one.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Given the following code:
The current output is:
Ideally the output would suggest borrowing, since this:
compiles and works just fine.
The problem is that you can't make an object which is a wide pointer directly into a trait object refernce, because it would have to be a triple-sized pointer. But often, you can just reborrow instead.
The text was updated successfully, but these errors were encountered: