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

regression: rustc incorrectly claims that enum variant is inaccessible #90113

Closed
camelid opened this issue Oct 20, 2021 · 3 comments · Fixed by #90127
Closed

regression: rustc incorrectly claims that enum variant is inaccessible #90113

camelid opened this issue Oct 20, 2021 · 3 comments · Fixed by #90127
Assignees
Labels
A-diagnostics Area: Messages for errors, warnings, and lints C-bug Category: This is a bug. D-incorrect Diagnostics: A diagnostic that is giving misleading or incorrect information. P-medium Medium priority regression-from-stable-to-beta Performance or correctness regression from stable to beta. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Milestone

Comments

@camelid
Copy link
Member

camelid commented Oct 20, 2021

MCVE

mod list {
    pub use List::Cons;

    pub enum List<T> {
        Cons(T, Box<List<T>>),
    }
}

mod alias {
    use crate::list::List;

    pub type Foo = List<String>;
}

fn foo(l: crate::alias::Foo) {
    match l {
        Cons(hd, tl) => {}
    }
}

New error (incorrect)

error[E0531]: cannot find tuple struct or tuple variant `Cons` in this scope
  --> src/lib.rs:17:9
   |
17 |         Cons(hd, tl) => {}
   |         ^^^^ not found in this scope
   |
note: tuple variant `crate::alias::List::Cons` exists but is inaccessible
  --> src/lib.rs:5:9
   |
5  |         Cons(T, Box<List<T>>),
   |         ^^^^^^^^^^^^^^^^^^^^^ not accessible

For more information about this error, try `rustc --explain E0531`.

Old error (correct)

error[E0531]: cannot find tuple struct or tuple variant `Cons` in this scope
  --> src/lib.rs:17:9
   |
17 |         Cons(hd, tl) => {}
   |         ^^^^ not found in this scope
   |
help: consider importing this tuple variant
   |
1  | use crate::alias::List::Cons;
   |

For more information about this error, try `rustc --explain E0531`.
@camelid camelid added A-diagnostics Area: Messages for errors, warnings, and lints T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. regression-from-stable-to-beta Performance or correctness regression from stable to beta. C-bug Category: This is a bug. D-incorrect Diagnostics: A diagnostic that is giving misleading or incorrect information. labels Oct 20, 2021
@camelid camelid added this to the 1.57.0 milestone Oct 20, 2021
@rustbot rustbot added the I-prioritize Issue: Indicates that prioritization has been requested for this issue. label Oct 20, 2021
@camelid
Copy link
Member Author

camelid commented Oct 20, 2021

Bisected to a rollup, but I think it's very likely to be #88838. cc @FabianWolff @estebank

searched nightlies: from nightly-2021-10-01 to nightly-2021-10-19
regressed nightly: nightly-2021-10-02
searched commits: from aa7aca3 to c02371c
regressed commit: 69eb996

bisected with cargo-bisect-rustc v0.6.0

Host triple: x86_64-apple-darwin
Reproduce with:

cargo bisect-rustc --preserve --prompt --start=2021-10-01 --end=2021-10-19 -- check 

@camelid
Copy link
Member Author

camelid commented Oct 20, 2021

The old suggestion was actually incorrect because it suggested crate::alias::List::Cons, which is a private import. However, the new error is "more incorrect" IMO since it says something confusing (and incorrect).

@JohnTitor JohnTitor self-assigned this Oct 21, 2021
@apiraino
Copy link
Contributor

Assigning priority as discussed in the Zulip thread of the Prioritization Working Group.

@rustbot label -I-prioritize +P-medium

@rustbot rustbot added P-medium Medium priority and removed I-prioritize Issue: Indicates that prioritization has been requested for this issue. labels Oct 21, 2021
@bors bors closed this as completed in c734a9e Oct 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints C-bug Category: This is a bug. D-incorrect Diagnostics: A diagnostic that is giving misleading or incorrect information. P-medium Medium priority regression-from-stable-to-beta Performance or correctness regression from stable to beta. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants