Skip to content

Commit aac6846

Browse files
committed
Bump to Rust 1.19
Update the AST to the one in rust nightly 1.19. Notable changes are: * 'TokenStream' is a new type (core to Macros 2.0) * 'MetaItem' and 'NestedMetaItem' are gone * 'Attribute' now just contains a path and a 'TokenStream' * Some lexer peculiarities around literals are fixed
1 parent 84c7e28 commit aac6846

File tree

20 files changed

+461
-493
lines changed

20 files changed

+461
-493
lines changed

benchmarks/allocation-benchmarks/Main.hs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@ import System.IO.Error (isDoesNotExistError)
1919
import Data.Aeson
2020
import qualified Data.ByteString.Lazy as BL
2121

22-
-- TODO:
23-
-- Only allocation and GCs seem to be really reproducible. Live and max sometimes are 0.
22+
-- TODO: only allocation and GCs seem to be really reproducible. Live and max sometimes are 0.
2423

2524
main :: IO ()
2625
main = do

language-rust.cabal

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ library
4848
Language.Rust.Parser.Literals
4949
Language.Rust.Parser.Reversed
5050
Language.Rust.Pretty.Resolve
51+
Language.Rust.Pretty.Literals
5152
Language.Rust.Syntax.AST
5253
Language.Rust.Syntax.Ident
5354
Language.Rust.Syntax.Token

sample-sources/attributes.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,8 @@ fn expressions() {
9191
#[blockexpr_outer]
9292
unsafe { #![blockexpr_inner] 1; 2 }
9393

94-
// #[catch_outer] UPDATE RUSTC
95-
// do catch { #![catch_inner] 1 }
94+
#[catch_outer]
95+
do catch { #![catch_inner] 1 };
9696

9797
// #[assign_outer]
9898
// x = 1;

sample-sources/expressions.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ fn main() {
4141
let x = [1; 5];
4242
let x = 1 * (2 + 3);
4343
let x = foo()?;
44+
let x = do catch { 1 };
4445
return 0;
4546
return;
4647

sample-sources/macros.rs

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -21,22 +21,28 @@ tokentrees!{
2121
2222
// literals
2323
literals!{
24-
b'a' b'\n' b'a'suffix
25-
'a' '\n' 'a'suffix
26-
27-
123 123i32
28-
0b1100_1101 0b1100_1101isize
29-
0o3170 0o3170i64
30-
0xAFAC 0xAFACu32
31-
32-
123.1 123.1f32
33-
123.f32 // Gets parsed as [integer token "123", ".", ident token "f32"]
34-
123.0f32
35-
0e+10 // Gets parsed as [integer token "0" with suffix "e", "+", integer token "10"]
36-
00e+10
37-
9e+10
38-
123e-9f32
39-
24+
characters_bytes!{
25+
b'a' b'\n' b'a'suffix
26+
'a' '\n' 'a'suffix
27+
}
28+
29+
integral_numbers!{
30+
123 123i32
31+
0b1100_1101 0b1100_1101isize
32+
0o3170 0o3170i64
33+
0xAFAC 0xAFACu32
34+
}
35+
36+
float_numbers!{
37+
123.1 123.1f32
38+
123.f32 // Gets parsed as [integer token "123", ".", ident token "f32"]
39+
123.0f32
40+
0e+10
41+
00e+10
42+
9e+10
43+
123e-9f32
44+
}
45+
4046
strings!{
4147
"hello \n world!"
4248
@@ -77,11 +83,11 @@ fn main() {
7783
print!("{}\n", 001e+1);
7884
print!("{}\n", 123.);
7985
print!("{}\n", 123.0f32);
86+
print!("{}\n", 0e+1);
8087
print!("{}\n", 123.0__9);
8188
print!("{}\n", 123e-4f32);
8289
8390
// Not what they look like, see above
84-
print!("{}\n", 0e+1);
8591
print!("{}\n", 123.f32);
8692
}
8793

src/Language/Rust/Parser.hs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ instance Parse (Stmt Span) where parser = parseStmt
8282
instance Parse (Item Span) where parser = parseItem
8383
instance Parse (SourceFile Span) where parser = parseSourceFile
8484
instance Parse TokenTree where parser = parseTt
85+
instance Parse TokenStream where parser = parseTokenStream
8586
instance Parse (Block Span) where parser = parseBlock
8687
instance Parse (ImplItem Span) where parser = parseImplItem
8788
instance Parse (TraitItem Span) where parser = parseTraitItem

0 commit comments

Comments
 (0)