Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Miscellaneous cleanup #5709

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/librustc/front/core_inject.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ fn inject_libcore_ref(sess: Session,
fold_mod: |module, fld| {
let n2 = sess.next_node_id();

let prelude_path = @ast::path {
let prelude_path = @ast::Path {
span: dummy_sp(),
global: false,
idents: ~[
Expand Down
8 changes: 4 additions & 4 deletions src/librustc/front/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -336,16 +336,16 @@ fn nospan<T:Copy>(t: T) -> codemap::spanned<T> {
codemap::spanned { node: t, span: dummy_sp() }
}

fn path_node(+ids: ~[ast::ident]) -> @ast::path {
@ast::path { span: dummy_sp(),
fn path_node(+ids: ~[ast::ident]) -> @ast::Path {
@ast::Path { span: dummy_sp(),
global: false,
idents: ids,
rp: None,
types: ~[] }
}

fn path_node_global(+ids: ~[ast::ident]) -> @ast::path {
@ast::path { span: dummy_sp(),
fn path_node_global(+ids: ~[ast::ident]) -> @ast::Path {
@ast::Path { span: dummy_sp(),
global: true,
idents: ids,
rp: None,
Expand Down
4 changes: 2 additions & 2 deletions src/librustc/metadata/tydecode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ pub fn parse_arg_data(data: @~[u8], crate_num: int, pos: uint, tcx: ty::ctxt,
parse_arg(st, conv)
}

fn parse_path(st: @mut PState) -> @ast::path {
fn parse_path(st: @mut PState) -> @ast::Path {
let mut idents: ~[ast::ident] = ~[];
fn is_last(c: char) -> bool { return c == '(' || c == ':'; }
idents.push(parse_ident_(st, is_last));
Expand All @@ -146,7 +146,7 @@ fn parse_path(st: @mut PState) -> @ast::path {
':' => { next(st); next(st); }
c => {
if c == '(' {
return @ast::path { span: dummy_sp(),
return @ast::Path { span: dummy_sp(),
global: false,
idents: idents,
rp: None,
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/middle/pat_util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ pub fn pat_is_binding_or_wild(dm: resolve::DefMap, pat: @pat) -> bool {
}

pub fn pat_bindings(dm: resolve::DefMap, pat: @pat,
it: &fn(binding_mode, node_id, span, @path)) {
it: &fn(binding_mode, node_id, span, @Path)) {
do walk_pat(pat) |p| {
match p.node {
pat_ident(binding_mode, pth, _) if pat_is_binding(dm, p) => {
Expand Down
4 changes: 2 additions & 2 deletions src/librustc/middle/privacy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ use syntax::ast::{decl_item, def, def_fn, def_id, def_static_method};
use syntax::ast::{def_variant, expr_field, expr_method_call, expr_path};
use syntax::ast::{expr_struct, expr_unary, ident, inherited, item_enum};
use syntax::ast::{item_foreign_mod, item_fn, item_impl, item_struct};
use syntax::ast::{item_trait, local_crate, node_id, pat_struct, path};
use syntax::ast::{item_trait, local_crate, node_id, pat_struct, Path};
use syntax::ast::{private, provided, public, required, stmt_decl, visibility};
use syntax::ast;
use syntax::ast_map::{node_foreign_item, node_item, node_method};
Expand Down Expand Up @@ -276,7 +276,7 @@ pub fn check_crate(tcx: ty::ctxt,
};

// Checks that a private path is in scope.
let check_path: @fn(span: span, def: def, path: @path) =
let check_path: @fn(span: span, def: def, path: @Path) =
|span, def, path| {
debug!("checking path");
match def {
Expand Down
10 changes: 5 additions & 5 deletions src/librustc/middle/resolve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ use syntax::ast::{item_const, item_enum, item_fn, item_foreign_mod};
use syntax::ast::{item_impl, item_mac, item_mod, item_trait, item_ty, le};
use syntax::ast::{local, local_crate, lt, method, mode, mul};
use syntax::ast::{named_field, ne, neg, node_id, pat, pat_enum, pat_ident};
use syntax::ast::{path, pat_lit, pat_range, pat_struct};
use syntax::ast::{Path, pat_lit, pat_range, pat_struct};
use syntax::ast::{prim_ty, private, provided};
use syntax::ast::{public, required, rem, self_ty_, shl, shr, stmt_decl};
use syntax::ast::{struct_dtor, struct_field, struct_variant_kind};
Expand Down Expand Up @@ -4368,7 +4368,7 @@ pub impl Resolver {
/// If `check_ribs` is true, checks the local definitions first; i.e.
/// doesn't skip straight to the containing module.
fn resolve_path(@mut self,
path: @path,
path: @Path,
namespace: Namespace,
check_ribs: bool,
visitor: ResolveVisitor)
Expand Down Expand Up @@ -4493,7 +4493,7 @@ pub impl Resolver {
return NoNameDefinition;
}

fn intern_module_part_of_path(@mut self, path: @path) -> ~[ident] {
fn intern_module_part_of_path(@mut self, path: @Path) -> ~[ident] {
let mut module_path_idents = ~[];
for path.idents.eachi |index, ident| {
if index == path.idents.len() - 1 {
Expand All @@ -4507,7 +4507,7 @@ pub impl Resolver {
}

fn resolve_module_relative_path(@mut self,
path: @path,
path: @Path,
+xray: XrayFlag,
namespace: Namespace)
-> Option<def> {
Expand Down Expand Up @@ -4553,7 +4553,7 @@ pub impl Resolver {
/// Invariant: This must be called only during main resolution, not during
/// import resolution.
fn resolve_crate_relative_path(@mut self,
path: @path,
path: @Path,
+xray: XrayFlag,
namespace: Namespace)
-> Option<def> {
Expand Down
10 changes: 5 additions & 5 deletions src/librustc/middle/typeck/astconv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ fn ast_path_substs<AC:AstConv,RS:region_scope + Copy + Durable>(
def_id: ast::def_id,
decl_generics: &ty::Generics,
self_ty: Option<ty::t>,
path: @ast::path) -> ty::substs
path: @ast::Path) -> ty::substs
{
/*!
*
Expand Down Expand Up @@ -188,7 +188,7 @@ pub fn ast_path_to_substs_and_ty<AC:AstConv,RS:region_scope + Copy + Durable>(
self: &AC,
rscope: &RS,
did: ast::def_id,
path: @ast::path) -> ty_param_substs_and_ty
path: @ast::Path) -> ty_param_substs_and_ty
{
let tcx = self.tcx();
let ty::ty_param_bounds_and_ty {
Expand All @@ -206,7 +206,7 @@ pub fn ast_path_to_trait_ref<AC:AstConv,RS:region_scope + Copy + Durable>(
rscope: &RS,
trait_def_id: ast::def_id,
self_ty: Option<ty::t>,
path: @ast::path) -> @ty::TraitRef
path: @ast::Path) -> @ty::TraitRef
{
let trait_def =
self.get_trait_def(trait_def_id);
Expand All @@ -229,7 +229,7 @@ pub fn ast_path_to_ty<AC:AstConv,RS:region_scope + Copy + Durable>(
self: &AC,
rscope: &RS,
did: ast::def_id,
path: @ast::path)
path: @ast::Path)
-> ty_param_substs_and_ty
{
// Look up the polytype of the item and then substitute the provided types
Expand Down Expand Up @@ -318,7 +318,7 @@ pub fn ast_ty_to_ty<AC:AstConv, RS:region_scope + Copy + Durable>(
}

fn check_path_args(tcx: ty::ctxt,
path: @ast::path,
path: @ast::Path,
flags: uint) {
if (flags & NO_TPS) != 0u {
if path.types.len() > 0u {
Expand Down
8 changes: 4 additions & 4 deletions src/librustc/middle/typeck/check/_match.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ pub struct pat_ctxt {
block_region: ty::Region, // Region for the block of the arm
}

pub fn check_pat_variant(pcx: pat_ctxt, pat: @ast::pat, path: @ast::path,
pub fn check_pat_variant(pcx: pat_ctxt, pat: @ast::pat, path: @ast::Path,
subpats: &Option<~[@ast::pat]>, expected: ty::t) {

// Typecheck the path.
Expand Down Expand Up @@ -234,7 +234,7 @@ pub fn check_pat_variant(pcx: pat_ctxt, pat: @ast::pat, path: @ast::path,
/// `etc` is true if the pattern said '...' and false otherwise.
pub fn check_struct_pat_fields(pcx: pat_ctxt,
span: span,
path: @ast::path,
path: @ast::Path,
fields: &[ast::field_pat],
class_fields: ~[ty::field_ty],
class_id: ast::def_id,
Expand Down Expand Up @@ -285,7 +285,7 @@ pub fn check_struct_pat_fields(pcx: pat_ctxt,
}

pub fn check_struct_pat(pcx: pat_ctxt, pat_id: ast::node_id, span: span,
expected: ty::t, path: @ast::path,
expected: ty::t, path: @ast::Path,
fields: &[ast::field_pat], etc: bool,
class_id: ast::def_id, substitutions: &ty::substs) {
let fcx = pcx.fcx;
Expand Down Expand Up @@ -326,7 +326,7 @@ pub fn check_struct_like_enum_variant_pat(pcx: pat_ctxt,
pat_id: ast::node_id,
span: span,
expected: ty::t,
path: @ast::path,
path: @ast::Path,
fields: &[ast::field_pat],
etc: bool,
enum_id: ast::def_id,
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/middle/typeck/check/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3211,7 +3211,7 @@ pub fn ty_param_bounds_and_ty_for_def(fcx: @mut FnCtxt,
// Instantiates the given path, which must refer to an item with the given
// number of type parameters and type.
pub fn instantiate_path(fcx: @mut FnCtxt,
pth: @ast::path,
pth: @ast::Path,
tpt: ty_param_bounds_and_ty,
span: span,
node_id: ast::node_id,
Expand Down
24 changes: 12 additions & 12 deletions src/libsyntax/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ pub struct Lifetime {
#[auto_encode]
#[auto_decode]
#[deriving(Eq)]
pub struct path {
pub struct Path {
span: span,
global: bool,
idents: ~[ident],
Expand Down Expand Up @@ -301,10 +301,10 @@ pub enum pat_ {
// which it is. The resolver determines this, and
// records this pattern's node_id in an auxiliary
// set (of "pat_idents that refer to nullary enums")
pat_ident(binding_mode, @path, Option<@pat>),
pat_enum(@path, Option<~[@pat]>), /* "none" means a * pattern where
pat_ident(binding_mode, @Path, Option<@pat>),
pat_enum(@Path, Option<~[@pat]>), /* "none" means a * pattern where
* we don't bind the fields to names */
pat_struct(@path, ~[field_pat], bool),
pat_struct(@Path, ~[field_pat], bool),
pat_tup(~[@pat]),
pat_box(@pat),
pat_uniq(@pat),
Expand Down Expand Up @@ -567,7 +567,7 @@ pub enum expr_ {
expr_assign_op(binop, @expr, @expr),
expr_field(@expr, ident, ~[@Ty]),
expr_index(@expr, @expr),
expr_path(@path),
expr_path(@Path),
expr_addr_of(mutability, @expr),
expr_break(Option<ident>),
expr_again(Option<ident>),
Expand All @@ -579,7 +579,7 @@ pub enum expr_ {
expr_mac(mac),

// A struct literal expression.
expr_struct(@path, ~[field], Option<@expr>),
expr_struct(@Path, ~[field], Option<@expr>),

// A vector literal constructed from one repeated element.
expr_repeat(@expr /* element */, @expr /* count */, mutability),
Expand Down Expand Up @@ -697,7 +697,7 @@ pub type mac = spanned<mac_>;
#[auto_decode]
#[deriving(Eq)]
pub enum mac_ {
mac_invoc_tt(@path,~[token_tree]), // new macro-invocation
mac_invoc_tt(@Path,~[token_tree]), // new macro-invocation
}

pub type lit = spanned<lit_>;
Expand Down Expand Up @@ -894,7 +894,7 @@ pub enum ty_ {
ty_closure(@TyClosure),
ty_bare_fn(@TyBareFn),
ty_tup(~[@Ty]),
ty_path(@path, node_id),
ty_path(@Path, node_id),
ty_mac(mac),
// ty_infer means the type should be inferred instead of it having been
// specified. This should only appear at the "top level" of a type and not
Expand Down Expand Up @@ -1118,13 +1118,13 @@ pub enum view_path_ {
// or just
//
// foo::bar::baz (with 'baz =' implicitly on the left)
view_path_simple(ident, @path, namespace, node_id),
view_path_simple(ident, @Path, namespace, node_id),

// foo::bar::*
view_path_glob(@path, node_id),
view_path_glob(@Path, node_id),

// foo::bar::{a,b,c}
view_path_list(@path, ~[path_list_ident], node_id)
view_path_list(@Path, ~[path_list_ident], node_id)
}

#[auto_encode]
Expand Down Expand Up @@ -1177,7 +1177,7 @@ pub struct attribute_ {
#[auto_decode]
#[deriving(Eq)]
pub struct trait_ref {
path: @path,
path: @Path,
ref_id: node_id,
}

Expand Down
6 changes: 3 additions & 3 deletions src/libsyntax/ast_util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ pub fn path_name_i(idents: &[ident], intr: @token::ident_interner) -> ~str {
}


pub fn path_to_ident(p: @path) -> ident { copy *p.idents.last() }
pub fn path_to_ident(p: @Path) -> ident { copy *p.idents.last() }

pub fn local_def(id: node_id) -> def_id {
ast::def_id { crate: local_crate, node: id }
Expand Down Expand Up @@ -223,8 +223,8 @@ pub fn default_block(
}
}

pub fn ident_to_path(s: span, +i: ident) -> @path {
@ast::path { span: s,
pub fn ident_to_path(s: span, +i: ident) -> @Path {
@ast::Path { span: s,
global: false,
idents: ~[i],
rp: None,
Expand Down
4 changes: 4 additions & 0 deletions src/libsyntax/codemap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,12 @@ pub struct FileLines
lines: ~[uint]
}

// represents the origin of a file:
pub enum FileSubstr {
// indicates that this is a normal standalone file:
pub FssNone,
// indicates that this "file" is actually a substring
// of another file that appears earlier in the codemap
pub FssInternal(span),
}

Expand Down
20 changes: 10 additions & 10 deletions src/libsyntax/ext/auto_encode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ priv impl @ext_ctxt {
&self,
_span: span,
ident: ast::ident,
path: @ast::path,
path: @ast::Path,
bounds: @OptVec<ast::TyParamBound>
) -> ast::TyParam {
let bound = ast::TraitTyParamBound(@ast::trait_ref {
Expand All @@ -248,8 +248,8 @@ priv impl @ext_ctxt {
}
}

fn path(&self, span: span, +strs: ~[ast::ident]) -> @ast::path {
@ast::path {
fn path(&self, span: span, +strs: ~[ast::ident]) -> @ast::Path {
@ast::Path {
span: span,
global: false,
idents: strs,
Expand All @@ -258,8 +258,8 @@ priv impl @ext_ctxt {
}
}

fn path_global(&self, span: span, +strs: ~[ast::ident]) -> @ast::path {
@ast::path {
fn path_global(&self, span: span, +strs: ~[ast::ident]) -> @ast::Path {
@ast::Path {
span: span,
global: true,
idents: strs,
Expand All @@ -273,8 +273,8 @@ priv impl @ext_ctxt {
span: span,
+strs: ~[ast::ident],
+tps: ~[@ast::Ty]
) -> @ast::path {
@ast::path {
) -> @ast::Path {
@ast::Path {
span: span,
global: false,
idents: strs,
Expand All @@ -288,8 +288,8 @@ priv impl @ext_ctxt {
span: span,
+strs: ~[ast::ident],
+tps: ~[@ast::Ty]
) -> @ast::path {
@ast::path {
) -> @ast::Path {
@ast::Path {
span: span,
global: true,
idents: strs,
Expand Down Expand Up @@ -439,7 +439,7 @@ fn mk_impl(
span: span,
ident: ast::ident,
ty_param: ast::TyParam,
path: @ast::path,
path: @ast::Path,
generics: &ast::Generics,
f: &fn(@ast::Ty) -> @ast::method
) -> @ast::item {
Expand Down
Loading