[breaking-change] don't glob export ast::ExplicitSelf_ variants
This commit is contained in:
parent
79fa657abc
commit
1c4d437158
8 changed files with 59 additions and 60 deletions
|
@ -408,17 +408,17 @@ pub fn lower_local(lctx: &LoweringContext, l: &Local) -> P<hir::Local> {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn lower_explicit_self_underscore(lctx: &LoweringContext,
|
pub fn lower_explicit_self_underscore(lctx: &LoweringContext,
|
||||||
es: &ExplicitSelf_)
|
es: &SelfKind)
|
||||||
-> hir::ExplicitSelf_ {
|
-> hir::ExplicitSelf_ {
|
||||||
match *es {
|
match *es {
|
||||||
SelfStatic => hir::SelfStatic,
|
SelfKind::Static => hir::SelfStatic,
|
||||||
SelfValue(v) => hir::SelfValue(v.name),
|
SelfKind::Value(v) => hir::SelfValue(v.name),
|
||||||
SelfRegion(ref lifetime, m, ident) => {
|
SelfKind::Region(ref lifetime, m, ident) => {
|
||||||
hir::SelfRegion(lower_opt_lifetime(lctx, lifetime),
|
hir::SelfRegion(lower_opt_lifetime(lctx, lifetime),
|
||||||
lower_mutability(lctx, m),
|
lower_mutability(lctx, m),
|
||||||
ident.name)
|
ident.name)
|
||||||
}
|
}
|
||||||
SelfExplicit(ref typ, ident) => {
|
SelfKind::Explicit(ref typ, ident) => {
|
||||||
hir::SelfExplicit(lower_ty(lctx, typ), ident.name)
|
hir::SelfExplicit(lower_ty(lctx, typ), ident.name)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,6 @@
|
||||||
|
|
||||||
// The Rust abstract syntax tree.
|
// The Rust abstract syntax tree.
|
||||||
|
|
||||||
pub use self::ExplicitSelf_::*;
|
|
||||||
pub use self::Expr_::*;
|
pub use self::Expr_::*;
|
||||||
pub use self::FloatTy::*;
|
pub use self::FloatTy::*;
|
||||||
pub use self::ForeignItem_::*;
|
pub use self::ForeignItem_::*;
|
||||||
|
@ -1747,18 +1746,18 @@ impl FunctionRetTy {
|
||||||
|
|
||||||
/// Represents the kind of 'self' associated with a method
|
/// Represents the kind of 'self' associated with a method
|
||||||
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)]
|
||||||
pub enum ExplicitSelf_ {
|
pub enum SelfKind {
|
||||||
/// No self
|
/// No self
|
||||||
SelfStatic,
|
Static,
|
||||||
/// `self`
|
/// `self`
|
||||||
SelfValue(Ident),
|
Value(Ident),
|
||||||
/// `&'lt self`, `&'lt mut self`
|
/// `&'lt self`, `&'lt mut self`
|
||||||
SelfRegion(Option<Lifetime>, Mutability, Ident),
|
Region(Option<Lifetime>, Mutability, Ident),
|
||||||
/// `self: TYPE`
|
/// `self: TYPE`
|
||||||
SelfExplicit(P<Ty>, Ident),
|
Explicit(P<Ty>, Ident),
|
||||||
}
|
}
|
||||||
|
|
||||||
pub type ExplicitSelf = Spanned<ExplicitSelf_>;
|
pub type ExplicitSelf = Spanned<SelfKind>;
|
||||||
|
|
||||||
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)]
|
||||||
pub struct Mod {
|
pub struct Mod {
|
||||||
|
|
|
@ -184,8 +184,8 @@ pub trait Folder : Sized {
|
||||||
noop_fold_explicit_self(es, self)
|
noop_fold_explicit_self(es, self)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn fold_explicit_self_underscore(&mut self, es: ExplicitSelf_) -> ExplicitSelf_ {
|
fn fold_explicit_self_kind(&mut self, es: SelfKind) -> SelfKind {
|
||||||
noop_fold_explicit_self_underscore(es, self)
|
noop_fold_explicit_self_kind(es, self)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn fold_lifetime(&mut self, l: Lifetime) -> Lifetime {
|
fn fold_lifetime(&mut self, l: Lifetime) -> Lifetime {
|
||||||
|
@ -520,15 +520,15 @@ pub fn noop_fold_attribute<T: Folder>(at: Attribute, fld: &mut T) -> Option<Attr
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn noop_fold_explicit_self_underscore<T: Folder>(es: ExplicitSelf_, fld: &mut T)
|
pub fn noop_fold_explicit_self_kind<T: Folder>(es: SelfKind, fld: &mut T)
|
||||||
-> ExplicitSelf_ {
|
-> SelfKind {
|
||||||
match es {
|
match es {
|
||||||
SelfStatic | SelfValue(_) => es,
|
SelfKind::Static | SelfKind::Value(_) => es,
|
||||||
SelfRegion(lifetime, m, ident) => {
|
SelfKind::Region(lifetime, m, ident) => {
|
||||||
SelfRegion(fld.fold_opt_lifetime(lifetime), m, ident)
|
SelfKind::Region(fld.fold_opt_lifetime(lifetime), m, ident)
|
||||||
}
|
}
|
||||||
SelfExplicit(typ, ident) => {
|
SelfKind::Explicit(typ, ident) => {
|
||||||
SelfExplicit(fld.fold_ty(typ), ident)
|
SelfKind::Explicit(fld.fold_ty(typ), ident)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -536,7 +536,7 @@ pub fn noop_fold_explicit_self_underscore<T: Folder>(es: ExplicitSelf_, fld: &mu
|
||||||
pub fn noop_fold_explicit_self<T: Folder>(Spanned {span, node}: ExplicitSelf, fld: &mut T)
|
pub fn noop_fold_explicit_self<T: Folder>(Spanned {span, node}: ExplicitSelf, fld: &mut T)
|
||||||
-> ExplicitSelf {
|
-> ExplicitSelf {
|
||||||
Spanned {
|
Spanned {
|
||||||
node: fld.fold_explicit_self_underscore(node),
|
node: fld.fold_explicit_self_kind(node),
|
||||||
span: fld.new_span(span)
|
span: fld.new_span(span)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,7 +46,7 @@ use ast::{PolyTraitRef, QSelf};
|
||||||
use ast::{Stmt, StmtDecl};
|
use ast::{Stmt, StmtDecl};
|
||||||
use ast::{StmtExpr, StmtSemi, StmtMac, VariantData, StructField};
|
use ast::{StmtExpr, StmtSemi, StmtMac, VariantData, StructField};
|
||||||
use ast::StrStyle;
|
use ast::StrStyle;
|
||||||
use ast::{SelfExplicit, SelfRegion, SelfStatic, SelfValue};
|
use ast::SelfKind;
|
||||||
use ast::{Delimited, SequenceRepetition, TokenTree, TraitItem, TraitRef};
|
use ast::{Delimited, SequenceRepetition, TokenTree, TraitItem, TraitRef};
|
||||||
use ast::{Ty, Ty_, TypeBinding, TyMac};
|
use ast::{Ty, Ty_, TypeBinding, TyMac};
|
||||||
use ast::{TyFixedLengthVec, TyBareFn, TyTypeof, TyInfer};
|
use ast::{TyFixedLengthVec, TyBareFn, TyTypeof, TyInfer};
|
||||||
|
@ -4411,7 +4411,7 @@ impl<'a> Parser<'a> {
|
||||||
F: FnMut(&mut Parser<'a>) -> PResult<'a, Arg>,
|
F: FnMut(&mut Parser<'a>) -> PResult<'a, Arg>,
|
||||||
{
|
{
|
||||||
fn maybe_parse_borrowed_explicit_self<'b>(this: &mut Parser<'b>)
|
fn maybe_parse_borrowed_explicit_self<'b>(this: &mut Parser<'b>)
|
||||||
-> PResult<'b, ast::ExplicitSelf_> {
|
-> PResult<'b, ast::SelfKind> {
|
||||||
// The following things are possible to see here:
|
// The following things are possible to see here:
|
||||||
//
|
//
|
||||||
// fn(&mut self)
|
// fn(&mut self)
|
||||||
|
@ -4423,26 +4423,26 @@ impl<'a> Parser<'a> {
|
||||||
|
|
||||||
if this.look_ahead(1, |t| t.is_keyword(keywords::SelfValue)) {
|
if this.look_ahead(1, |t| t.is_keyword(keywords::SelfValue)) {
|
||||||
this.bump();
|
this.bump();
|
||||||
Ok(SelfRegion(None, MutImmutable, try!(this.expect_self_ident())))
|
Ok(SelfKind::Region(None, MutImmutable, try!(this.expect_self_ident())))
|
||||||
} else if this.look_ahead(1, |t| t.is_mutability()) &&
|
} else if this.look_ahead(1, |t| t.is_mutability()) &&
|
||||||
this.look_ahead(2, |t| t.is_keyword(keywords::SelfValue)) {
|
this.look_ahead(2, |t| t.is_keyword(keywords::SelfValue)) {
|
||||||
this.bump();
|
this.bump();
|
||||||
let mutability = try!(this.parse_mutability());
|
let mutability = try!(this.parse_mutability());
|
||||||
Ok(SelfRegion(None, mutability, try!(this.expect_self_ident())))
|
Ok(SelfKind::Region(None, mutability, try!(this.expect_self_ident())))
|
||||||
} else if this.look_ahead(1, |t| t.is_lifetime()) &&
|
} else if this.look_ahead(1, |t| t.is_lifetime()) &&
|
||||||
this.look_ahead(2, |t| t.is_keyword(keywords::SelfValue)) {
|
this.look_ahead(2, |t| t.is_keyword(keywords::SelfValue)) {
|
||||||
this.bump();
|
this.bump();
|
||||||
let lifetime = try!(this.parse_lifetime());
|
let lifetime = try!(this.parse_lifetime());
|
||||||
Ok(SelfRegion(Some(lifetime), MutImmutable, try!(this.expect_self_ident())))
|
Ok(SelfKind::Region(Some(lifetime), MutImmutable, try!(this.expect_self_ident())))
|
||||||
} else if this.look_ahead(1, |t| t.is_lifetime()) &&
|
} else if this.look_ahead(1, |t| t.is_lifetime()) &&
|
||||||
this.look_ahead(2, |t| t.is_mutability()) &&
|
this.look_ahead(2, |t| t.is_mutability()) &&
|
||||||
this.look_ahead(3, |t| t.is_keyword(keywords::SelfValue)) {
|
this.look_ahead(3, |t| t.is_keyword(keywords::SelfValue)) {
|
||||||
this.bump();
|
this.bump();
|
||||||
let lifetime = try!(this.parse_lifetime());
|
let lifetime = try!(this.parse_lifetime());
|
||||||
let mutability = try!(this.parse_mutability());
|
let mutability = try!(this.parse_mutability());
|
||||||
Ok(SelfRegion(Some(lifetime), mutability, try!(this.expect_self_ident())))
|
Ok(SelfKind::Region(Some(lifetime), mutability, try!(this.expect_self_ident())))
|
||||||
} else {
|
} else {
|
||||||
Ok(SelfStatic)
|
Ok(SelfKind::Static)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4477,7 +4477,7 @@ impl<'a> Parser<'a> {
|
||||||
self.bump();
|
self.bump();
|
||||||
}
|
}
|
||||||
// error case, making bogus self ident:
|
// error case, making bogus self ident:
|
||||||
SelfValue(special_idents::self_)
|
SelfKind::Value(special_idents::self_)
|
||||||
}
|
}
|
||||||
token::Ident(..) => {
|
token::Ident(..) => {
|
||||||
if self.is_self_ident() {
|
if self.is_self_ident() {
|
||||||
|
@ -4486,9 +4486,9 @@ impl<'a> Parser<'a> {
|
||||||
// Determine whether this is the fully explicit form, `self:
|
// Determine whether this is the fully explicit form, `self:
|
||||||
// TYPE`.
|
// TYPE`.
|
||||||
if self.eat(&token::Colon) {
|
if self.eat(&token::Colon) {
|
||||||
SelfExplicit(try!(self.parse_ty_sum()), self_ident)
|
SelfKind::Explicit(try!(self.parse_ty_sum()), self_ident)
|
||||||
} else {
|
} else {
|
||||||
SelfValue(self_ident)
|
SelfKind::Value(self_ident)
|
||||||
}
|
}
|
||||||
} else if self.token.is_mutability() &&
|
} else if self.token.is_mutability() &&
|
||||||
self.look_ahead(1, |t| t.is_keyword(keywords::SelfValue)) {
|
self.look_ahead(1, |t| t.is_keyword(keywords::SelfValue)) {
|
||||||
|
@ -4498,15 +4498,15 @@ impl<'a> Parser<'a> {
|
||||||
// Determine whether this is the fully explicit form,
|
// Determine whether this is the fully explicit form,
|
||||||
// `self: TYPE`.
|
// `self: TYPE`.
|
||||||
if self.eat(&token::Colon) {
|
if self.eat(&token::Colon) {
|
||||||
SelfExplicit(try!(self.parse_ty_sum()), self_ident)
|
SelfKind::Explicit(try!(self.parse_ty_sum()), self_ident)
|
||||||
} else {
|
} else {
|
||||||
SelfValue(self_ident)
|
SelfKind::Value(self_ident)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
SelfStatic
|
SelfKind::Static
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_ => SelfStatic,
|
_ => SelfKind::Static,
|
||||||
};
|
};
|
||||||
|
|
||||||
let explicit_self_sp = mk_sp(self_ident_lo, self_ident_hi);
|
let explicit_self_sp = mk_sp(self_ident_lo, self_ident_hi);
|
||||||
|
@ -4542,14 +4542,14 @@ impl<'a> Parser<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
let fn_inputs = match explicit_self {
|
let fn_inputs = match explicit_self {
|
||||||
SelfStatic => {
|
SelfKind::Static => {
|
||||||
let sep = seq_sep_trailing_allowed(token::Comma);
|
let sep = seq_sep_trailing_allowed(token::Comma);
|
||||||
try!(self.parse_seq_to_before_end(&token::CloseDelim(token::Paren),
|
try!(self.parse_seq_to_before_end(&token::CloseDelim(token::Paren),
|
||||||
sep, parse_arg_fn))
|
sep, parse_arg_fn))
|
||||||
}
|
}
|
||||||
SelfValue(id) => parse_remaining_arguments!(id),
|
SelfKind::Value(id) => parse_remaining_arguments!(id),
|
||||||
SelfRegion(_,_,id) => parse_remaining_arguments!(id),
|
SelfKind::Region(_,_,id) => parse_remaining_arguments!(id),
|
||||||
SelfExplicit(_,id) => parse_remaining_arguments!(id),
|
SelfKind::Explicit(_,id) => parse_remaining_arguments!(id),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -382,7 +382,7 @@ pub fn fun_to_string(decl: &ast::FnDecl,
|
||||||
unsafety: ast::Unsafety,
|
unsafety: ast::Unsafety,
|
||||||
constness: ast::Constness,
|
constness: ast::Constness,
|
||||||
name: ast::Ident,
|
name: ast::Ident,
|
||||||
opt_explicit_self: Option<&ast::ExplicitSelf_>,
|
opt_explicit_self: Option<&ast::SelfKind>,
|
||||||
generics: &ast::Generics)
|
generics: &ast::Generics)
|
||||||
-> String {
|
-> String {
|
||||||
to_string(|s| {
|
to_string(|s| {
|
||||||
|
@ -416,7 +416,7 @@ pub fn lit_to_string(l: &ast::Lit) -> String {
|
||||||
to_string(|s| s.print_literal(l))
|
to_string(|s| s.print_literal(l))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn explicit_self_to_string(explicit_self: &ast::ExplicitSelf_) -> String {
|
pub fn explicit_self_to_string(explicit_self: &ast::SelfKind) -> String {
|
||||||
to_string(|s| s.print_explicit_self(explicit_self, ast::MutImmutable).map(|_| {}))
|
to_string(|s| s.print_explicit_self(explicit_self, ast::MutImmutable).map(|_| {}))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2625,21 +2625,21 @@ impl<'a> State<'a> {
|
||||||
|
|
||||||
// Returns whether it printed anything
|
// Returns whether it printed anything
|
||||||
fn print_explicit_self(&mut self,
|
fn print_explicit_self(&mut self,
|
||||||
explicit_self: &ast::ExplicitSelf_,
|
explicit_self: &ast::SelfKind,
|
||||||
mutbl: ast::Mutability) -> io::Result<bool> {
|
mutbl: ast::Mutability) -> io::Result<bool> {
|
||||||
try!(self.print_mutability(mutbl));
|
try!(self.print_mutability(mutbl));
|
||||||
match *explicit_self {
|
match *explicit_self {
|
||||||
ast::SelfStatic => { return Ok(false); }
|
ast::SelfKind::Static => { return Ok(false); }
|
||||||
ast::SelfValue(_) => {
|
ast::SelfKind::Value(_) => {
|
||||||
try!(word(&mut self.s, "self"));
|
try!(word(&mut self.s, "self"));
|
||||||
}
|
}
|
||||||
ast::SelfRegion(ref lt, m, _) => {
|
ast::SelfKind::Region(ref lt, m, _) => {
|
||||||
try!(word(&mut self.s, "&"));
|
try!(word(&mut self.s, "&"));
|
||||||
try!(self.print_opt_lifetime(lt));
|
try!(self.print_opt_lifetime(lt));
|
||||||
try!(self.print_mutability(m));
|
try!(self.print_mutability(m));
|
||||||
try!(word(&mut self.s, "self"));
|
try!(word(&mut self.s, "self"));
|
||||||
}
|
}
|
||||||
ast::SelfExplicit(ref typ, _) => {
|
ast::SelfKind::Explicit(ref typ, _) => {
|
||||||
try!(word(&mut self.s, "self"));
|
try!(word(&mut self.s, "self"));
|
||||||
try!(self.word_space(":"));
|
try!(self.word_space(":"));
|
||||||
try!(self.print_type(&**typ));
|
try!(self.print_type(&**typ));
|
||||||
|
@ -2655,7 +2655,7 @@ impl<'a> State<'a> {
|
||||||
abi: abi::Abi,
|
abi: abi::Abi,
|
||||||
name: Option<ast::Ident>,
|
name: Option<ast::Ident>,
|
||||||
generics: &ast::Generics,
|
generics: &ast::Generics,
|
||||||
opt_explicit_self: Option<&ast::ExplicitSelf_>,
|
opt_explicit_self: Option<&ast::SelfKind>,
|
||||||
vis: ast::Visibility) -> io::Result<()> {
|
vis: ast::Visibility) -> io::Result<()> {
|
||||||
try!(self.print_fn_header_info(unsafety, constness, abi, vis));
|
try!(self.print_fn_header_info(unsafety, constness, abi, vis));
|
||||||
|
|
||||||
|
@ -2669,7 +2669,7 @@ impl<'a> State<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn print_fn_args(&mut self, decl: &ast::FnDecl,
|
pub fn print_fn_args(&mut self, decl: &ast::FnDecl,
|
||||||
opt_explicit_self: Option<&ast::ExplicitSelf_>,
|
opt_explicit_self: Option<&ast::SelfKind>,
|
||||||
is_closure: bool) -> io::Result<()> {
|
is_closure: bool) -> io::Result<()> {
|
||||||
// It is unfortunate to duplicate the commasep logic, but we want the
|
// It is unfortunate to duplicate the commasep logic, but we want the
|
||||||
// self type and the args all in the same box.
|
// self type and the args all in the same box.
|
||||||
|
@ -2677,7 +2677,7 @@ impl<'a> State<'a> {
|
||||||
let mut first = true;
|
let mut first = true;
|
||||||
if let Some(explicit_self) = opt_explicit_self {
|
if let Some(explicit_self) = opt_explicit_self {
|
||||||
let m = match *explicit_self {
|
let m = match *explicit_self {
|
||||||
ast::SelfStatic => ast::MutImmutable,
|
ast::SelfKind::Static => ast::MutImmutable,
|
||||||
_ => match decl.inputs[0].pat.node {
|
_ => match decl.inputs[0].pat.node {
|
||||||
ast::PatIdent(ast::BindingMode::ByValue(m), _, _) => m,
|
ast::PatIdent(ast::BindingMode::ByValue(m), _, _) => m,
|
||||||
_ => ast::MutImmutable
|
_ => ast::MutImmutable
|
||||||
|
@ -2702,7 +2702,7 @@ impl<'a> State<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn print_fn_args_and_ret(&mut self, decl: &ast::FnDecl,
|
pub fn print_fn_args_and_ret(&mut self, decl: &ast::FnDecl,
|
||||||
opt_explicit_self: Option<&ast::ExplicitSelf_>)
|
opt_explicit_self: Option<&ast::SelfKind>)
|
||||||
-> io::Result<()> {
|
-> io::Result<()> {
|
||||||
try!(self.popen());
|
try!(self.popen());
|
||||||
try!(self.print_fn_args(decl, opt_explicit_self, false));
|
try!(self.print_fn_args(decl, opt_explicit_self, false));
|
||||||
|
@ -3016,7 +3016,7 @@ impl<'a> State<'a> {
|
||||||
decl: &ast::FnDecl,
|
decl: &ast::FnDecl,
|
||||||
name: Option<ast::Ident>,
|
name: Option<ast::Ident>,
|
||||||
generics: &ast::Generics,
|
generics: &ast::Generics,
|
||||||
opt_explicit_self: Option<&ast::ExplicitSelf_>)
|
opt_explicit_self: Option<&ast::SelfKind>)
|
||||||
-> io::Result<()> {
|
-> io::Result<()> {
|
||||||
try!(self.ibox(INDENT_UNIT));
|
try!(self.ibox(INDENT_UNIT));
|
||||||
if !generics.lifetimes.is_empty() || !generics.ty_params.is_empty() {
|
if !generics.lifetimes.is_empty() || !generics.ty_params.is_empty() {
|
||||||
|
|
|
@ -196,15 +196,15 @@ pub fn walk_lifetime_def<'v, V: Visitor<'v>>(visitor: &mut V,
|
||||||
pub fn walk_explicit_self<'v, V: Visitor<'v>>(visitor: &mut V,
|
pub fn walk_explicit_self<'v, V: Visitor<'v>>(visitor: &mut V,
|
||||||
explicit_self: &'v ExplicitSelf) {
|
explicit_self: &'v ExplicitSelf) {
|
||||||
match explicit_self.node {
|
match explicit_self.node {
|
||||||
SelfStatic => {},
|
SelfKind::Static => {},
|
||||||
SelfValue(ident) => {
|
SelfKind::Value(ident) => {
|
||||||
visitor.visit_ident(explicit_self.span, ident)
|
visitor.visit_ident(explicit_self.span, ident)
|
||||||
}
|
}
|
||||||
SelfRegion(ref opt_lifetime, _, ident) => {
|
SelfKind::Region(ref opt_lifetime, _, ident) => {
|
||||||
visitor.visit_ident(explicit_self.span, ident);
|
visitor.visit_ident(explicit_self.span, ident);
|
||||||
walk_list!(visitor, visit_lifetime, opt_lifetime);
|
walk_list!(visitor, visit_lifetime, opt_lifetime);
|
||||||
}
|
}
|
||||||
SelfExplicit(ref typ, ident) => {
|
SelfKind::Explicit(ref typ, ident) => {
|
||||||
visitor.visit_ident(explicit_self.span, ident);
|
visitor.visit_ident(explicit_self.span, ident);
|
||||||
visitor.visit_ty(typ)
|
visitor.visit_ty(typ)
|
||||||
}
|
}
|
||||||
|
|
|
@ -821,7 +821,7 @@ impl<'a> MethodDef<'a> {
|
||||||
|
|
||||||
explicit_self
|
explicit_self
|
||||||
}
|
}
|
||||||
None => codemap::respan(trait_.span, ast::SelfStatic),
|
None => codemap::respan(trait_.span, ast::SelfKind::Static),
|
||||||
};
|
};
|
||||||
|
|
||||||
for (i, ty) in self.args.iter().enumerate() {
|
for (i, ty) in self.args.iter().enumerate() {
|
||||||
|
@ -862,7 +862,7 @@ impl<'a> MethodDef<'a> {
|
||||||
let fn_generics = self.generics.to_generics(cx, trait_.span, type_ident, generics);
|
let fn_generics = self.generics.to_generics(cx, trait_.span, type_ident, generics);
|
||||||
|
|
||||||
let self_arg = match explicit_self.node {
|
let self_arg = match explicit_self.node {
|
||||||
ast::SelfStatic => None,
|
ast::SelfKind::Static => None,
|
||||||
// creating fresh self id
|
// creating fresh self id
|
||||||
_ => Some(ast::Arg::new_self(trait_.span, ast::MutImmutable, special_idents::self_))
|
_ => Some(ast::Arg::new_self(trait_.span, ast::MutImmutable, special_idents::self_))
|
||||||
};
|
};
|
||||||
|
|
|
@ -264,7 +264,7 @@ pub fn get_explicit_self(cx: &ExtCtxt, span: Span, self_ptr: &Option<PtrTy>)
|
||||||
let self_path = cx.expr_self(span);
|
let self_path = cx.expr_self(span);
|
||||||
match *self_ptr {
|
match *self_ptr {
|
||||||
None => {
|
None => {
|
||||||
(self_path, respan(span, ast::SelfValue(special_idents::self_)))
|
(self_path, respan(span, ast::SelfKind::Value(special_idents::self_)))
|
||||||
}
|
}
|
||||||
Some(ref ptr) => {
|
Some(ref ptr) => {
|
||||||
let self_ty = respan(
|
let self_ty = respan(
|
||||||
|
@ -272,7 +272,7 @@ pub fn get_explicit_self(cx: &ExtCtxt, span: Span, self_ptr: &Option<PtrTy>)
|
||||||
match *ptr {
|
match *ptr {
|
||||||
Borrowed(ref lt, mutbl) => {
|
Borrowed(ref lt, mutbl) => {
|
||||||
let lt = lt.map(|s| cx.lifetime(span, cx.ident_of(s).name));
|
let lt = lt.map(|s| cx.lifetime(span, cx.ident_of(s).name));
|
||||||
ast::SelfRegion(lt, mutbl, special_idents::self_)
|
ast::SelfKind::Region(lt, mutbl, special_idents::self_)
|
||||||
}
|
}
|
||||||
Raw(_) => cx.span_bug(span, "attempted to use *self in deriving definition")
|
Raw(_) => cx.span_bug(span, "attempted to use *self in deriving definition")
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue