-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
Try disallowing keywords as identifiers #2275
Comments
I agree, though this is RFC-level to the extent that others probably ought to comment. |
I agree. Simplify! |
Agreed. |
Is this done? I note that this program doesn't compile:
Same if you replace |
Not done; the program works with I'm in favour of this change. Makes syntax hilighting easier. |
This appears to be necessary to make the grammar LL(1). See https://mail.mozilla.org/pipermail/rust-dev/2013-April/003780.html |
Regardless of the grammar situation, this is still a good change to make. Let's not bother enabling |
I think this is fixed, but it needs a testcase for every keyword... simple way would be to write a script that sucks in the list of keywords and spits out a file for each of them, generated from a simple template. Needs to do this to ensure that they each don't compile. |
This is a pull request for #2275 I've created a small python script to generate test files for a list of keywords (as break do else enum extern false fn for if impl let loop match mod mut priv pub ref return self static struct super true trait type unsafe use while), but I'm not really sure where to put it. I've added the created files as well. I did not use fn main() { let $KW = "foo"; //~ error println($KW); //~ error } as template, because for return, self, ref, loop, mut and break this does not raise an error in the ```println``` line, only in the ```let``` line.
Closed by PR #8739 |
…, r=RalfJung Enable permissive provenance by default This completes the plan laid out in rust-lang/miri#2133: - We use permissive provenance with wildcard pointers by default. - We print a warning on int2ptr casts. `-Zmiri-permissive-provenance` suppresses the warning; `-Zmiri-strict-provenance` turns it into a hard error. - Raw pointer tagging is now always enabled, so we remove the `-Zmiri-tag-raw-pointers` flag and the code for untagged pointers. (Passing the flag still works, for compatibility -- but we just ignore it, with a warning.) We also fix an intptrcast issue: - Only live allocations are considered when computing the AllocId from an address. So, finally, Miri has a good story for ptr2int2ptr roundtrips *and* no weird false negatives when doing raw pointer stuff with Stacked Borrows. :-) 🎉 Thanks a lot to everyone who helped with this, in particular `@carbotaniuman` who convinced me this is even possible. Fixes rust-lang/miri#2133 Fixes rust-lang/miri#1866 Fixes rust-lang/miri#1993
add a pause, for readability
The distinction between bad words and contextual keywords is difficult to keep track of. Built-in types are no longer keywords, which allows us to create things like
mod int
. It may be fairly easy now to disallow keywords as identifiers.The text was updated successfully, but these errors were encountered: