[breaking-change] don't glob export ast::Mutablity variants

This commit is contained in:
Oliver 'ker' Schneider
2016-02-09 17:44:47 +01:00
committed by Oliver Schneider
parent 14e09ad468
commit 73fa9b2da2
21 changed files with 87 additions and 73 deletions

View File

@@ -27,7 +27,7 @@ pub fn expand_deriving_debug(cx: &mut ExtCtxt,
{
// &mut ::std::fmt::Formatter
let fmtr = Ptr(Box::new(Literal(path_std!(cx, core::fmt::Formatter))),
Borrowed(None, ast::MutMutable));
Borrowed(None, ast::Mutability::Mutable));
let trait_def = TraitDef {
span: span,

View File

@@ -14,7 +14,7 @@ use deriving::generic::*;
use deriving::generic::ty::*;
use syntax::ast;
use syntax::ast::{MetaItem, Expr, MutMutable};
use syntax::ast::{MetaItem, Expr, Mutability};
use syntax::codemap::Span;
use syntax::ext::base::{ExtCtxt, Annotatable};
use syntax::ext::build::AstBuilder;
@@ -72,7 +72,7 @@ fn expand_deriving_decodable_imp(cx: &mut ExtCtxt,
},
explicit_self: None,
args: vec!(Ptr(Box::new(Literal(Path::new_local("__D"))),
Borrowed(None, MutMutable))),
Borrowed(None, Mutability::Mutable))),
ret_ty: Literal(Path::new_(
pathvec_std!(cx, core::result::Result),
None,

View File

@@ -91,7 +91,7 @@
use deriving::generic::*;
use deriving::generic::ty::*;
use syntax::ast::{MetaItem, Expr, ExprKind, MutMutable};
use syntax::ast::{MetaItem, Expr, ExprKind, Mutability};
use syntax::codemap::Span;
use syntax::ext::base::{ExtCtxt,Annotatable};
use syntax::ext::build::AstBuilder;
@@ -148,7 +148,7 @@ fn expand_deriving_encodable_imp(cx: &mut ExtCtxt,
},
explicit_self: borrowed_explicit_self(),
args: vec!(Ptr(Box::new(Literal(Path::new_local("__S"))),
Borrowed(None, MutMutable))),
Borrowed(None, Mutability::Mutable))),
ret_ty: Literal(Path::new_(
pathvec_std!(cx, core::result::Result),
None,

View File

@@ -864,7 +864,9 @@ impl<'a> MethodDef<'a> {
let self_arg = match explicit_self.node {
ast::SelfKind::Static => None,
// creating fresh self id
_ => Some(ast::Arg::new_self(trait_.span, ast::MutImmutable, special_idents::self_))
_ => Some(ast::Arg::new_self(trait_.span,
ast::Mutability::Immutable,
special_idents::self_))
};
let args = {
let args = arg_types.into_iter().map(|(name, ty)| {
@@ -942,7 +944,7 @@ impl<'a> MethodDef<'a> {
struct_def,
&format!("__self_{}",
i),
ast::MutImmutable);
ast::Mutability::Immutable);
patterns.push(pat);
raw_fields.push(ident_expr);
}
@@ -1135,11 +1137,12 @@ impl<'a> MethodDef<'a> {
let mut match_arms: Vec<ast::Arm> = variants.iter().enumerate()
.map(|(index, variant)| {
let mk_self_pat = |cx: &mut ExtCtxt, self_arg_name: &str| {
let (p, idents) = trait_.create_enum_variant_pattern(cx, type_ident,
&**variant,
self_arg_name,
ast::MutImmutable);
(cx.pat(sp, ast::PatRegion(p, ast::MutImmutable)), idents)
let (p, idents) = trait_.create_enum_variant_pattern(
cx, type_ident,
&**variant,
self_arg_name,
ast::Mutability::Immutable);
(cx.pat(sp, ast::PatRegion(p, ast::Mutability::Immutable)), idents)
};
// A single arm has form (&VariantK, &VariantK, ...) => BodyK

View File

@@ -98,7 +98,7 @@ pub enum Ty<'a> {
}
pub fn borrowed_ptrty<'r>() -> PtrTy<'r> {
Borrowed(None, ast::MutImmutable)
Borrowed(None, ast::Mutability::Immutable)
}
pub fn borrowed<'r>(ty: Box<Ty<'r>>) -> Ty<'r> {
Ptr(ty, borrowed_ptrty())

View File

@@ -11,7 +11,7 @@
use deriving::generic::*;
use deriving::generic::ty::*;
use syntax::ast::{MetaItem, Expr, MutMutable};
use syntax::ast::{MetaItem, Expr, Mutability};
use syntax::codemap::Span;
use syntax::ext::base::{ExtCtxt, Annotatable};
use syntax::ext::build::AstBuilder;
@@ -43,7 +43,7 @@ pub fn expand_deriving_hash(cx: &mut ExtCtxt,
vec![path_std!(cx, core::hash::Hasher)])],
},
explicit_self: borrowed_explicit_self(),
args: vec!(Ptr(Box::new(Literal(arg)), Borrowed(None, MutMutable))),
args: vec!(Ptr(Box::new(Literal(arg)), Borrowed(None, Mutability::Mutable))),
ret_ty: nil_ty(),
attributes: vec![],
is_unsafe: false,

View File

@@ -42,7 +42,7 @@ pub fn expand_option_env<'cx>(cx: &'cx mut ExtCtxt, sp: Span, tts: &[ast::TokenT
Some(cx.lifetime(sp,
cx.ident_of(
"'static").name)),
ast::MutImmutable)),
ast::Mutability::Immutable)),
Vec::new()))
}
Ok(s) => {

View File

@@ -450,10 +450,10 @@ impl<'a, 'b> Context<'a, 'b> {
let ty = ecx.ty_rptr(sp,
ecx.ty(sp, ast::TyKind::Vec(piece_ty)),
Some(ecx.lifetime(sp, special_idents::static_lifetime.name)),
ast::MutImmutable);
ast::Mutability::Immutable);
let slice = ecx.expr_vec_slice(sp, pieces);
// static instead of const to speed up codegen by not requiring this to be inlined
let st = ast::ItemKind::Static(ty, ast::MutImmutable, slice);
let st = ast::ItemKind::Static(ty, ast::Mutability::Immutable, slice);
let name = ecx.ident_of(name);
let item = ecx.item(sp, name, vec![], st);
@@ -480,7 +480,7 @@ impl<'a, 'b> Context<'a, 'b> {
self.fmtsp,
self.ecx.ty_ident(self.fmtsp, self.ecx.ident_of("str")),
Some(static_lifetime),
ast::MutImmutable);
ast::Mutability::Immutable);
let pieces = Context::static_array(self.ecx,
"__STATIC_FMTSTR",
piece_ty,