1
Fork 0

Auto merge of #104861 - nnethercote:attr-cleanups, r=petrochenkov

Attribute cleanups

Best reviewed one commit at a time.

r? `@petrochenkov`
This commit is contained in:
bors 2022-12-01 07:13:45 +00:00
commit d6c4de0fb2
29 changed files with 231 additions and 307 deletions

View file

@ -1606,16 +1606,13 @@ impl<'hir> LoweringContext<'_, 'hir> {
};
// `#[allow(unreachable_code)]`
let attr = {
// `allow(unreachable_code)`
let allow = {
let allow_ident = Ident::new(sym::allow, self.lower_span(span));
let uc_ident = Ident::new(sym::unreachable_code, self.lower_span(span));
let uc_nested = attr::mk_nested_word_item(uc_ident);
attr::mk_list_item(allow_ident, vec![uc_nested])
};
attr::mk_attr_outer(&self.tcx.sess.parse_sess.attr_id_generator, allow)
};
let attr = attr::mk_attr_nested_word(
&self.tcx.sess.parse_sess.attr_id_generator,
AttrStyle::Outer,
sym::allow,
sym::unreachable_code,
self.lower_span(span),
);
let attrs: AttrVec = thin_vec![attr];
// `ControlFlow::Continue(val) => #[allow(unreachable_code)] val,`