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

Set struct/union/enum fields/variants as reachable when item is #92781

Merged
merged 1 commit into from
Jan 14, 2022

Conversation

lambinoo
Copy link
Contributor

@lambinoo lambinoo commented Jan 11, 2022

Fixes #92755

@rustbot rustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Jan 11, 2022
@rust-highfive
Copy link
Collaborator

r? @wesleywiser

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jan 11, 2022
@lambinoo
Copy link
Contributor Author

This fixes the issue, but I'd like to add a test for this before hand, but I still have to pinpoint the "minimal code" that triggers this.
If it's urgent (as it seems to be the last item in the 1.60 milestone), I can the require tests in a different PR.

@camelid
Copy link
Member

camelid commented Jan 11, 2022

If it's urgent (as it seems to be the last item in the 1.60 milestone)

It is somewhat urgent since it broke real-world code (though people can stay on older nightlies for now), but it being the only item in the milestone has nothing to do with it. The milestone is just used to track regressions in that version. Development of 1.60 started just days ago, so there's not much there.

If you end up adding a test in a later PR instead, make sure to remove the "Fixes" wording from the PR description—we leave issues open and add the E-needs-test label when they are fixed but need a test.

@tmiasko
Copy link
Contributor

tmiasko commented Jan 11, 2022

A reproducer you can turn into a test case.
$ cat a.rs 
mod machine {
        pub struct A {
            pub b: B,
        }
        pub struct B {}
        impl B {
            pub fn f(&self) {}
        }
}

pub struct Context {
    pub a: machine::A,
}

pub fn ctx() -> Context {
    todo!();
}
$ cat b.rs 
fn main() {
    a::ctx().a.b.f();
}
$ rustc +stage1 --edition=2018 --crate-type=lib -O a.rs
warning: associated function is never used: `f`
 --> a.rs:7:20
  |
7 |             pub fn f(&self) {}
  |                    ^
  |
  = note: `#[warn(dead_code)]` on by default

warning: 1 warning emitted

$ rustc +stage1 --edition=2018 --crate-type=bin -O b.rs --extern a -L.
error: internal compiler error: compiler/rustc_monomorphize/src/collector.rs:966:9: no MIR available for DefId(20:8 ~ a[c3e7]::machine::{impl#0}::f)

@camelid
Copy link
Member

camelid commented Jan 11, 2022

Perhaps worth adding the test now then?

@petrochenkov petrochenkov self-assigned this Jan 12, 2022
@petrochenkov
Copy link
Contributor

@lambinoo
It was probably a mistake to merge code from "// Update levels of nested things." to "// Mark all items in interfaces of reachable items as reachable." in https://github.com/rust-lang/rust/pull/87487/files#diff-9a9bf53a67d6c204294aa9ab4ec8fd1265306998e0eefc593f004e053513b823.

Could you move it back and make sure it's all preserved compared to the state before #87487?
All the "// Update levels of nested things." logic is still relevant, it just can mark nodes as Reachable now instead of Public/Exported.

@petrochenkov petrochenkov 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 Jan 12, 2022
@lambinoo
Copy link
Contributor Author

@camelid @petrochenkov Will do in a few hours, right after work!

@inquisitivecrystal
Copy link
Contributor

inquisitivecrystal commented Jan 12, 2022

When this is merged, it might be worth giving it increased bors priority. The linked issue is P-critical, in part because there are a lot of reports coming in with no real workaround.

@lambinoo
Copy link
Contributor Author

@rustbot label -S-waiting-on-author +S-waiting-on-review

@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 Jan 12, 2022
@lambinoo lambinoo force-pushed the I-92755-no-mir-missing-reachable branch from 839a59d to 257377d Compare January 12, 2022 17:02
@lambinoo
Copy link
Contributor Author

I tested the test with the current master and it does fail properly so all good on this front!

@petrochenkov
Copy link
Contributor

r? @petrochenkov @bors p=1
r=me after addressing #92781 (comment)

@petrochenkov petrochenkov 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 Jan 13, 2022
@lambinoo lambinoo force-pushed the I-92755-no-mir-missing-reachable branch from 257377d to 11532a3 Compare January 13, 2022 20:15
@lambinoo
Copy link
Contributor Author

@rustbot label -S-waiting-on-author +S-waiting-on-review

@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 Jan 13, 2022
@petrochenkov
Copy link
Contributor

@bors r+ just to land this sooner and fix the regression.

@bors
Copy link
Contributor

bors commented Jan 14, 2022

📌 Commit 11532a362b9fdf139ea24bcc6e1cba695aa996fe has been approved by petrochenkov

@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 Jan 14, 2022
@lambinoo lambinoo force-pushed the I-92755-no-mir-missing-reachable branch from 11532a3 to 1b2c64d Compare January 14, 2022 02:59
@petrochenkov
Copy link
Contributor

@bors r+

@bors
Copy link
Contributor

bors commented Jan 14, 2022

📌 Commit 1b2c64d has been approved by petrochenkov

@bors
Copy link
Contributor

bors commented Jan 14, 2022

⌛ Testing commit 1b2c64d with merge 86f7f78...

@bors
Copy link
Contributor

bors commented Jan 14, 2022

☀️ Test successful - checks-actions
Approved by: petrochenkov
Pushing 86f7f78 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Jan 14, 2022
@bors bors merged commit 86f7f78 into rust-lang:master Jan 14, 2022
@rustbot rustbot added this to the 1.60.0 milestone Jan 14, 2022
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (86f7f78): comparison url.

Summary: This benchmark run did not return any relevant changes.

If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf.

@rustbot label: -perf-regression

AurelienFT added a commit to AurelienFT/massa that referenced this pull request Jan 15, 2022
Revert #92781 because the bug on the nightly compiler has been fixed : rust-lang/rust#92781

Closes  massalabs#2142
AurelienFT added a commit to AurelienFT/massa that referenced this pull request Jan 15, 2022
bors bot added a commit to massalabs/massa that referenced this pull request Jan 18, 2022
2155: Revert the version of Rust fixed r=damip a=AurelienFT

Revert #2141  because the bug on the nightly compiler has been fixed : rust-lang/rust#92781

This will partially resolve  #2142.

I don't know which version should be documented for the episode so I didn't add it to this PR.

Co-authored-by: AurelienFT <[email protected]>
Co-authored-by: AurelienFT <[email protected]>
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.

no MIR available for DefId
10 participants