-
Notifications
You must be signed in to change notification settings - Fork 13k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
syntax: Enable parsing of
const
globals
This rewrites them to the current `ItemStatic` production of the compiler, but I want to get this into a snapshot. It will be illegal to use a `static` in a pattern of a `match` statement, so all those current uses will need to be rewritten to `const` once it's implemented. This requires that the stage0 snapshot is able to parse `const`. cc #17718
- Loading branch information
1 parent
b2d4eb1
commit 7e22af3
Showing
3 changed files
with
53 additions
and
3 deletions.
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
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,17 @@ | ||
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT | ||
// file at the top-level directory of this distribution and at | ||
// http://rust-lang.org/COPYRIGHT. | ||
// | ||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or | ||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license | ||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your | ||
// option. This file may not be copied, modified, or distributed | ||
// except according to those terms. | ||
|
||
const | ||
mut //~ ERROR: const globals cannot be mutable, did you mean to declare a static? | ||
FOO: uint = 3; | ||
|
||
fn main() { | ||
} | ||
|
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,15 @@ | ||
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT | ||
// file at the top-level directory of this distribution and at | ||
// http://rust-lang.org/COPYRIGHT. | ||
// | ||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or | ||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license | ||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your | ||
// option. This file may not be copied, modified, or distributed | ||
// except according to those terms. | ||
|
||
const FOO: uint = 3; | ||
|
||
fn main() { | ||
assert_eq!(FOO, 3); | ||
} |
7e22af3
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.
saw approval from huonw
at alexcrichton@7e22af3
7e22af3
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.
merging alexcrichton/rust/issue-17718-start = 7e22af3 into auto
7e22af3
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.
alexcrichton/rust/issue-17718-start = 7e22af3 merged ok, testing candidate = 639139d7
7e22af3
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.
some tests failed:
failure: http://buildbot.rust-lang.org/builders/auto-mac-64-opt/builds/1638
exception: http://buildbot.rust-lang.org/builders/auto-mac-32-opt/builds/1641
exception: http://buildbot.rust-lang.org/builders/auto-mac-64-nopt-c/builds/1632
exception: http://buildbot.rust-lang.org/builders/auto-mac-64-nopt-t/builds/1638
exception: http://buildbot.rust-lang.org/builders/auto-linux-32-opt/builds/1635
exception: http://buildbot.rust-lang.org/builders/auto-linux-32-nopt-c/builds/1634
exception: http://buildbot.rust-lang.org/builders/auto-linux-32-nopt-t/builds/1634
exception: http://buildbot.rust-lang.org/builders/auto-linux-64-opt/builds/1638
exception: http://buildbot.rust-lang.org/builders/auto-linux-64-nopt-c/builds/1632
exception: http://buildbot.rust-lang.org/builders/auto-linux-64-nopt-t/builds/1631
exception: http://buildbot.rust-lang.org/builders/auto-linux-64-x-android-t/builds/1634
exception: http://buildbot.rust-lang.org/builders/auto-win-32-opt/builds/1290
exception: http://buildbot.rust-lang.org/builders/auto-win-32-nopt-t/builds/1287
exception: http://buildbot.rust-lang.org/builders/auto-win-32-nopt-c/builds/1291
exception: http://buildbot.rust-lang.org/builders/auto-win-64-opt/builds/124
exception: http://buildbot.rust-lang.org/builders/auto-win-64-nopt-t/builds/123
exception: http://buildbot.rust-lang.org/builders/auto-win-64-nopt-c/builds/122