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

Remove some usages of guess_head_span #98869

Merged
merged 7 commits into from
Jul 15, 2022

Conversation

compiler-errors
Copy link
Member

@compiler-errors compiler-errors commented Jul 3, 2022

No need to pass things through guess_head_span if they already point to the head span.

Only major change is that we point to the head span of enums on some errors now, which I prefer.

r? @cjgillot

@rustbot rustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Jul 3, 2022
@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jul 3, 2022
@@ -31,8 +31,12 @@ LL | trait Trait: Sized {}
error[E0038]: the trait `Trait` cannot be made into an object
--> $DIR/wf-unsafe-trait-obj-match.rs:25:25
|
LL | let t: &dyn Trait = match opt() {
| ^^^^^^^^^^^ `Trait` cannot be made into an object
LL | let t: &dyn Trait = match opt() {
Copy link
Member Author

Choose a reason for hiding this comment

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

I actually think that this is more accurate than what we were doing before... I could potentially revert this one.

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree this is more accurate. Why do you want to revert it?

@TaKO8Ki
Copy link
Member

TaKO8Ki commented Jul 4, 2022

This is related to my PR #98519.

@compiler-errors
Copy link
Member Author

Oh, sorry @TaKO8Ki, I didn't know you were working on this. I just saw this comment and wanted to remove more usages (mostly from typeck and trait selection).

Copy link
Contributor

@cjgillot cjgillot left a comment

Choose a reason for hiding this comment

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

Thanks @compiler-errors.
Do you mind if we wait for #98519 to land?

compiler/rustc_typeck/src/check/check.rs Outdated Show resolved Hide resolved
@@ -31,8 +31,12 @@ LL | trait Trait: Sized {}
error[E0038]: the trait `Trait` cannot be made into an object
--> $DIR/wf-unsafe-trait-obj-match.rs:25:25
|
LL | let t: &dyn Trait = match opt() {
| ^^^^^^^^^^^ `Trait` cannot be made into an object
LL | let t: &dyn Trait = match opt() {
Copy link
Contributor

Choose a reason for hiding this comment

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

I agree this is more accurate. Why do you want to revert it?

@compiler-errors
Copy link
Member Author

Yeah, I'll wait on that one. My bad for not checking if another guess_head_span-related PR was in flight.

@rustbot author

@rustbot rustbot 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-review Status: Awaiting review from the assignee but also interested parties. labels Jul 4, 2022
@bors
Copy link
Contributor

bors commented Jul 6, 2022

☔ The latest upstream changes (presumably #98987) made this pull request unmergeable. Please resolve the merge conflicts.

@rustbot
Copy link
Collaborator

rustbot commented Jul 8, 2022

Some changes occurred in src/tools/cargo

cc @ehuss

@compiler-errors
Copy link
Member Author

I think this is ready.

@rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jul 8, 2022
compiler/rustc_typeck/src/check/compare_method.rs Outdated Show resolved Hide resolved
db.span_help(
span.shrink_to_lo().to(def_span),
self.sess().source_map().guess_head_span(span),
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we still need this one?

Copy link
Member Author

Choose a reason for hiding this comment

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

Otherwise we'll point to a whole mod .. {} block span, e.g. in the src/test/ui/imports/unused-imports-in-test-module.stderr UI test.

@cjgillot cjgillot 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-review Status: Awaiting review from the assignee but also interested parties. labels Jul 11, 2022
@compiler-errors
Copy link
Member Author

@rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jul 15, 2022
@cjgillot
Copy link
Contributor

@bors r+

@bors
Copy link
Contributor

bors commented Jul 15, 2022

📌 Commit fcfb3e9 has been approved by cjgillot

It is now in the queue for this repository.

@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 Jul 15, 2022
bors added a commit to rust-lang-ci/rust that referenced this pull request Jul 15, 2022
Rollup of 5 pull requests

Successful merges:

 - rust-lang#88991 (Add Nintendo Switch as tier 3 target)
 - rust-lang#98869 (Remove some usages of `guess_head_span`)
 - rust-lang#99119 (Refactor: remove a string matching about methods)
 - rust-lang#99209 (Correctly handle crate level page on docs.rs as well)
 - rust-lang#99246 (Update RLS)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit e0e6f1d into rust-lang:master Jul 15, 2022
@rustbot rustbot added this to the 1.64.0 milestone Jul 15, 2022
@compiler-errors compiler-errors deleted the stop_guessing_head_span branch August 11, 2023 20:19
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. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants