[breaking-change] don't glob export ast::BlockCheckMode variants
This commit is contained in:
parent
3b57d40fe5
commit
47b0784ba8
9 changed files with 24 additions and 27 deletions
|
@ -30,7 +30,7 @@ use rustc_borrowck::graphviz as borrowck_dot;
|
||||||
use rustc_resolve as resolve;
|
use rustc_resolve as resolve;
|
||||||
use rustc_metadata::cstore::CStore;
|
use rustc_metadata::cstore::CStore;
|
||||||
|
|
||||||
use syntax::ast;
|
use syntax::ast::{self, BlockCheckMode};
|
||||||
use syntax::codemap;
|
use syntax::codemap;
|
||||||
use syntax::fold::{self, Folder};
|
use syntax::fold::{self, Folder};
|
||||||
use syntax::print::{pp, pprust};
|
use syntax::print::{pp, pprust};
|
||||||
|
@ -651,7 +651,7 @@ impl fold::Folder for ReplaceBodyWithLoop {
|
||||||
|
|
||||||
if !self.within_static_or_const {
|
if !self.within_static_or_const {
|
||||||
|
|
||||||
let empty_block = expr_to_block(ast::DefaultBlock, None);
|
let empty_block = expr_to_block(BlockCheckMode::Default, None);
|
||||||
let loop_expr = P(ast::Expr {
|
let loop_expr = P(ast::Expr {
|
||||||
node: ast::ExprLoop(empty_block, None),
|
node: ast::ExprLoop(empty_block, None),
|
||||||
id: ast::DUMMY_NODE_ID,
|
id: ast::DUMMY_NODE_ID,
|
||||||
|
|
|
@ -1571,8 +1571,8 @@ pub fn lower_visibility(_lctx: &LoweringContext, v: Visibility) -> hir::Visibili
|
||||||
|
|
||||||
pub fn lower_block_check_mode(lctx: &LoweringContext, b: &BlockCheckMode) -> hir::BlockCheckMode {
|
pub fn lower_block_check_mode(lctx: &LoweringContext, b: &BlockCheckMode) -> hir::BlockCheckMode {
|
||||||
match *b {
|
match *b {
|
||||||
DefaultBlock => hir::DefaultBlock,
|
BlockCheckMode::Default => hir::DefaultBlock,
|
||||||
UnsafeBlock(u) => hir::UnsafeBlock(lower_unsafe_source(lctx, u)),
|
BlockCheckMode::Unsafe(u) => hir::UnsafeBlock(lower_unsafe_source(lctx, u)),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,6 @@
|
||||||
|
|
||||||
// The Rust abstract syntax tree.
|
// The Rust abstract syntax tree.
|
||||||
|
|
||||||
pub use self::BlockCheckMode::*;
|
|
||||||
pub use self::CaptureClause::*;
|
pub use self::CaptureClause::*;
|
||||||
pub use self::Decl_::*;
|
pub use self::Decl_::*;
|
||||||
pub use self::ExplicitSelf_::*;
|
pub use self::ExplicitSelf_::*;
|
||||||
|
@ -870,8 +869,8 @@ pub type SpannedIdent = Spanned<Ident>;
|
||||||
|
|
||||||
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug, Copy)]
|
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug, Copy)]
|
||||||
pub enum BlockCheckMode {
|
pub enum BlockCheckMode {
|
||||||
DefaultBlock,
|
Default,
|
||||||
UnsafeBlock(UnsafeSource),
|
Unsafe(UnsafeSource),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug, Copy)]
|
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug, Copy)]
|
||||||
|
|
|
@ -9,9 +9,7 @@
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
use abi;
|
use abi;
|
||||||
use ast::{Ident, Generics, Expr};
|
use ast::{self, Ident, Generics, Expr, BlockCheckMode, UnOp};
|
||||||
use ast::UnOp;
|
|
||||||
use ast;
|
|
||||||
use attr;
|
use attr;
|
||||||
use codemap::{Span, respan, Spanned, DUMMY_SP, Pos};
|
use codemap::{Span, respan, Spanned, DUMMY_SP, Pos};
|
||||||
use ext::base::ExtCtxt;
|
use ext::base::ExtCtxt;
|
||||||
|
@ -575,7 +573,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> {
|
||||||
stmts: stmts,
|
stmts: stmts,
|
||||||
expr: expr,
|
expr: expr,
|
||||||
id: ast::DUMMY_NODE_ID,
|
id: ast::DUMMY_NODE_ID,
|
||||||
rules: ast::DefaultBlock,
|
rules: BlockCheckMode::Default,
|
||||||
span: span,
|
span: span,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
|
|
||||||
// Predicates on exprs and stmts that the pretty-printer and parser use
|
// Predicates on exprs and stmts that the pretty-printer and parser use
|
||||||
|
|
||||||
use ast;
|
use ast::{self, BlockCheckMode};
|
||||||
|
|
||||||
/// Does this expression require a semicolon to be treated
|
/// Does this expression require a semicolon to be treated
|
||||||
/// as a statement? The negation of this: 'can this expression
|
/// as a statement? The negation of this: 'can this expression
|
||||||
|
@ -37,7 +37,7 @@ pub fn expr_requires_semi_to_be_stmt(e: &ast::Expr) -> bool {
|
||||||
|
|
||||||
pub fn expr_is_simple_block(e: &ast::Expr) -> bool {
|
pub fn expr_is_simple_block(e: &ast::Expr) -> bool {
|
||||||
match e.node {
|
match e.node {
|
||||||
ast::ExprBlock(ref block) => block.rules == ast::DefaultBlock,
|
ast::ExprBlock(ref block) => block.rules == BlockCheckMode::Default,
|
||||||
_ => false,
|
_ => false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -988,7 +988,7 @@ mod tests {
|
||||||
span: sp(17,19)})),
|
span: sp(17,19)})),
|
||||||
expr: None,
|
expr: None,
|
||||||
id: ast::DUMMY_NODE_ID,
|
id: ast::DUMMY_NODE_ID,
|
||||||
rules: ast::DefaultBlock, // no idea
|
rules: ast::BlockCheckMode::Default, // no idea
|
||||||
span: sp(15,21),
|
span: sp(15,21),
|
||||||
})),
|
})),
|
||||||
vis: ast::Inherited,
|
vis: ast::Inherited,
|
||||||
|
|
|
@ -18,7 +18,7 @@ use ast::{Mod, Arg, Arm, Attribute, BindingMode};
|
||||||
use ast::Block;
|
use ast::Block;
|
||||||
use ast::{BlockCheckMode, CaptureByRef, CaptureByValue, CaptureClause};
|
use ast::{BlockCheckMode, CaptureByRef, CaptureByValue, CaptureClause};
|
||||||
use ast::{Constness, ConstTraitItem, Crate, CrateConfig};
|
use ast::{Constness, ConstTraitItem, Crate, CrateConfig};
|
||||||
use ast::{Decl, DeclItem, DeclLocal, DefaultBlock};
|
use ast::{Decl, DeclItem, DeclLocal};
|
||||||
use ast::{EMPTY_CTXT, EnumDef, ExplicitSelf};
|
use ast::{EMPTY_CTXT, EnumDef, ExplicitSelf};
|
||||||
use ast::{Expr, Expr_, ExprAddrOf, ExprMatch, ExprAgain};
|
use ast::{Expr, Expr_, ExprAddrOf, ExprMatch, ExprAgain};
|
||||||
use ast::{ExprAssign, ExprAssignOp, ExprBinary, ExprBlock, ExprBox};
|
use ast::{ExprAssign, ExprAssignOp, ExprBinary, ExprBlock, ExprBox};
|
||||||
|
@ -53,7 +53,7 @@ use ast::{TyFixedLengthVec, TyBareFn, TyTypeof, TyInfer};
|
||||||
use ast::{TyParam, TyParamBounds, TyParen, TyPath, TyPtr};
|
use ast::{TyParam, TyParamBounds, TyParen, TyPath, TyPtr};
|
||||||
use ast::{TyRptr, TyTup, TyU32, TyVec};
|
use ast::{TyRptr, TyTup, TyU32, TyVec};
|
||||||
use ast::TypeTraitItem;
|
use ast::TypeTraitItem;
|
||||||
use ast::{UnnamedField, UnsafeBlock};
|
use ast::UnnamedField;
|
||||||
use ast::{ViewPath, ViewPathGlob, ViewPathList, ViewPathSimple};
|
use ast::{ViewPath, ViewPathGlob, ViewPathList, ViewPathSimple};
|
||||||
use ast::{Visibility, WhereClause};
|
use ast::{Visibility, WhereClause};
|
||||||
use attr::{ThinAttributes, ThinAttributesExt, AttributesExt};
|
use attr::{ThinAttributes, ThinAttributesExt, AttributesExt};
|
||||||
|
@ -2104,7 +2104,7 @@ impl<'a> Parser<'a> {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
token::OpenDelim(token::Brace) => {
|
token::OpenDelim(token::Brace) => {
|
||||||
return self.parse_block_expr(lo, DefaultBlock, attrs);
|
return self.parse_block_expr(lo, BlockCheckMode::Default, attrs);
|
||||||
},
|
},
|
||||||
token::BinOp(token::Or) | token::OrOr => {
|
token::BinOp(token::Or) | token::OrOr => {
|
||||||
let lo = self.span.lo;
|
let lo = self.span.lo;
|
||||||
|
@ -2220,7 +2220,7 @@ impl<'a> Parser<'a> {
|
||||||
if self.eat_keyword(keywords::Unsafe) {
|
if self.eat_keyword(keywords::Unsafe) {
|
||||||
return self.parse_block_expr(
|
return self.parse_block_expr(
|
||||||
lo,
|
lo,
|
||||||
UnsafeBlock(ast::UserProvided),
|
BlockCheckMode::Unsafe(ast::UserProvided),
|
||||||
attrs);
|
attrs);
|
||||||
}
|
}
|
||||||
if self.eat_keyword(keywords::Return) {
|
if self.eat_keyword(keywords::Return) {
|
||||||
|
@ -3062,7 +3062,7 @@ impl<'a> Parser<'a> {
|
||||||
stmts: vec![],
|
stmts: vec![],
|
||||||
span: body_expr.span,
|
span: body_expr.span,
|
||||||
expr: Some(body_expr),
|
expr: Some(body_expr),
|
||||||
rules: DefaultBlock,
|
rules: BlockCheckMode::Default,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
|
@ -3826,7 +3826,7 @@ impl<'a> Parser<'a> {
|
||||||
"place this code inside a block"));
|
"place this code inside a block"));
|
||||||
}
|
}
|
||||||
|
|
||||||
self.parse_block_tail(lo, DefaultBlock)
|
self.parse_block_tail(lo, BlockCheckMode::Default)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Parse a block. Inner attrs are allowed.
|
/// Parse a block. Inner attrs are allowed.
|
||||||
|
@ -3836,7 +3836,7 @@ impl<'a> Parser<'a> {
|
||||||
let lo = self.span.lo;
|
let lo = self.span.lo;
|
||||||
try!(self.expect(&token::OpenDelim(token::Brace)));
|
try!(self.expect(&token::OpenDelim(token::Brace)));
|
||||||
Ok((try!(self.parse_inner_attributes()),
|
Ok((try!(self.parse_inner_attributes()),
|
||||||
try!(self.parse_block_tail(lo, DefaultBlock))))
|
try!(self.parse_block_tail(lo, BlockCheckMode::Default))))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Parse the rest of a block expression or function body
|
/// Parse the rest of a block expression or function body
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
pub use self::AnnNode::*;
|
pub use self::AnnNode::*;
|
||||||
|
|
||||||
use abi;
|
use abi;
|
||||||
use ast::{self, TokenTree};
|
use ast::{self, TokenTree, BlockCheckMode};
|
||||||
use ast::{RegionTyParamBound, TraitTyParamBound, TraitBoundModifier};
|
use ast::{RegionTyParamBound, TraitTyParamBound, TraitBoundModifier};
|
||||||
use ast::Attribute;
|
use ast::Attribute;
|
||||||
use attr::ThinAttributesExt;
|
use attr::ThinAttributesExt;
|
||||||
|
@ -1684,8 +1684,8 @@ impl<'a> State<'a> {
|
||||||
attrs: &[ast::Attribute],
|
attrs: &[ast::Attribute],
|
||||||
close_box: bool) -> io::Result<()> {
|
close_box: bool) -> io::Result<()> {
|
||||||
match blk.rules {
|
match blk.rules {
|
||||||
ast::UnsafeBlock(..) => try!(self.word_space("unsafe")),
|
BlockCheckMode::Unsafe(..) => try!(self.word_space("unsafe")),
|
||||||
ast::DefaultBlock => ()
|
BlockCheckMode::Default => ()
|
||||||
}
|
}
|
||||||
try!(self.maybe_print_comment(blk.span.lo));
|
try!(self.maybe_print_comment(blk.span.lo));
|
||||||
try!(self.ann.pre(self, NodeBlock(blk)));
|
try!(self.ann.pre(self, NodeBlock(blk)));
|
||||||
|
@ -2610,7 +2610,7 @@ impl<'a> State<'a> {
|
||||||
try!(self.print_block_unclosed_indent(&**blk, INDENT_UNIT));
|
try!(self.print_block_unclosed_indent(&**blk, INDENT_UNIT));
|
||||||
|
|
||||||
// If it is a user-provided unsafe block, print a comma after it
|
// If it is a user-provided unsafe block, print a comma after it
|
||||||
if let ast::UnsafeBlock(ast::UserProvided) = blk.rules {
|
if let BlockCheckMode::Unsafe(ast::UserProvided) = blk.rules {
|
||||||
try!(word(&mut self.s, ","));
|
try!(word(&mut self.s, ","));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1266,7 +1266,7 @@ impl<'a> MethodDef<'a> {
|
||||||
stmts: vec![],
|
stmts: vec![],
|
||||||
expr: Some(call),
|
expr: Some(call),
|
||||||
id: ast::DUMMY_NODE_ID,
|
id: ast::DUMMY_NODE_ID,
|
||||||
rules: ast::UnsafeBlock(ast::CompilerGenerated),
|
rules: ast::BlockCheckMode::Unsafe(ast::CompilerGenerated),
|
||||||
span: sp }));
|
span: sp }));
|
||||||
|
|
||||||
let target_ty = cx.ty_ident(sp, cx.ident_of(target_type_name));
|
let target_ty = cx.ty_ident(sp, cx.ident_of(target_type_name));
|
||||||
|
@ -1302,7 +1302,7 @@ impl<'a> MethodDef<'a> {
|
||||||
stmts: vec![],
|
stmts: vec![],
|
||||||
expr: Some(call),
|
expr: Some(call),
|
||||||
id: ast::DUMMY_NODE_ID,
|
id: ast::DUMMY_NODE_ID,
|
||||||
rules: ast::UnsafeBlock(ast::CompilerGenerated),
|
rules: ast::BlockCheckMode::Unsafe(ast::CompilerGenerated),
|
||||||
span: sp }));
|
span: sp }));
|
||||||
match_arms.push(cx.arm(sp, vec![cx.pat_wild(sp)], unreachable));
|
match_arms.push(cx.arm(sp, vec![cx.pat_wild(sp)], unreachable));
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue