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

Add script and tests for using keywords as identifiers #8739

Closed
wants to merge 1 commit into from

Conversation

fhahn
Copy link
Contributor

@fhahn fhahn commented Aug 24, 2013

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.



template = """
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do believe it's 2013. :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes :)

I've updated the date in the copyright notice of the script and use the current year for files created by the script

@pnkfelix
Copy link
Member

From past experience with approaches like this: The generated files should include comments saying that they are auto-generated from a script and include the path to the script from the root of the repository. (It might also be good if the generated files were tagged as read-only, where the python script would explicit toggle the write-permission bit back on during the generation process.)

@pnkfelix
Copy link
Member

(having said that, thanks for taking the initiative on this!)

@fhahn
Copy link
Contributor Author

fhahn commented Aug 26, 2013

@pnkfelix Thanks for the feedback, I've added the comment to the auto-generated files and set read-only permissions

bors added a commit that referenced this pull request Aug 27, 2013
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.
@bors bors closed this Aug 27, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants