File tree Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -4165,11 +4165,12 @@ AttrInputMetaItemContainer::separate_cfg_attrs () const
4165
4165
bool
4166
4166
Attribute::check_cfg_predicate (const Session &session) const
4167
4167
{
4168
+ auto string_path = path.as_string ();
4168
4169
/* assume that cfg predicate actually can exist, i.e. attribute has cfg or
4169
4170
* cfg_attr path */
4170
4171
if (!has_attr_input ()
4171
- || (path. as_string () != Values::Attributes::CFG
4172
- && path. as_string () != Values::Attributes::CFG_ATTR))
4172
+ || (string_path != Values::Attributes::CFG
4173
+ && string_path != Values::Attributes::CFG_ATTR))
4173
4174
{
4174
4175
// DEBUG message
4175
4176
rust_debug (
@@ -4185,6 +4186,13 @@ Attribute::check_cfg_predicate (const Session &session) const
4185
4186
return false ;
4186
4187
4187
4188
auto &meta_item = static_cast <AttrInputMetaItemContainer &> (*attr_input);
4189
+ if (meta_item.get_items ().empty ()
4190
+ && string_path == Values::Attributes::CFG_ATTR)
4191
+ {
4192
+ rust_error_at (path.get_locus (),
4193
+ " malformed %<cfg_attr%> attribute input" );
4194
+ return false ;
4195
+ }
4188
4196
return meta_item.get_items ().front ()->check_cfg_predicate (session);
4189
4197
}
4190
4198
Original file line number Diff line number Diff line change
1
+ struct S {
2
+ #[ cfg_attr( ) ]
3
+ field : u8 ,
4
+ // { dg-error "malformed .cfg_attr. attribute input" "" { target *-*-* } .-2 }
5
+ }
You can’t perform that action at this time.
0 commit comments