-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
When cast needs a dereference point at full cast #38245
Conversation
(rust_highfive has picked a reviewer for you, use r? to override) |
af9ceb6
to
cb3ec68
Compare
Hmm I'm not sure I see this as an improvement...I think I prefer the new span, but I'd prefer the "did you mean |
81bd4cb
to
096205b
Compare
After the fix of rust-lang#37453 in PR rust-lang#37369, instead of pointing at only the cast type, point at the full cast span when a cast needs a dereference: ``` error: casting `&{float}` as `f32` is invalid --> ../../../src/test/ui/mismatched_types/cast-rfc0401.rs:81:30 | 81 | vec![0.0].iter().map(|s| s as f32).collect::<Vec<f32>>(); | ^^^^^^^^ cannot cast `&{float}` as `f32` | help: did you mean `*s`? --> ../../../src/test/ui/mismatched_types/cast-rfc0401.rs:81:30 | 81 | vec![0.0].iter().map(|s| s as f32).collect::<Vec<f32>>(); | ^ ``` instead of ``` error: casting `&{float}` as `f32` is invalid --> ../../../src/test/ui/mismatched_types/cast-rfc0401.rs:81:35 | 81 | vec![0.0].iter().map(|s| s as f32).collect::<Vec<f32>>(); | - ^^^ | | | | | did you mean `*s`? | cannot cast `&{float}` as `f32` ```
096205b
to
868fb03
Compare
@nikomatsakis I have separated the suggestion to a help as requested:
|
@estebank looks good! |
@bors r+ |
📌 Commit 868fb03 has been approved by |
When cast needs a dereference point at full cast After the fix of #37453 in PR #37369, instead of pointing at only the cast type, point at the full cast span when a cast needs a dereference, as well as assign the error label to the correct span for proper coloring: <img width="471" alt="error span pointing at the entire cast" src="https://cloud.githubusercontent.com/assets/1606434/21024245/8797fc2e-bd38-11e6-82c1-66c281c656c1.png"> instead of <img width="471" alt="error span pointing at the type of the cast" src="https://cloud.githubusercontent.com/assets/1606434/21023777/d4814aa6-bd36-11e6-9fc3-b2a0ea5ee15d.png"> Move `compile-fail` test to `ui` test.
@rust-lang/tools tests failed but homu didn't pick it up. @bors r- force |
Hmmmmmm let's try this instead (sorry, @estebank, trying to get the bot unstuck). |
Well that didn't help anything 😞. |
@bors retry |
@bors: r=nikomatsakis |
📌 Commit 868fb03 has been approved by |
…atsakis When cast needs a dereference point at full cast After the fix of rust-lang#37453 in PR rust-lang#37369, instead of pointing at only the cast type, point at the full cast span when a cast needs a dereference, as well as assign the error label to the correct span for proper coloring: <img width="471" alt="error span pointing at the entire cast" src="https://cloud.githubusercontent.com/assets/1606434/21024245/8797fc2e-bd38-11e6-82c1-66c281c656c1.png"> instead of <img width="471" alt="error span pointing at the type of the cast" src="https://cloud.githubusercontent.com/assets/1606434/21023777/d4814aa6-bd36-11e6-9fc3-b2a0ea5ee15d.png"> Move `compile-fail` test to `ui` test.
Rollup of 29 pull requests - Successful merges: #37761, #38006, #38131, #38150, #38158, #38171, #38208, #38215, #38236, #38245, #38289, #38302, #38315, #38346, #38388, #38395, #38398, #38418, #38432, #38451, #38463, #38468, #38470, #38471, #38472, #38478, #38486, #38493, #38498 - Failed merges: #38271, #38483
After the fix of #37453 in PR #37369, instead of pointing at only the cast type, point at the full cast span when a cast needs a dereference, as well as assign the error label to the correct span for proper coloring:
instead of
Move
compile-fail
test toui
test.