Skip to content

Commit 87be1ba

Browse files
committed
Fix build
1 parent b82c524 commit 87be1ba

File tree

11 files changed

+32
-32
lines changed

11 files changed

+32
-32
lines changed

compiler/rustc_ast/src/ast.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,7 @@ pub struct Crate {
488488
/// E.g., `#[test]`, `#[derive(..)]`, `#[rustfmt::skip]` or `#[feature = "foo"]`.
489489
#[derive(Clone, Encodable, Decodable, Debug, HashStable_Generic)]
490490
pub struct MetaItem {
491-
pub unsafety: Unsafe,
491+
pub unsafety: Safety,
492492
pub path: Path,
493493
pub kind: MetaItemKind,
494494
pub span: Span,
@@ -2825,7 +2825,7 @@ impl NormalAttr {
28252825
pub fn from_ident(ident: Ident) -> Self {
28262826
Self {
28272827
item: AttrItem {
2828-
unsafety: Unsafe::No,
2828+
unsafety: Safety::Default,
28292829
path: Path::from_ident(ident),
28302830
args: AttrArgs::Empty,
28312831
tokens: None,
@@ -2837,7 +2837,7 @@ impl NormalAttr {
28372837

28382838
#[derive(Clone, Encodable, Decodable, Debug, HashStable_Generic)]
28392839
pub struct AttrItem {
2840-
pub unsafety: Unsafe,
2840+
pub unsafety: Safety,
28412841
pub path: Path,
28422842
pub args: AttrArgs,
28432843
// Tokens for the meta item, e.g. just the `foo` within `#[foo]` or `#![foo]`.

compiler/rustc_ast/src/attr/mod.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//! Functions dealing with attributes and meta items.
22
33
use crate::ast::{
4-
AttrArgs, AttrArgsEq, AttrId, AttrItem, AttrKind, AttrStyle, AttrVec, Attribute, Unsafe,
4+
AttrArgs, AttrArgsEq, AttrId, AttrItem, AttrKind, AttrStyle, AttrVec, Attribute, Safety,
55
};
66
use crate::ast::{DelimArgs, Expr, ExprKind, LitKind, MetaItemLit};
77
use crate::ast::{MetaItem, MetaItemKind, NestedMetaItem, NormalAttr};
@@ -241,7 +241,7 @@ impl AttrItem {
241241

242242
pub fn meta(&self, span: Span) -> Option<MetaItem> {
243243
Some(MetaItem {
244-
unsafety: Unsafe::No,
244+
unsafety: Safety::Default,
245245
path: self.path.clone(),
246246
kind: self.meta_kind()?,
247247
span,
@@ -379,7 +379,7 @@ impl MetaItem {
379379
};
380380
let span = path.span.with_hi(hi);
381381
// FIX THIS LATER
382-
Some(MetaItem { unsafety: Unsafe::No, path, kind, span })
382+
Some(MetaItem { unsafety: Safety::Default, path, kind, span })
383383
}
384384
}
385385

@@ -563,7 +563,7 @@ pub fn mk_doc_comment(
563563
pub fn mk_attr(
564564
g: &AttrIdGenerator,
565565
style: AttrStyle,
566-
unsafety: Unsafe,
566+
unsafety: Safety,
567567
path: Path,
568568
args: AttrArgs,
569569
span: Span,
@@ -589,7 +589,7 @@ pub fn mk_attr_from_item(
589589
pub fn mk_attr_word(
590590
g: &AttrIdGenerator,
591591
style: AttrStyle,
592-
unsafety: Unsafe,
592+
unsafety: Safety,
593593
name: Symbol,
594594
span: Span,
595595
) -> Attribute {
@@ -601,7 +601,7 @@ pub fn mk_attr_word(
601601
pub fn mk_attr_nested_word(
602602
g: &AttrIdGenerator,
603603
style: AttrStyle,
604-
unsafety: Unsafe,
604+
unsafety: Safety,
605605
outer: Symbol,
606606
inner: Symbol,
607607
span: Span,
@@ -623,7 +623,7 @@ pub fn mk_attr_nested_word(
623623
pub fn mk_attr_name_value_str(
624624
g: &AttrIdGenerator,
625625
style: AttrStyle,
626-
unsafety: Unsafe,
626+
unsafety: Safety,
627627
name: Symbol,
628628
val: Symbol,
629629
span: Span,

compiler/rustc_ast_lowering/src/expr.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1801,7 +1801,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
18011801
let attr = attr::mk_attr_nested_word(
18021802
&self.tcx.sess.psess.attr_id_generator,
18031803
AttrStyle::Outer,
1804-
Unsafe::No,
1804+
Safety::Default,
18051805
sym::allow,
18061806
sym::unreachable_code,
18071807
self.lower_span(span),

compiler/rustc_ast_pretty/src/pprust/state.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use rustc_ast::token::{self, BinOpToken, CommentKind, Delimiter, Nonterminal, To
1616
use rustc_ast::tokenstream::{Spacing, TokenStream, TokenTree};
1717
use rustc_ast::util::classify;
1818
use rustc_ast::util::comments::{Comment, CommentStyle};
19-
use rustc_ast::{self as ast, AttrArgs, AttrArgsEq, BlockCheckMode, PatKind, Unsafe};
19+
use rustc_ast::{self as ast, AttrArgs, AttrArgsEq, BlockCheckMode, PatKind, Safety};
2020
use rustc_ast::{attr, BindingMode, ByRef, DelimArgs, RangeEnd, RangeSyntax, Term};
2121
use rustc_ast::{GenericArg, GenericBound, SelfKind};
2222
use rustc_ast::{InlineAsmOperand, InlineAsmRegOrRegClass};
@@ -249,7 +249,7 @@ pub fn print_crate<'a>(
249249
let fake_attr = attr::mk_attr_nested_word(
250250
g,
251251
ast::AttrStyle::Inner,
252-
Unsafe::No,
252+
Safety::Default,
253253
sym::feature,
254254
sym::prelude_import,
255255
DUMMY_SP,
@@ -261,7 +261,7 @@ pub fn print_crate<'a>(
261261
if edition.is_rust_2015() {
262262
// `#![no_std]`
263263
let fake_attr =
264-
attr::mk_attr_word(g, ast::AttrStyle::Inner, Unsafe::No, sym::no_std, DUMMY_SP);
264+
attr::mk_attr_word(g, ast::AttrStyle::Inner, Safety::Default, sym::no_std, DUMMY_SP);
265265
s.print_attribute(&fake_attr);
266266
}
267267
}

compiler/rustc_builtin_macros/src/derive.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use crate::cfg_eval::cfg_eval;
22
use crate::errors;
33

44
use rustc_ast as ast;
5-
use rustc_ast::{GenericParamKind, ItemKind, MetaItemKind, NestedMetaItem, StmtKind, Unsafe};
5+
use rustc_ast::{GenericParamKind, ItemKind, MetaItemKind, NestedMetaItem, StmtKind, Safety};
66
use rustc_expand::base::{
77
Annotatable, DeriveResolution, ExpandResult, ExtCtxt, Indeterminate, MultiItemModifier,
88
};
@@ -163,9 +163,9 @@ fn report_path_args(sess: &Session, meta: &ast::MetaItem) {
163163

164164
fn report_unsafe_args(sess: &Session, meta: &ast::MetaItem) {
165165
match meta.unsafety {
166-
Unsafe::Yes(span) => {
166+
Safety::Unsafe(span) => {
167167
sess.dcx().emit_err(errors::DeriveUnsafePath { span });
168168
}
169-
Unsafe::No => {}
169+
Safety::Default => {}
170170
}
171171
}

compiler/rustc_builtin_macros/src/test_harness.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ impl<'a> MutVisitor for EntryPointCleaner<'a> {
203203
let allow_dead_code = attr::mk_attr_nested_word(
204204
&self.sess.psess.attr_id_generator,
205205
ast::AttrStyle::Outer,
206-
ast::Unsafe::No,
206+
ast::Safety::Default,
207207
sym::allow,
208208
sym::dead_code,
209209
self.def_site,

compiler/rustc_expand/src/build.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -666,20 +666,20 @@ impl<'a> ExtCtxt<'a> {
666666
// Builds `#[name]`.
667667
pub fn attr_word(&self, name: Symbol, span: Span) -> ast::Attribute {
668668
let g = &self.sess.psess.attr_id_generator;
669-
attr::mk_attr_word(g, ast::AttrStyle::Outer, ast::Unsafe::No, name, span)
669+
attr::mk_attr_word(g, ast::AttrStyle::Outer, ast::Safety::Default, name, span)
670670
}
671671

672672
// Builds `#[name = val]`.
673673
//
674674
// Note: `span` is used for both the identifier and the value.
675675
pub fn attr_name_value_str(&self, name: Symbol, val: Symbol, span: Span) -> ast::Attribute {
676676
let g = &self.sess.psess.attr_id_generator;
677-
attr::mk_attr_name_value_str(g, ast::AttrStyle::Outer, ast::Unsafe::No, name, val, span)
677+
attr::mk_attr_name_value_str(g, ast::AttrStyle::Outer, ast::Safety::Default, name, val, span)
678678
}
679679

680680
// Builds `#[outer(inner)]`.
681681
pub fn attr_nested_word(&self, outer: Symbol, inner: Symbol, span: Span) -> ast::Attribute {
682682
let g = &self.sess.psess.attr_id_generator;
683-
attr::mk_attr_nested_word(g, ast::AttrStyle::Outer, ast::Unsafe::No, outer, inner, span)
683+
attr::mk_attr_nested_word(g, ast::AttrStyle::Outer, ast::Safety::Default, outer, inner, span)
684684
}
685685
}

compiler/rustc_expand/src/expand.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -781,7 +781,7 @@ impl<'a, 'b> MacroExpander<'a, 'b> {
781781
// The `MetaItem` representing the trait to derive can't
782782
// have an unsafe around it (as of now).
783783
let meta = ast::MetaItem {
784-
unsafety: ast::Unsafe::No,
784+
unsafety: ast::Safety::Default,
785785
kind: MetaItemKind::Word,
786786
span,
787787
path,

compiler/rustc_parse/src/parser/attr.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -258,9 +258,9 @@ impl<'a> Parser<'a> {
258258
this.psess.gated_spans.gate(sym::unsafe_attributes, unsafe_span);
259259
this.expect(&token::OpenDelim(Delimiter::Parenthesis))?;
260260

261-
ast::Unsafe::Yes(unsafe_span)
261+
ast::Safety::Unsafe(unsafe_span)
262262
} else {
263-
ast::Unsafe::No
263+
ast::Safety::Default
264264
};
265265

266266
let path = this.parse_path(PathStyle::Mod)?;
@@ -395,9 +395,9 @@ impl<'a> Parser<'a> {
395395
self.psess.gated_spans.gate(sym::unsafe_attributes, unsafe_span);
396396
self.expect(&token::OpenDelim(Delimiter::Parenthesis))?;
397397

398-
ast::Unsafe::Yes(unsafe_span)
398+
ast::Safety::Unsafe(unsafe_span)
399399
} else {
400-
ast::Unsafe::No
400+
ast::Safety::Default
401401
};
402402

403403
let path = self.parse_path(PathStyle::Mod)?;

compiler/rustc_passes/src/check_attr.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
317317
fn check_unsafe_attr(&self, attr: &Attribute) {
318318
if !attr.is_doc_comment() {
319319
let attr_item = attr.get_normal_item();
320-
if let ast::Unsafe::Yes(unsafe_span) = attr_item.unsafety {
320+
if let ast::Safety::Unsafe(unsafe_span) = attr_item.unsafety {
321321
if !is_unsafe_attr(attr.name_or_empty()) {
322322
self.dcx().emit_err(errors::InvalidAttrUnsafe {
323323
span: unsafe_span,

src/librustdoc/clean/cfg/tests.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use super::*;
22

3-
use rustc_ast::{MetaItemLit, Path, StrStyle, Unsafe};
3+
use rustc_ast::{MetaItemLit, Path, StrStyle, Safety};
44
use rustc_span::create_default_session_globals_then;
55
use rustc_span::symbol::{kw, Ident};
66
use rustc_span::DUMMY_SP;
@@ -16,7 +16,7 @@ fn name_value_cfg(name: &str, value: &str) -> Cfg {
1616

1717
fn dummy_meta_item_word(name: &str) -> MetaItem {
1818
MetaItem {
19-
unsafety: Unsafe::No,
19+
unsafety: Safety::Default,
2020
path: Path::from_ident(Ident::from_str(name)),
2121
kind: MetaItemKind::Word,
2222
span: DUMMY_SP,
@@ -26,7 +26,7 @@ fn dummy_meta_item_word(name: &str) -> MetaItem {
2626
fn dummy_meta_item_name_value(name: &str, symbol: Symbol, kind: LitKind) -> MetaItem {
2727
let lit = MetaItemLit { symbol, suffix: None, kind, span: DUMMY_SP };
2828
MetaItem {
29-
unsafety: Unsafe::No,
29+
unsafety: Safety::Default,
3030
path: Path::from_ident(Ident::from_str(name)),
3131
kind: MetaItemKind::NameValue(lit),
3232
span: DUMMY_SP,
@@ -36,7 +36,7 @@ fn dummy_meta_item_name_value(name: &str, symbol: Symbol, kind: LitKind) -> Meta
3636
macro_rules! dummy_meta_item_list {
3737
($name:ident, [$($list:ident),* $(,)?]) => {
3838
MetaItem {
39-
unsafety: Unsafe::No,
39+
unsafety: Safety::Default,
4040
path: Path::from_ident(Ident::from_str(stringify!($name))),
4141
kind: MetaItemKind::List(thin_vec![
4242
$(
@@ -51,7 +51,7 @@ macro_rules! dummy_meta_item_list {
5151

5252
($name:ident, [$($list:expr),* $(,)?]) => {
5353
MetaItem {
54-
unsafety: Unsafe::No,
54+
unsafety: Safety::Default,
5555
path: Path::from_ident(Ident::from_str(stringify!($name))),
5656
kind: MetaItemKind::List(thin_vec![
5757
$(

0 commit comments

Comments
 (0)