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

only return used dependencies in crate_dependencies_in_postorder #125493

Closed
wants to merge 3 commits into from

Conversation

lqd
Copy link
Member

@lqd lqd commented May 24, 2024

PR #124976 made use of used_crates and not all crates including speculatively loaded. This apparently broke some cases of trying to link (e.g. with upstream rust crates) which seems to expect all crates instead by doing index-based accesses in now-different arrays, and caused ICEs #125474 and #125484.

We have 3 repros:

These ICEs are fixed by this PR BUT I can't get compiletest to emit the command line I'm seeing in the repros, with neither of the 2 MCVEs. Naively using aux-builds and so on doesn't reproduce the ICE. (It's also incredibly hard to make it show the command used to build the aux-build files). So I had to use a run-make test instead, in order to have at least one test in this PR.

r? @oli-obk as #124976's reviewer or @petrochenkov as #124976's author

fixes #125474
fixes #125484
fixes #125646
fixes #125707

@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 May 24, 2024
@petrochenkov
Copy link
Contributor

I think the postorder_cnums query is to blame here.
It should work as postorder_cnums_used in this context, but it actually works as postorder_cnums_including_speculative.

@lqd
Copy link
Member Author

lqd commented May 24, 2024

ok I'll look into that

@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 May 24, 2024
@lqd
Copy link
Member Author

lqd commented May 24, 2024

@petrochenkov Right, good spot.

These queries and code could use some comments and renames to clarify these behaviors.

@rustbot ready

Still would like to have tests :/

@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 May 24, 2024
@petrochenkov
Copy link
Contributor

All direct and indirect users of crate_dependencies_in_postorder do happen to need the "used" semantics, but that's certainly not clear from the naming.

@lqd lqd changed the title linking can need speculative crates only return used dependencies crate_dependencies_in_postorder May 24, 2024
@lqd lqd changed the title only return used dependencies crate_dependencies_in_postorder only return used dependencies in crate_dependencies_in_postorder May 24, 2024
@rustbot
Copy link
Collaborator

rustbot commented May 29, 2024

Some changes occurred in run-make tests.

cc @jieyouxu

@lqd
Copy link
Member Author

lqd commented May 29, 2024

For the life of me I can't wrestle compiletest annotations to make a test and may be missing something obvious that oli/vadim would see. Plan B: I pushed a run-make test to actually reproduce the ICE.

@jieyouxu
Copy link
Member

jieyouxu commented May 29, 2024

I couldn't get a UI test to work either so I think a run-make test is fine :3 Might be related to -L flags, but I didn't dig very deep.

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request May 29, 2024
remove unneeded extern crate in rmake test

Cleanup requested in rust-lang#125493 (comment)

r? jieyouxu
`@bors` rollup=always
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request May 29, 2024
remove unneeded extern crate in rmake test

Cleanup requested in rust-lang#125493 (comment)

r? jieyouxu
``@bors`` rollup=always
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request May 29, 2024
Rollup merge of rust-lang#125715 - lqd:rmake-cleanup, r=jieyouxu

remove unneeded extern crate in rmake test

Cleanup requested in rust-lang#125493 (comment)

r? jieyouxu
``@bors`` rollup=always
@lqd lqd mentioned this pull request Jun 3, 2024
bjorn3 added a commit to rust-lang/rustc_codegen_cranelift that referenced this pull request Jun 4, 2024
@bjorn3
Copy link
Member

bjorn3 commented Jun 4, 2024

The simple-raytracer benchmark of cg_clif is another reproducer for this.

@petrochenkov
Copy link
Contributor

r? @petrochenkov
@bors r+

Instead of reverting #124976 (#124976 (comment)).

@bors
Copy link
Contributor

bors commented Jun 5, 2024

📌 Commit f225db1 has been approved by petrochenkov

It is now in the queue for this repository.

@rustbot rustbot assigned petrochenkov and unassigned oli-obk Jun 5, 2024
@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 Jun 5, 2024
@lqd
Copy link
Member Author

lqd commented Jun 5, 2024

@petrochenkov I don't think this PR fixes all open issues

@petrochenkov
Copy link
Contributor

Ah, okay, then let's revert #124976 too (at least for beta).

@lqd
Copy link
Member Author

lqd commented Jun 5, 2024

@petrochenkov I won't have a lot of time to analyze and fix the other issues in the next few days.

So I feel it'd be safer to:

  • do the revert now, on nightly before the beta cut, rather than land this PR
  • add some assertions that the different arrays have the same lengths, analyze and fix the couple different issues (but 6-7 including duplicates overall)
  • reland 124976 (maybe w/ a crater run)

what do you think?

(but I can tell you that reverting the same commits as I did in ad545ac makes the ICEs from #126021 disappear. I can't reproduce the exact same context, and am not sure about correctness here, e.g. it seems likely the indices could still be in-bounds but wrong)

@lqd
Copy link
Member Author

lqd commented Jun 5, 2024

Until I hear back from vadim:

@bors r-

@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 Jun 5, 2024
fmease added a commit to fmease/rust that referenced this pull request Jun 6, 2024
Revert "use `tcx.used_crates(())` more" before it reaches beta

There are more open issues caused by rust-lang#124976 than will be fixed by rust-lang#125493 alone. The beta cut is soon, so let's revert it and buy some time to analyze and fix these issues in our own time.

fixes rust-lang#125474
fixes rust-lang#125484
fixes rust-lang#125646
fixes rust-lang#125707
fixes rust-lang#126066
fixes rust-lang#125934
fixes rust-lang#126021

r? `@petrochenkov`
`@bors` p=1
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request Jun 6, 2024
Revert "use `tcx.used_crates(())` more" before it reaches beta

There are more open issues caused by rust-lang#124976 than will be fixed by rust-lang#125493 alone. The beta cut is soon, so let's revert it and buy some time to analyze and fix these issues in our own time.

fixes rust-lang#125474
fixes rust-lang#125484
fixes rust-lang#125646
fixes rust-lang#125707
fixes rust-lang#126066
fixes rust-lang#125934
fixes rust-lang#126021

r? ``@petrochenkov``
``@bors`` p=1
bors added a commit to rust-lang-ci/rust that referenced this pull request Jun 6, 2024
Revert "use `tcx.used_crates(())` more" before it reaches beta

There are more open issues caused by rust-lang#124976 than will be fixed by rust-lang#125493 alone. The beta cut is soon, so let's revert it and buy some time to analyze and fix these issues in our own time.

fixes rust-lang#125474
fixes rust-lang#125484
fixes rust-lang#125646
fixes rust-lang#125707
fixes rust-lang#126066
fixes rust-lang#125934
fixes rust-lang#126021

r? `@petrochenkov`
`@bors` p=1
@bors
Copy link
Contributor

bors commented Jun 8, 2024

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

flip1995 pushed a commit to flip1995/rust that referenced this pull request Jun 13, 2024
Revert "use `tcx.used_crates(())` more" before it reaches beta

There are more open issues caused by rust-lang#124976 than will be fixed by rust-lang#125493 alone. The beta cut is soon, so let's revert it and buy some time to analyze and fix these issues in our own time.

fixes rust-lang#125474
fixes rust-lang#125484
fixes rust-lang#125646
fixes rust-lang#125707
fixes rust-lang#126066
fixes rust-lang#125934
fixes rust-lang#126021

r? `@petrochenkov`
`@bors` p=1
@Dylan-DPC
Copy link
Member

Dylan-DPC commented Aug 17, 2024

@lqd any updates on replying to #125493 (comment) ? thanks

@Dylan-DPC
Copy link
Member

oops wrong ping, meant to ping @petrochenkov :D

@lqd
Copy link
Member Author

lqd commented Aug 17, 2024

We did the revert, and we’ll need part of this PR when we want to reland the original changes

@lqd lqd closed this Aug 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
8 participants