forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#59936 - petrochenkov:confict, r=davidtwco
Fix cross-crate visibility of fictive variant constructors After merging rust-lang#59376 I realized that the code in the decoder wasn't entirely correct - we "decoded" fictive variant constructors with their variant's visibility, which could be public, rather than demoted to `pub(crate)`. Fictive constructors are not directly usable in expression/patterns, but the effect still can be observed with imports. r? @davidtwco
- Loading branch information
Showing
2 changed files
with
24 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
src/test/ui/rfc-2008-non-exhaustive/variants_fictive_visibility.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// compile-pass | ||
// aux-build:variants.rs | ||
|
||
extern crate variants; | ||
|
||
const S: u8 = 0; | ||
|
||
// OK, `Struct` in value namespace is crate-private, so it's filtered away | ||
// and there's no conflict with the previously defined `const S`. | ||
use variants::NonExhaustiveVariants::Struct as S; | ||
|
||
fn main() {} |