Skip to content

Commit 2c64983

Browse files
committed
auto merge of #5709 : jbclements/rust/miscellaneous-cleanup, r=jbclements
There's no unifying theme here; I'm just trying to clear a bunch of small commits: removing dead code, adding comments, renaming to an upper-case type, fixing one test case.
2 parents ac9dc69 + 9deb2f2 commit 2c64983

24 files changed

+138
-313
lines changed

src/librustc/front/core_inject.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ fn inject_libcore_ref(sess: Session,
7777
fold_mod: |module, fld| {
7878
let n2 = sess.next_node_id();
7979

80-
let prelude_path = @ast::path {
80+
let prelude_path = @ast::Path {
8181
span: dummy_sp(),
8282
global: false,
8383
idents: ~[

src/librustc/front/test.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -336,16 +336,16 @@ fn nospan<T:Copy>(t: T) -> codemap::spanned<T> {
336336
codemap::spanned { node: t, span: dummy_sp() }
337337
}
338338

339-
fn path_node(+ids: ~[ast::ident]) -> @ast::path {
340-
@ast::path { span: dummy_sp(),
339+
fn path_node(+ids: ~[ast::ident]) -> @ast::Path {
340+
@ast::Path { span: dummy_sp(),
341341
global: false,
342342
idents: ids,
343343
rp: None,
344344
types: ~[] }
345345
}
346346

347-
fn path_node_global(+ids: ~[ast::ident]) -> @ast::path {
348-
@ast::path { span: dummy_sp(),
347+
fn path_node_global(+ids: ~[ast::ident]) -> @ast::Path {
348+
@ast::Path { span: dummy_sp(),
349349
global: true,
350350
idents: ids,
351351
rp: None,

src/librustc/metadata/tydecode.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ pub fn parse_arg_data(data: @~[u8], crate_num: int, pos: uint, tcx: ty::ctxt,
137137
parse_arg(st, conv)
138138
}
139139

140-
fn parse_path(st: @mut PState) -> @ast::path {
140+
fn parse_path(st: @mut PState) -> @ast::Path {
141141
let mut idents: ~[ast::ident] = ~[];
142142
fn is_last(c: char) -> bool { return c == '(' || c == ':'; }
143143
idents.push(parse_ident_(st, is_last));
@@ -146,7 +146,7 @@ fn parse_path(st: @mut PState) -> @ast::path {
146146
':' => { next(st); next(st); }
147147
c => {
148148
if c == '(' {
149-
return @ast::path { span: dummy_sp(),
149+
return @ast::Path { span: dummy_sp(),
150150
global: false,
151151
idents: idents,
152152
rp: None,

src/librustc/middle/pat_util.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ pub fn pat_is_binding_or_wild(dm: resolve::DefMap, pat: @pat) -> bool {
7272
}
7373

7474
pub fn pat_bindings(dm: resolve::DefMap, pat: @pat,
75-
it: &fn(binding_mode, node_id, span, @path)) {
75+
it: &fn(binding_mode, node_id, span, @Path)) {
7676
do walk_pat(pat) |p| {
7777
match p.node {
7878
pat_ident(binding_mode, pth, _) if pat_is_binding(dm, p) => {

src/librustc/middle/privacy.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ use syntax::ast::{decl_item, def, def_fn, def_id, def_static_method};
2626
use syntax::ast::{def_variant, expr_field, expr_method_call, expr_path};
2727
use syntax::ast::{expr_struct, expr_unary, ident, inherited, item_enum};
2828
use syntax::ast::{item_foreign_mod, item_fn, item_impl, item_struct};
29-
use syntax::ast::{item_trait, local_crate, node_id, pat_struct, path};
29+
use syntax::ast::{item_trait, local_crate, node_id, pat_struct, Path};
3030
use syntax::ast::{private, provided, public, required, stmt_decl, visibility};
3131
use syntax::ast;
3232
use syntax::ast_map::{node_foreign_item, node_item, node_method};
@@ -276,7 +276,7 @@ pub fn check_crate(tcx: ty::ctxt,
276276
};
277277

278278
// Checks that a private path is in scope.
279-
let check_path: @fn(span: span, def: def, path: @path) =
279+
let check_path: @fn(span: span, def: def, path: @Path) =
280280
|span, def, path| {
281281
debug!("checking path");
282282
match def {

src/librustc/middle/resolve.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ use syntax::ast::{item_const, item_enum, item_fn, item_foreign_mod};
4848
use syntax::ast::{item_impl, item_mac, item_mod, item_trait, item_ty, le};
4949
use syntax::ast::{local, local_crate, lt, method, mode, mul};
5050
use syntax::ast::{named_field, ne, neg, node_id, pat, pat_enum, pat_ident};
51-
use syntax::ast::{path, pat_lit, pat_range, pat_struct};
51+
use syntax::ast::{Path, pat_lit, pat_range, pat_struct};
5252
use syntax::ast::{prim_ty, private, provided};
5353
use syntax::ast::{public, required, rem, self_ty_, shl, shr, stmt_decl};
5454
use syntax::ast::{struct_dtor, struct_field, struct_variant_kind};
@@ -4368,7 +4368,7 @@ pub impl Resolver {
43684368
/// If `check_ribs` is true, checks the local definitions first; i.e.
43694369
/// doesn't skip straight to the containing module.
43704370
fn resolve_path(@mut self,
4371-
path: @path,
4371+
path: @Path,
43724372
namespace: Namespace,
43734373
check_ribs: bool,
43744374
visitor: ResolveVisitor)
@@ -4493,7 +4493,7 @@ pub impl Resolver {
44934493
return NoNameDefinition;
44944494
}
44954495

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

45094509
fn resolve_module_relative_path(@mut self,
4510-
path: @path,
4510+
path: @Path,
45114511
+xray: XrayFlag,
45124512
namespace: Namespace)
45134513
-> Option<def> {
@@ -4553,7 +4553,7 @@ pub impl Resolver {
45534553
/// Invariant: This must be called only during main resolution, not during
45544554
/// import resolution.
45554555
fn resolve_crate_relative_path(@mut self,
4556-
path: @path,
4556+
path: @Path,
45574557
+xray: XrayFlag,
45584558
namespace: Namespace)
45594559
-> Option<def> {

src/librustc/middle/typeck/astconv.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ fn ast_path_substs<AC:AstConv,RS:region_scope + Copy + Durable>(
136136
def_id: ast::def_id,
137137
decl_generics: &ty::Generics,
138138
self_ty: Option<ty::t>,
139-
path: @ast::path) -> ty::substs
139+
path: @ast::Path) -> ty::substs
140140
{
141141
/*!
142142
*
@@ -188,7 +188,7 @@ pub fn ast_path_to_substs_and_ty<AC:AstConv,RS:region_scope + Copy + Durable>(
188188
self: &AC,
189189
rscope: &RS,
190190
did: ast::def_id,
191-
path: @ast::path) -> ty_param_substs_and_ty
191+
path: @ast::Path) -> ty_param_substs_and_ty
192192
{
193193
let tcx = self.tcx();
194194
let ty::ty_param_bounds_and_ty {
@@ -206,7 +206,7 @@ pub fn ast_path_to_trait_ref<AC:AstConv,RS:region_scope + Copy + Durable>(
206206
rscope: &RS,
207207
trait_def_id: ast::def_id,
208208
self_ty: Option<ty::t>,
209-
path: @ast::path) -> @ty::TraitRef
209+
path: @ast::Path) -> @ty::TraitRef
210210
{
211211
let trait_def =
212212
self.get_trait_def(trait_def_id);
@@ -229,7 +229,7 @@ pub fn ast_path_to_ty<AC:AstConv,RS:region_scope + Copy + Durable>(
229229
self: &AC,
230230
rscope: &RS,
231231
did: ast::def_id,
232-
path: @ast::path)
232+
path: @ast::Path)
233233
-> ty_param_substs_and_ty
234234
{
235235
// Look up the polytype of the item and then substitute the provided types
@@ -318,7 +318,7 @@ pub fn ast_ty_to_ty<AC:AstConv, RS:region_scope + Copy + Durable>(
318318
}
319319

320320
fn check_path_args(tcx: ty::ctxt,
321-
path: @ast::path,
321+
path: @ast::Path,
322322
flags: uint) {
323323
if (flags & NO_TPS) != 0u {
324324
if path.types.len() > 0u {

src/librustc/middle/typeck/check/_match.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ pub struct pat_ctxt {
9999
block_region: ty::Region, // Region for the block of the arm
100100
}
101101

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

105105
// Typecheck the path.
@@ -234,7 +234,7 @@ pub fn check_pat_variant(pcx: pat_ctxt, pat: @ast::pat, path: @ast::path,
234234
/// `etc` is true if the pattern said '...' and false otherwise.
235235
pub fn check_struct_pat_fields(pcx: pat_ctxt,
236236
span: span,
237-
path: @ast::path,
237+
path: @ast::Path,
238238
fields: &[ast::field_pat],
239239
class_fields: ~[ty::field_ty],
240240
class_id: ast::def_id,
@@ -285,7 +285,7 @@ pub fn check_struct_pat_fields(pcx: pat_ctxt,
285285
}
286286

287287
pub fn check_struct_pat(pcx: pat_ctxt, pat_id: ast::node_id, span: span,
288-
expected: ty::t, path: @ast::path,
288+
expected: ty::t, path: @ast::Path,
289289
fields: &[ast::field_pat], etc: bool,
290290
class_id: ast::def_id, substitutions: &ty::substs) {
291291
let fcx = pcx.fcx;
@@ -326,7 +326,7 @@ pub fn check_struct_like_enum_variant_pat(pcx: pat_ctxt,
326326
pat_id: ast::node_id,
327327
span: span,
328328
expected: ty::t,
329-
path: @ast::path,
329+
path: @ast::Path,
330330
fields: &[ast::field_pat],
331331
etc: bool,
332332
enum_id: ast::def_id,

src/librustc/middle/typeck/check/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3211,7 +3211,7 @@ pub fn ty_param_bounds_and_ty_for_def(fcx: @mut FnCtxt,
32113211
// Instantiates the given path, which must refer to an item with the given
32123212
// number of type parameters and type.
32133213
pub fn instantiate_path(fcx: @mut FnCtxt,
3214-
pth: @ast::path,
3214+
pth: @ast::Path,
32153215
tpt: ty_param_bounds_and_ty,
32163216
span: span,
32173217
node_id: ast::node_id,

src/libsyntax/ast.rs

+12-12
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ pub struct Lifetime {
113113
#[auto_encode]
114114
#[auto_decode]
115115
#[deriving(Eq)]
116-
pub struct path {
116+
pub struct Path {
117117
span: span,
118118
global: bool,
119119
idents: ~[ident],
@@ -301,10 +301,10 @@ pub enum pat_ {
301301
// which it is. The resolver determines this, and
302302
// records this pattern's node_id in an auxiliary
303303
// set (of "pat_idents that refer to nullary enums")
304-
pat_ident(binding_mode, @path, Option<@pat>),
305-
pat_enum(@path, Option<~[@pat]>), /* "none" means a * pattern where
304+
pat_ident(binding_mode, @Path, Option<@pat>),
305+
pat_enum(@Path, Option<~[@pat]>), /* "none" means a * pattern where
306306
* we don't bind the fields to names */
307-
pat_struct(@path, ~[field_pat], bool),
307+
pat_struct(@Path, ~[field_pat], bool),
308308
pat_tup(~[@pat]),
309309
pat_box(@pat),
310310
pat_uniq(@pat),
@@ -567,7 +567,7 @@ pub enum expr_ {
567567
expr_assign_op(binop, @expr, @expr),
568568
expr_field(@expr, ident, ~[@Ty]),
569569
expr_index(@expr, @expr),
570-
expr_path(@path),
570+
expr_path(@Path),
571571
expr_addr_of(mutability, @expr),
572572
expr_break(Option<ident>),
573573
expr_again(Option<ident>),
@@ -579,7 +579,7 @@ pub enum expr_ {
579579
expr_mac(mac),
580580
581581
// A struct literal expression.
582-
expr_struct(@path, ~[field], Option<@expr>),
582+
expr_struct(@Path, ~[field], Option<@expr>),
583583
584584
// A vector literal constructed from one repeated element.
585585
expr_repeat(@expr /* element */, @expr /* count */, mutability),
@@ -697,7 +697,7 @@ pub type mac = spanned<mac_>;
697697
#[auto_decode]
698698
#[deriving(Eq)]
699699
pub enum mac_ {
700-
mac_invoc_tt(@path,~[token_tree]), // new macro-invocation
700+
mac_invoc_tt(@Path,~[token_tree]), // new macro-invocation
701701
}
702702
703703
pub type lit = spanned<lit_>;
@@ -894,7 +894,7 @@ pub enum ty_ {
894894
ty_closure(@TyClosure),
895895
ty_bare_fn(@TyBareFn),
896896
ty_tup(~[@Ty]),
897-
ty_path(@path, node_id),
897+
ty_path(@Path, node_id),
898898
ty_mac(mac),
899899
// ty_infer means the type should be inferred instead of it having been
900900
// specified. This should only appear at the "top level" of a type and not
@@ -1118,13 +1118,13 @@ pub enum view_path_ {
11181118
// or just
11191119
//
11201120
// foo::bar::baz (with 'baz =' implicitly on the left)
1121-
view_path_simple(ident, @path, namespace, node_id),
1121+
view_path_simple(ident, @Path, namespace, node_id),
11221122
11231123
// foo::bar::*
1124-
view_path_glob(@path, node_id),
1124+
view_path_glob(@Path, node_id),
11251125
11261126
// foo::bar::{a,b,c}
1127-
view_path_list(@path, ~[path_list_ident], node_id)
1127+
view_path_list(@Path, ~[path_list_ident], node_id)
11281128
}
11291129
11301130
#[auto_encode]
@@ -1177,7 +1177,7 @@ pub struct attribute_ {
11771177
#[auto_decode]
11781178
#[deriving(Eq)]
11791179
pub struct trait_ref {
1180-
path: @path,
1180+
path: @Path,
11811181
ref_id: node_id,
11821182
}
11831183

src/libsyntax/ast_util.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ pub fn path_name_i(idents: &[ident], intr: @token::ident_interner) -> ~str {
3030
}
3131

3232

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

3535
pub fn local_def(id: node_id) -> def_id {
3636
ast::def_id { crate: local_crate, node: id }
@@ -223,8 +223,8 @@ pub fn default_block(
223223
}
224224
}
225225

226-
pub fn ident_to_path(s: span, +i: ident) -> @path {
227-
@ast::path { span: s,
226+
pub fn ident_to_path(s: span, +i: ident) -> @Path {
227+
@ast::Path { span: s,
228228
global: false,
229229
idents: ~[i],
230230
rp: None,

src/libsyntax/codemap.rs

+4
Original file line numberDiff line numberDiff line change
@@ -206,8 +206,12 @@ pub struct FileLines
206206
lines: ~[uint]
207207
}
208208

209+
// represents the origin of a file:
209210
pub enum FileSubstr {
211+
// indicates that this is a normal standalone file:
210212
pub FssNone,
213+
// indicates that this "file" is actually a substring
214+
// of another file that appears earlier in the codemap
211215
pub FssInternal(span),
212216
}
213217

src/libsyntax/ext/auto_encode.rs

+10-10
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ priv impl @ext_ctxt {
224224
&self,
225225
_span: span,
226226
ident: ast::ident,
227-
path: @ast::path,
227+
path: @ast::Path,
228228
bounds: @OptVec<ast::TyParamBound>
229229
) -> ast::TyParam {
230230
let bound = ast::TraitTyParamBound(@ast::trait_ref {
@@ -248,8 +248,8 @@ priv impl @ext_ctxt {
248248
}
249249
}
250250

251-
fn path(&self, span: span, +strs: ~[ast::ident]) -> @ast::path {
252-
@ast::path {
251+
fn path(&self, span: span, +strs: ~[ast::ident]) -> @ast::Path {
252+
@ast::Path {
253253
span: span,
254254
global: false,
255255
idents: strs,
@@ -258,8 +258,8 @@ priv impl @ext_ctxt {
258258
}
259259
}
260260

261-
fn path_global(&self, span: span, +strs: ~[ast::ident]) -> @ast::path {
262-
@ast::path {
261+
fn path_global(&self, span: span, +strs: ~[ast::ident]) -> @ast::Path {
262+
@ast::Path {
263263
span: span,
264264
global: true,
265265
idents: strs,
@@ -273,8 +273,8 @@ priv impl @ext_ctxt {
273273
span: span,
274274
+strs: ~[ast::ident],
275275
+tps: ~[@ast::Ty]
276-
) -> @ast::path {
277-
@ast::path {
276+
) -> @ast::Path {
277+
@ast::Path {
278278
span: span,
279279
global: false,
280280
idents: strs,
@@ -288,8 +288,8 @@ priv impl @ext_ctxt {
288288
span: span,
289289
+strs: ~[ast::ident],
290290
+tps: ~[@ast::Ty]
291-
) -> @ast::path {
292-
@ast::path {
291+
) -> @ast::Path {
292+
@ast::Path {
293293
span: span,
294294
global: true,
295295
idents: strs,
@@ -439,7 +439,7 @@ fn mk_impl(
439439
span: span,
440440
ident: ast::ident,
441441
ty_param: ast::TyParam,
442-
path: @ast::path,
442+
path: @ast::Path,
443443
generics: &ast::Generics,
444444
f: &fn(@ast::Ty) -> @ast::method
445445
) -> @ast::item {

0 commit comments

Comments
 (0)