From e38cb972dcfc0fdab44270257eac3405a39bd996 Mon Sep 17 00:00:00 2001 From: John Clements Date: Mon, 30 Jun 2014 18:02:14 -0700 Subject: Simplify PatIdent to contain an Ident rather than a Path Rationale: for what appear to be historical reasons only, the PatIdent contains a Path rather than an Ident. This means that there are many places in the code where an ident is artificially promoted to a path, and---much more problematically--- a bunch of elements from a path are simply thrown away, which seems like an invitation to some really nasty bugs. This commit replaces the Path in a PatIdent with a SpannedIdent, which just contains an ident and a span. --- src/libsyntax/ast.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/libsyntax/ast.rs') diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index 529b460adcd..237d0660a41 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -293,8 +293,8 @@ pub enum Pat_ { // In the nullary enum case, the parser can't determine // which it is. The resolver determines this, and // records this pattern's NodeId in an auxiliary - // set (of "pat_idents that refer to nullary enums") - PatIdent(BindingMode, Path, Option>), + // set (of "PatIdents that refer to nullary enums") + PatIdent(BindingMode, SpannedIdent, Option>), PatEnum(Path, Option>>), /* "none" means a * pattern where * we don't bind the fields to names */ PatStruct(Path, Vec, bool), @@ -818,7 +818,7 @@ pub struct Arg { impl Arg { pub fn new_self(span: Span, mutability: Mutability) -> Arg { - let path = ast_util::ident_to_path(span, special_idents::self_); + let path = Spanned{span:span,node:special_idents::self_}; Arg { // HACK(eddyb) fake type for the self argument. ty: P(Ty { -- cgit 1.4.1-3-g733a5