Skip to content
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

More precise spans for HIR paths #83092

Merged
merged 2 commits into from
Mar 17, 2021
Merged

More precise spans for HIR paths #83092

merged 2 commits into from
Mar 17, 2021

Conversation

petrochenkov
Copy link
Contributor

Ty::assoc_item is lowered to <Ty>::assoc_item in HIR, but Ty got span from the whole path.
This PR fixes that, and adjusts some diagnostic code that relied on Ty having the whole path span.

This is a pre-requisite for #82868 (we cannot report suggestions like Tr::assoc -> <dyn Tr>::assoc with the current imprecise spans).
r? @estebank

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Mar 13, 2021
@@ -31,7 +31,20 @@ LL | let x: Vec<dyn Trait + Sized> = Vec::new();
= help: the trait `Sized` is not implemented for `dyn Trait`
= note: required by `Vec::<T>::new`

error: aborting due to 3 previous errors
error[E0277]: the size for values of type `dyn Trait` cannot be known at compilation time
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I couldn't find the relevant span-based error filtering logic for this case.

@estebank
Copy link
Contributor

@bors r+

@bors
Copy link
Contributor

bors commented Mar 14, 2021

📌 Commit c74fdf0 has been approved by estebank

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 14, 2021
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request Mar 14, 2021
More precise spans for HIR paths

`Ty::assoc_item` is lowered to `<Ty>::assoc_item` in HIR, but `Ty` got span from the whole path.
This PR fixes that, and adjusts some diagnostic code that relied on `Ty` having the whole path span.

This is a pre-requisite for rust-lang#82868 (we cannot report suggestions like `Tr::assoc` -> `<dyn Tr>::assoc` with the current imprecise spans).
r? `@estebank`
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request Mar 15, 2021
More precise spans for HIR paths

`Ty::assoc_item` is lowered to `<Ty>::assoc_item` in HIR, but `Ty` got span from the whole path.
This PR fixes that, and adjusts some diagnostic code that relied on `Ty` having the whole path span.

This is a pre-requisite for rust-lang#82868 (we cannot report suggestions like `Tr::assoc` -> `<dyn Tr>::assoc` with the current imprecise spans).
r? ``@estebank``
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request Mar 15, 2021
More precise spans for HIR paths

`Ty::assoc_item` is lowered to `<Ty>::assoc_item` in HIR, but `Ty` got span from the whole path.
This PR fixes that, and adjusts some diagnostic code that relied on `Ty` having the whole path span.

This is a pre-requisite for rust-lang#82868 (we cannot report suggestions like `Tr::assoc` -> `<dyn Tr>::assoc` with the current imprecise spans).
r? ```@estebank```
@Dylan-DPC-zz
Copy link

@bors r-
failed in rollup

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Mar 15, 2021
@petrochenkov
Copy link
Contributor Author

Updated clippy tests.
@bors r=estebank

@bors
Copy link
Contributor

bors commented Mar 15, 2021

📌 Commit e98b7d1 has been approved by estebank

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Mar 15, 2021
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request Mar 16, 2021
More precise spans for HIR paths

`Ty::assoc_item` is lowered to `<Ty>::assoc_item` in HIR, but `Ty` got span from the whole path.
This PR fixes that, and adjusts some diagnostic code that relied on `Ty` having the whole path span.

This is a pre-requisite for rust-lang#82868 (we cannot report suggestions like `Tr::assoc` -> `<dyn Tr>::assoc` with the current imprecise spans).
r? ``@estebank``
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request Mar 17, 2021
More precise spans for HIR paths

`Ty::assoc_item` is lowered to `<Ty>::assoc_item` in HIR, but `Ty` got span from the whole path.
This PR fixes that, and adjusts some diagnostic code that relied on `Ty` having the whole path span.

This is a pre-requisite for rust-lang#82868 (we cannot report suggestions like `Tr::assoc` -> `<dyn Tr>::assoc` with the current imprecise spans).
r? ```@estebank```
bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 17, 2021
Rollup of 8 pull requests

Successful merges:

 - rust-lang#82774 (Fix bad diagnostics for anon params with ref and/or qualified paths)
 - rust-lang#82826 ((std::net::parser): Fix capitalization of IP version names)
 - rust-lang#83092 (More precise spans for HIR paths)
 - rust-lang#83124 (Do not insert impl_trait_in_bindings opaque definitions twice.)
 - rust-lang#83202 (Show details in cfg version unstable book)
 - rust-lang#83203 (Don't warn about old rustdoc lint names (temporarily))
 - rust-lang#83206 (Update books)
 - rust-lang#83219 (Update cargo)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 70edab8 into rust-lang:master Mar 17, 2021
@rustbot rustbot added this to the 1.52.0 milestone Mar 17, 2021
flip1995 pushed a commit to flip1995/rust that referenced this pull request Mar 25, 2021
More precise spans for HIR paths

`Ty::assoc_item` is lowered to `<Ty>::assoc_item` in HIR, but `Ty` got span from the whole path.
This PR fixes that, and adjusts some diagnostic code that relied on `Ty` having the whole path span.

This is a pre-requisite for rust-lang#82868 (we cannot report suggestions like `Tr::assoc` -> `<dyn Tr>::assoc` with the current imprecise spans).
r? ````@estebank````
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants