-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
Dereference on single element tags ignores visibility of constructor #818
Labels
A-type-system
Area: Type system
Milestone
Comments
This is one of two interrelated complaints in #802. |
Closed
Updated test case:
|
This seems like it's worth fixing. I will take it on. |
Blocked on #3993 |
#3993 is fixed so I should be able to fix this now. |
catamorphism
added a commit
to catamorphism/rust
that referenced
this issue
Nov 30, 2012
If an enum type's only variant is private, disallow dereferencing values of its type, as per rust-lang#818. Due to rust-lang#4082, this only applies to enums that are in the same crate.
Done, pending review: #4084 |
keeperofdakeys
pushed a commit
to keeperofdakeys/rust
that referenced
this issue
Dec 12, 2017
Add powerpc64le to CI
ZuseZ4
pushed a commit
to EnzymeAD/rust
that referenced
this issue
Mar 7, 2023
* Fix LLVM 15 * Multi version tests * Fix build on 15+
celinval
added a commit
to celinval/rust-dev
that referenced
this issue
Jun 4, 2024
Test no longer needs special handling.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Exporting a tag type but not the constructors for it is a simple way to construct abstract data types. (This is how it is done in Haskell.) This works in rust as well, but only for tags with multiple constructors. If the tag has only a single constructor, * will see through it regardless of the visibility of the constructor.
Example
Part of the problem might be that dereference on single element tags isn't a particularly principled idea to begin with, but it is undeniably convenient.
The text was updated successfully, but these errors were encountered: