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

Give return-position impl traits in trait a (synthetic) name to avoid name collisions with new lowering strategy #109499

Merged
merged 3 commits into from
Mar 30, 2023

Conversation

spastorino
Copy link
Member

@spastorino spastorino commented Mar 22, 2023

The only needed commit from this PR is the last one.

r? @compiler-errors

Needs #109455.

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Mar 22, 2023
@bors

This comment was marked as resolved.

@compiler-errors
Copy link
Member

Since this is waiting on that other PR, gonna mark it as waiting on author

@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 Mar 24, 2023
@spastorino spastorino changed the title Bless some extra working tests under -Zlower-impl-trait-in-trait-to-assoc-ty Give return-position impl traits in trait a (synthetic) name to avoid name collisions with new lowering strategy Mar 28, 2023
@spastorino
Copy link
Member Author

@rustbot ready

I took over @compiler-errors' #109455 and changed the last commit according to @petrochenkov's review.

Opened it for discussions but still have 2 problems to address.

  1. We need to give ty::AssocItem a proper name here https://github.com/rust-lang/rust/pull/109499/files#diff-03c3ed2f6e27e58df63382e00323eea6fd1ce3a4f9546941b2b717fead25e520R1076, unsure what to do there.
  2. We need to generate associated item names like Foo::bar::{opaque#0} and we are giving Foo::{opaque#0} to match diagnostics here https://github.com/rust-lang/rust/pull/109499/files#diff-2245ba262b8ba2866c27f1ac3f76db96146870beb91a6ac7ce621ca2cbb7c501R9. I'm not sure why https://github.com/rust-lang/rust/pull/109499/files#diff-f7bb866d465985edefe49cace054fae026f7ca4321a0db60294f1cbdac847ef7R356 that starts from opaque_ty_def_id is not grabbing correctly the fn name. Need to debug.

@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 Mar 28, 2023
@petrochenkov petrochenkov self-assigned this Mar 28, 2023
@spastorino
Copy link
Member Author

spastorino commented Mar 28, 2023

I see now what happens in problem 2, the name is set correctly on AssocItem but that's not what's used on diagnostics. What we use is https://github.com/spastorino/rust/blob/034aae297dadc7b3884f711c6c7d5c7071b34675/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs#L2805.
I guess we may need to change https://github.com/spastorino/rust/blob/034aae297dadc7b3884f711c6c7d5c7071b34675/compiler/rustc_middle/src/ty/print/mod.rs#L102 or we can also just leave it as Foo::{opaque#0}?

@rust-log-analyzer

This comment has been minimized.

@spastorino
Copy link
Member Author

Problem 2 fixed by making default_print_def_path account for RPITITs.

@spastorino
Copy link
Member Author

Ok, I've tidy up everything and left only the solution that makes error reports do Trait::{opaque#}.

Given that @petrochenkov removed their assignment I guess you're happy now with the changes, correct?. If so, this is now up to @compiler-errors.

@compiler-errors
Copy link
Member

I'm happy with this for now.

@bors r+

@bors
Copy link
Contributor

bors commented Mar 29, 2023

📌 Commit 2ca350c has been approved by compiler-errors

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 Mar 29, 2023
@bors
Copy link
Contributor

bors commented Mar 30, 2023

⌛ Testing commit 2ca350c with merge f2d9a3d...

@bors
Copy link
Contributor

bors commented Mar 30, 2023

☀️ Test successful - checks-actions
Approved by: compiler-errors
Pushing f2d9a3d to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Mar 30, 2023
@bors bors merged commit f2d9a3d into rust-lang:master Mar 30, 2023
@rustbot rustbot added this to the 1.70.0 milestone Mar 30, 2023
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (f2d9a3d): comparison URL.

Overall result: no relevant changes - no action needed

@rustbot label: -perf-regression

Instruction count

This benchmark run did not return any relevant results for this metric.

Max RSS (memory usage)

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
2.2% [1.0%, 3.4%] 2
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-2.6% [-2.6%, -2.6%] 1
Improvements ✅
(secondary)
-2.4% [-3.0%, -1.8%] 2
All ❌✅ (primary) 0.6% [-2.6%, 3.4%] 3

Cycles

This benchmark run did not return any relevant results for this metric.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. 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.

7 participants