aboutsummaryrefslogtreecommitdiff
path: root/crates/syntax
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2020-11-23 07:05:31 +0000
committerGitHub <[email protected]>2020-11-23 07:05:31 +0000
commit224387a4de8b780dee0014ba61a6fcad20726f5f (patch)
tree658935369dc3ce1601a153ad55fd2eec787c4db9 /crates/syntax
parentcadf0e9fb630d04367ef2611383865963d84ab54 (diff)
parent8a11da40a789e5d73c5c11d69ba87638ddff8676 (diff)
Merge #6606
6606: Parse unsafe extern block r=lnicola a=dtolnay `unsafe extern` block is parsed successfully by rustc, which means it is usable in attribute macro input. https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=6f805556f176d082d87255957f16b5f6 ```rust #[cfg(parse)] unsafe extern "C++" { fn demo(); } ``` ```diff [email protected] - [email protected] + [email protected] [email protected] [email protected] "#" [email protected] "[" [email protected] [email protected] [email protected] [email protected] "cfg" [email protected] [email protected] "(" [email protected] "parse" [email protected] ")" [email protected] "]" [email protected] "\n" [email protected] "unsafe" [email protected] " " [email protected] [email protected] "extern" [email protected] " " [email protected] "\"C++\"" - [email protected] " " - [email protected] - [email protected] "{" - [email protected] "\n " - [email protected] - [email protected] "fn" - [email protected] " " - [email protected] - [email protected] "demo" - [email protected] - [email protected] "(" - [email protected] ")" - [email protected] ";" - [email protected] "\n" - [email protected] "}" + [email protected] " " + [email protected] + [email protected] "{" + [email protected] "\n " + [email protected] + [email protected] "fn" + [email protected] " " + [email protected] + [email protected] "demo" + [email protected] + [email protected] "(" + [email protected] ")" + [email protected] ";" + [email protected] "\n" + [email protected] "}" ``` This is of interest for https://github.com/dtolnay/cxx. Co-authored-by: David Tolnay <[email protected]>
Diffstat (limited to 'crates/syntax')
-rw-r--r--crates/syntax/test_data/parser/ok/0068_item_modifiers.rast16
-rw-r--r--crates/syntax/test_data/parser/ok/0068_item_modifiers.rs2
2 files changed, 16 insertions, 2 deletions
diff --git a/crates/syntax/test_data/parser/ok/0068_item_modifiers.rast b/crates/syntax/test_data/parser/ok/0068_item_modifiers.rast
index 50a6d8ee9..87eebf185 100644
--- a/crates/syntax/test_data/parser/ok/0068_item_modifiers.rast
+++ b/crates/syntax/test_data/parser/ok/0068_item_modifiers.rast
@@ -1,4 +1,4 @@
1[email protected]04 1[email protected]28
2 [email protected] 2 [email protected]
3 [email protected] "async" 3 [email protected] "async"
4 [email protected] " " 4 [email protected] " "
@@ -215,4 +215,16 @@ [email protected]
215 [email protected] 215 [email protected]
216 [email protected] "{" 216 [email protected] "{"
217 [email protected] "}" 217 [email protected] "}"
218 [email protected] "\n" 218 [email protected] "\n\n"
219 [email protected]
220 [email protected] "unsafe"
221 [email protected] " "
222 [email protected]
223 [email protected] "extern"
224 [email protected] " "
225 [email protected] "\"C++\""
226 [email protected] " "
227 [email protected]
228 [email protected] "{"
229 [email protected] "}"
230 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/ok/0068_item_modifiers.rs b/crates/syntax/test_data/parser/ok/0068_item_modifiers.rs
index 8d697c04b..6d27a082c 100644
--- a/crates/syntax/test_data/parser/ok/0068_item_modifiers.rs
+++ b/crates/syntax/test_data/parser/ok/0068_item_modifiers.rs
@@ -14,3 +14,5 @@ unsafe auto trait T {}
14unsafe impl Foo {} 14unsafe impl Foo {}
15default impl Foo {} 15default impl Foo {}
16unsafe default impl Foo {} 16unsafe default impl Foo {}
17
18unsafe extern "C++" {}