summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmilio Cobos Álvarez <emilio@crisal.io>2020-12-20 17:31:23 +0100
committerEmilio Cobos Álvarez <emilio@crisal.io>2020-12-20 20:36:03 +0100
commit98841b32ed51e4474377712aa636251d9a4f7215 (patch)
treedb92940c6f8faae104517668e1a40d351a80c5c1
parent4ce4b934fdabb8066659a765c13b66eba3fba327 (diff)
context: Escape the dyn keyword properly.
Fixes #1946
-rw-r--r--src/ir/context.rs6
-rw-r--r--tests/expectations/tests/keywords.rs4
-rw-r--r--tests/headers/keywords.h1
3 files changed, 8 insertions, 3 deletions
diff --git a/src/ir/context.rs b/src/ir/context.rs
index 1a543757..0207547a 100644
--- a/src/ir/context.rs
+++ b/src/ir/context.rs
@@ -807,9 +807,9 @@ If you encounter an error missing from this list, please file an issue or a PR!"
match name {
"abstract" | "alignof" | "as" | "async" | "become" |
"box" | "break" | "const" | "continue" | "crate" | "do" |
- "else" | "enum" | "extern" | "false" | "final" | "fn" |
- "for" | "if" | "impl" | "in" | "let" | "loop" | "macro" |
- "match" | "mod" | "move" | "mut" | "offsetof" |
+ "dyn" | "else" | "enum" | "extern" | "false" | "final" |
+ "fn" | "for" | "if" | "impl" | "in" | "let" | "loop" |
+ "macro" | "match" | "mod" | "move" | "mut" | "offsetof" |
"override" | "priv" | "proc" | "pub" | "pure" | "ref" |
"return" | "Self" | "self" | "sizeof" | "static" |
"struct" | "super" | "trait" | "true" | "type" | "typeof" |
diff --git a/tests/expectations/tests/keywords.rs b/tests/expectations/tests/keywords.rs
index 12935191..f77bda0b 100644
--- a/tests/expectations/tests/keywords.rs
+++ b/tests/expectations/tests/keywords.rs
@@ -62,6 +62,10 @@ extern "C" {
pub static mut str_: ::std::os::raw::c_int;
}
extern "C" {
+ #[link_name = "\u{1}dyn"]
+ pub static mut dyn_: ::std::os::raw::c_int;
+}
+extern "C" {
#[link_name = "\u{1}as"]
pub static mut as_: ::std::os::raw::c_int;
}
diff --git a/tests/headers/keywords.h b/tests/headers/keywords.h
index 0e492316..78ad2784 100644
--- a/tests/headers/keywords.h
+++ b/tests/headers/keywords.h
@@ -12,6 +12,7 @@ int usize;
int isize;
int bool;
int str;
+int dyn;
int as;
int box;