Note when a a move/borrow error is caused by a deref coercion#75304
Note when a a move/borrow error is caused by a deref coercion#75304bors merged 1 commit intorust-lang:masterfrom
Conversation
|
r? @lcnr (rust_highfive has picked a reviewer for you, use r? to override) |
|
hmm, I don't see any obvious problems here, but am not really familiar enough with what's touched here, maybe r? @estebank |
There was a problem hiding this comment.
This note seems like it could go as the label of the main span in the previous note.
There's something missing in the new output, but I can't quite put my finger on it. Having said that, we can land this PR and improve it later.
There was a problem hiding this comment.
I don't think we should attach it to the span of val.inner;, since that's referring to the borrow. However, I think it would make sense to reorder it to go before the 'deref defined here' note.
0c52521 to
3cf4bbc
Compare
|
@estebank I've addressed your comments |
|
@estebank Are there any changes that you'd like me to make? |
This comment has been minimized.
This comment has been minimized.
6c1030e to
6893db8
Compare
|
@estebank: I've resolved the merge conflicts. |
This comment has been minimized.
This comment has been minimized.
57f8be6 to
67d9ee6
Compare
This comment has been minimized.
This comment has been minimized.
Fixes rust-lang#73268 When a deref coercion occurs, we may end up with a move error if the base value has been partially moved out of. However, we do not indicate anywhere that a deref coercion is occuring, resulting in an error message with a confusing span. This PR adds an explicit note to move errors when a deref coercion is involved. We mention the name of the type that the deref-coercion resolved to, as well as the `Deref::Target` associated type being used.
67d9ee6 to
d18b4bb
Compare
|
@estebank: This is now ready for review |
|
@bors r+ |
|
📌 Commit d18b4bb has been approved by |
Rollup of 10 pull requests Successful merges: - rust-lang#73955 (deny(unsafe_op_in_unsafe_fn) in libstd/process.rs) - rust-lang#75146 (Detect overflow in proc_macro_server subspan) - rust-lang#75304 (Note when a a move/borrow error is caused by a deref coercion) - rust-lang#75749 (Consolidate some duplicate code in the sys modules.) - rust-lang#75882 (Use translated variable for test string) - rust-lang#75886 (Test that bounds checks are elided for [..index] after .position()) - rust-lang#76048 (Initial support for riscv32gc_unknown_linux_gnu) - rust-lang#76198 (Make some Ordering methods const) - rust-lang#76689 (Upgrade to pulldown-cmark 0.8.0) - rust-lang#76763 (Update cargo) Failed merges: r? `@ghost`
Fixes #73268
When a deref coercion occurs, we may end up with a move error if the
base value has been partially moved out of. However, we do not indicate
anywhere that a deref coercion is occuring, resulting in an error
message with a confusing span.
This PR adds an explicit note to move errors when a deref coercion is
involved. We mention the name of the type that the deref-coercion
resolved to, as well as the
Deref::Targetassociated type being used.