Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Towards dynamic const-qualify #27
Towards dynamic const-qualify #27
Changes from all commits
a18aafc
a9c7047
50a1829
cbd7e7e
53d0200
7f8c81c
87c3c87
95acdf2
a29f147
1d2b7b1
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this would be nice personally; less times to invent an ephemeral constant just to please the check and you also get to use exported statics from other crates.
Any future compat hazards with some new feature?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Discovered a problem... If we want to have a scheme like rust-lang/rfcs#2492 but centered around
static
s instead, allowingstatic
s in const contexts will give us all the problems re. separate compilation.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Centril sorry, I do not follow... why is it harder for separate compilation to support
const
referring tostatic
thanconst
referring toconst
(and the latter we already support)?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this case it would be a
static
for which the value isn't known yet; that is something likepub extern static Foo: u8;
<-- no value. That would be similar to rust-lang/rfcs#2492 in that it is matched up with something in the crate graph. If you can then refer toFoo
in types then that will create all the same problems as withextern existential type
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As long as whatever instantiates the
static
checks them for validity, we are sill good. The important part is the invariant that all statics have been checked. The order doesn't matter.