Skip to content

Commit 6f7b087

Browse files
sqrtMP-E-P
authored andcommitted
gccrs: add outer attributes
gcc/rust/ChangeLog: * util/rust-attributes.cc: add attributes to the __outer_attributes set. This prevents some inconsistent behavior, like: https://godbolt.org/z/Eq1GE7xxY Signed-off-by: Mason Pike <[email protected]>
1 parent 5df24b4 commit 6f7b087

File tree

2 files changed

+19
-3
lines changed

2 files changed

+19
-3
lines changed

gcc/rust/util/rust-attributes.cc

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,23 @@ static const BuiltinAttrDefinition __definitions[]
124124
{Attrs::TEST, CODE_GENERATION}};
125125

126126
static const std::set<std::string> __outer_attributes
127-
= {Attrs::INLINE, Attrs::DERIVE_ATTR, Attrs::ALLOW_INTERNAL_UNSTABLE,
128-
Attrs::LANG, Attrs::REPR, Attrs::PATH,
129-
Attrs::TARGET_FEATURE, Attrs::TEST};
127+
= {Attrs::INLINE,
128+
Attrs::DERIVE_ATTR,
129+
Attrs::ALLOW_INTERNAL_UNSTABLE,
130+
Attrs::LANG,
131+
Attrs::REPR,
132+
Attrs::PATH,
133+
Attrs::TARGET_FEATURE,
134+
Attrs::TEST,
135+
Attrs::COLD,
136+
Attrs::MACRO_USE,
137+
Attrs::MACRO_EXPORT,
138+
Attrs::PROC_MACRO_ATTRIBUTE,
139+
Attrs::PROC_MACRO_DERIVE,
140+
Attrs::DEPRECATED,
141+
Attrs::MUST_USE,
142+
Attrs::LINK_NAME,
143+
Attrs::LINK_SECTION};
130144

131145
BuiltinAttributeMappings *
132146
BuiltinAttributeMappings::get ()
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#![cold] // { dg-error "attribute cannot be used at crate level" }
2+
pub fn test() {}

0 commit comments

Comments
 (0)