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

resolve typerelative ctors to adt #113217

Merged

Conversation

ericmarkmartin
Copy link
Contributor

Associated issue: #110508

r? @spastorino

@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 Jun 30, 2023
@compiler-errors
Copy link
Member

This could use a MIR or THIR test (-Zunpretty=thir-tree or --emit-mir)

@ericmarkmartin
Copy link
Contributor Author

ericmarkmartin commented Jul 1, 2023

This could use a MIR or THIR test (-Zunpretty=thir-tree or --emit-mir)

I assume the THIR test should go in tests/ui/thir-print---where should the MIR test go? Also, it seems like printing the THIR creates a lot of output (even if we use thir-flat). Is there something we can do so it's more obvious what the test is trying to show (other than throwing a comment in the rust file)?

EDIT: added a thir-print test but am still wondering about the above

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.

MIR tests go into tests/mir-opt/building, with specific support for dumping MIR.
OTOH, I'm not convinced by the need to test the THIR dump.

@@ -351,19 +351,34 @@ impl<'tcx> Cx<'tcx> {
});
}
}
let adt_data =
if let hir::ExprKind::Path(hir::QPath::Resolved(_, ref path)) = fun.kind {
let adt_data = if let hir::ExprKind::Path(qpath) = fun.kind {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
let adt_data = if let hir::ExprKind::Path(qpath) = fun.kind {
let adt_data = if let hir::ExprKind::Path(qpath) = fun.kind
&& let Some(adt_def) = expr_ty.ty_adt_def()
{

To avoid having to do it in all branches.

@ericmarkmartin
Copy link
Contributor Author

OTOH, I'm not convinced by the need to test the THIR dump.

As per my comment above, I'm a bit sad about the THIR dump verbosity. However, isn't THIR the more logical place to test this, given that the bug was with HIR -> THIR lowering?

@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 3, 2023
@ericmarkmartin
Copy link
Contributor Author

@rustbot ready

I've added both THIR and MIR tests for now: as I noted before I think the THIR test is a little verbose, but I don't think the mir dump test really shows much. When I ran the test again using the stage0 compiler (just as an easy-to-reach pre-my-changes compiler build) the only difference in the MIR dump seemed to be the presence of comments in the BAR2 dump file.

@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 5, 2023
@ericmarkmartin ericmarkmartin marked this pull request as ready for review July 5, 2023 03:54
@cjgillot
Copy link
Contributor

cjgillot commented Jul 8, 2023

@bors r+

@bors
Copy link
Contributor

bors commented Jul 8, 2023

📌 Commit 261c023 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 8, 2023
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Jul 8, 2023
…-ctor-to-adt, r=cjgillot

resolve typerelative ctors to adt

Associated issue: rust-lang#110508

r? `@spastorino`
bors added a commit to rust-lang-ci/rust that referenced this pull request Jul 8, 2023
…iaskrgr

Rollup of 6 pull requests

Successful merges:

 - rust-lang#113005 (Don't call `query_normalize` when reporting similar impls)
 - rust-lang#113064 (std: edit [T]::swap docs)
 - rust-lang#113138 (Add release notes for 1.71.0)
 - rust-lang#113217 (resolve typerelative ctors to adt)
 - rust-lang#113254 (Use consistent formatting in Readme)
 - rust-lang#113482 (Migrate GUI colors test to original CSS color format)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit b637be7 into rust-lang:master Jul 8, 2023
@rustbot rustbot added this to the 1.72.0 milestone Jul 8, 2023
@ericmarkmartin ericmarkmartin deleted the lower-type-relative-ctor-to-adt branch July 11, 2023 04:38
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