Skip to content

Commit 0e6be7c

Browse files
committed
auto merge of #5709 : jbclements/rust/miscellaneous-cleanup, r=bstrie
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 717ed51 + 0c396b6 commit 0e6be7c

25 files changed

+138
-315
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
@@ -125,7 +125,7 @@ pub fn parse_arg_data(data: @~[u8], crate_num: int, pos: uint, tcx: ty::ctxt,
125125
parse_arg(st, conv)
126126
}
127127

128-
fn parse_path(st: @mut PState) -> @ast::path {
128+
fn parse_path(st: @mut PState) -> @ast::Path {
129129
let mut idents: ~[ast::ident] = ~[];
130130
fn is_last(c: char) -> bool { return c == '(' || c == ':'; }
131131
idents.push(parse_ident_(st, is_last));
@@ -134,7 +134,7 @@ fn parse_path(st: @mut PState) -> @ast::path {
134134
':' => { next(st); next(st); }
135135
c => {
136136
if c == '(' {
137-
return @ast::path { span: dummy_sp(),
137+
return @ast::Path { span: dummy_sp(),
138138
global: false,
139139
idents: idents,
140140
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
@@ -47,7 +47,7 @@ use syntax::ast::{item_const, item_enum, item_fn, item_foreign_mod};
4747
use syntax::ast::{item_impl, item_mac, item_mod, item_trait, item_ty, le};
4848
use syntax::ast::{local, local_crate, lt, method, mode, mul};
4949
use syntax::ast::{named_field, ne, neg, node_id, pat, pat_enum, pat_ident};
50-
use syntax::ast::{path, pat_lit, pat_range, pat_struct};
50+
use syntax::ast::{Path, pat_lit, pat_range, pat_struct};
5151
use syntax::ast::{prim_ty, private, provided};
5252
use syntax::ast::{public, required, rem, self_ty_, shl, shr, stmt_decl};
5353
use syntax::ast::{struct_dtor, struct_field, struct_variant_kind};
@@ -4356,7 +4356,7 @@ pub impl Resolver {
43564356
/// If `check_ribs` is true, checks the local definitions first; i.e.
43574357
/// doesn't skip straight to the containing module.
43584358
fn resolve_path(@mut self,
4359-
path: @path,
4359+
path: @Path,
43604360
namespace: Namespace,
43614361
check_ribs: bool,
43624362
visitor: ResolveVisitor)
@@ -4481,7 +4481,7 @@ pub impl Resolver {
44814481
return NoNameDefinition;
44824482
}
44834483

4484-
fn intern_module_part_of_path(@mut self, path: @path) -> ~[ident] {
4484+
fn intern_module_part_of_path(@mut self, path: @Path) -> ~[ident] {
44854485
let mut module_path_idents = ~[];
44864486
for path.idents.eachi |index, ident| {
44874487
if index == path.idents.len() - 1 {
@@ -4495,7 +4495,7 @@ pub impl Resolver {
44954495
}
44964496

44974497
fn resolve_module_relative_path(@mut self,
4498-
path: @path,
4498+
path: @Path,
44994499
+xray: XrayFlag,
45004500
namespace: Namespace)
45014501
-> Option<def> {
@@ -4541,7 +4541,7 @@ pub impl Resolver {
45414541
/// Invariant: This must be called only during main resolution, not during
45424542
/// import resolution.
45434543
fn resolve_crate_relative_path(@mut self,
4544-
path: @path,
4544+
path: @Path,
45454545
+xray: XrayFlag,
45464546
namespace: Namespace)
45474547
-> Option<def> {

src/librustc/middle/typeck/astconv.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ pub fn ast_path_to_substs_and_ty<AC:AstConv,RS:region_scope + Copy + Durable>(
133133
self: &AC,
134134
rscope: &RS,
135135
did: ast::def_id,
136-
path: @ast::path)
136+
path: @ast::Path)
137137
-> ty_param_substs_and_ty {
138138
let tcx = self.tcx();
139139
let ty::ty_param_bounds_and_ty {
@@ -189,7 +189,7 @@ pub fn ast_path_to_ty<AC:AstConv,RS:region_scope + Copy + Durable>(
189189
self: &AC,
190190
rscope: &RS,
191191
did: ast::def_id,
192-
path: @ast::path)
192+
path: @ast::Path)
193193
-> ty_param_substs_and_ty
194194
{
195195
// Look up the polytype of the item and then substitute the provided types
@@ -285,7 +285,7 @@ pub fn ast_ty_to_ty<AC:AstConv, RS:region_scope + Copy + Durable>(
285285
}
286286

287287
fn check_path_args(tcx: ty::ctxt,
288-
path: @ast::path,
288+
path: @ast::Path,
289289
flags: uint) {
290290
if (flags & NO_TPS) != 0u {
291291
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.
@@ -232,7 +232,7 @@ pub fn check_pat_variant(pcx: pat_ctxt, pat: @ast::pat, path: @ast::path,
232232
/// `etc` is true if the pattern said '...' and false otherwise.
233233
pub fn check_struct_pat_fields(pcx: pat_ctxt,
234234
span: span,
235-
path: @ast::path,
235+
path: @ast::Path,
236236
fields: &[ast::field_pat],
237237
class_fields: ~[ty::field_ty],
238238
class_id: ast::def_id,
@@ -283,7 +283,7 @@ pub fn check_struct_pat_fields(pcx: pat_ctxt,
283283
}
284284

285285
pub fn check_struct_pat(pcx: pat_ctxt, pat_id: ast::node_id, span: span,
286-
expected: ty::t, path: @ast::path,
286+
expected: ty::t, path: @ast::Path,
287287
fields: &[ast::field_pat], etc: bool,
288288
class_id: ast::def_id, substitutions: &ty::substs) {
289289
let fcx = pcx.fcx;
@@ -324,7 +324,7 @@ pub fn check_struct_like_enum_variant_pat(pcx: pat_ctxt,
324324
pat_id: ast::node_id,
325325
span: span,
326326
expected: ty::t,
327-
path: @ast::path,
327+
path: @ast::Path,
328328
fields: &[ast::field_pat],
329329
etc: bool,
330330
enum_id: ast::def_id,

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -3197,7 +3197,7 @@ pub fn ty_param_bounds_and_ty_for_def(fcx: @mut FnCtxt,
31973197
// Instantiates the given path, which must refer to an item with the given
31983198
// number of type parameters and type.
31993199
pub fn instantiate_path(fcx: @mut FnCtxt,
3200-
pth: @ast::path,
3200+
pth: @ast::Path,
32013201
tpt: ty_param_bounds_and_ty,
32023202
span: span,
32033203
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],
@@ -300,10 +300,10 @@ pub enum pat_ {
300300
// which it is. The resolver determines this, and
301301
// records this pattern's node_id in an auxiliary
302302
// set (of "pat_idents that refer to nullary enums")
303-
pat_ident(binding_mode, @path, Option<@pat>),
304-
pat_enum(@path, Option<~[@pat]>), /* "none" means a * pattern where
303+
pat_ident(binding_mode, @Path, Option<@pat>),
304+
pat_enum(@Path, Option<~[@pat]>), /* "none" means a * pattern where
305305
* we don't bind the fields to names */
306-
pat_struct(@path, ~[field_pat], bool),
306+
pat_struct(@Path, ~[field_pat], bool),
307307
pat_tup(~[@pat]),
308308
pat_box(@pat),
309309
pat_uniq(@pat),
@@ -566,7 +566,7 @@ pub enum expr_ {
566566
expr_assign_op(binop, @expr, @expr),
567567
expr_field(@expr, ident, ~[@Ty]),
568568
expr_index(@expr, @expr),
569-
expr_path(@path),
569+
expr_path(@Path),
570570
expr_addr_of(mutability, @expr),
571571
expr_break(Option<ident>),
572572
expr_again(Option<ident>),
@@ -578,7 +578,7 @@ pub enum expr_ {
578578
expr_mac(mac),
579579
580580
// A struct literal expression.
581-
expr_struct(@path, ~[field], Option<@expr>),
581+
expr_struct(@Path, ~[field], Option<@expr>),
582582
583583
// A vector literal constructed from one repeated element.
584584
expr_repeat(@expr /* element */, @expr /* count */, mutability),
@@ -696,7 +696,7 @@ pub type mac = spanned<mac_>;
696696
#[auto_decode]
697697
#[deriving(Eq)]
698698
pub enum mac_ {
699-
mac_invoc_tt(@path,~[token_tree]), // new macro-invocation
699+
mac_invoc_tt(@Path,~[token_tree]), // new macro-invocation
700700
}
701701
702702
pub type lit = spanned<lit_>;
@@ -893,7 +893,7 @@ pub enum ty_ {
893893
ty_closure(@TyClosure),
894894
ty_bare_fn(@TyBareFn),
895895
ty_tup(~[@Ty]),
896-
ty_path(@path, node_id),
896+
ty_path(@Path, node_id),
897897
ty_mac(mac),
898898
// ty_infer means the type should be inferred instead of it having been
899899
// specified. This should only appear at the "top level" of a type and not
@@ -1117,13 +1117,13 @@ pub enum view_path_ {
11171117
// or just
11181118
//
11191119
// foo::bar::baz (with 'baz =' implicitly on the left)
1120-
view_path_simple(ident, @path, namespace, node_id),
1120+
view_path_simple(ident, @Path, namespace, node_id),
11211121
11221122
// foo::bar::*
1123-
view_path_glob(@path, node_id),
1123+
view_path_glob(@Path, node_id),
11241124
11251125
// foo::bar::{a,b,c}
1126-
view_path_list(@path, ~[path_list_ident], node_id)
1126+
view_path_list(@Path, ~[path_list_ident], node_id)
11271127
}
11281128
11291129
#[auto_encode]
@@ -1176,7 +1176,7 @@ pub struct attribute_ {
11761176
#[auto_decode]
11771177
#[deriving(Eq)]
11781178
pub struct trait_ref {
1179-
path: @path,
1179+
path: @Path,
11801180
ref_id: node_id,
11811181
}
11821182

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::Ty {
@@ -249,8 +249,8 @@ priv impl @ext_ctxt {
249249
}
250250
}
251251

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

262-
fn path_global(&self, span: span, +strs: ~[ast::ident]) -> @ast::path {
263-
@ast::path {
262+
fn path_global(&self, span: span, +strs: ~[ast::ident]) -> @ast::Path {
263+
@ast::Path {
264264
span: span,
265265
global: true,
266266
idents: strs,
@@ -274,8 +274,8 @@ priv impl @ext_ctxt {
274274
span: span,
275275
+strs: ~[ast::ident],
276276
+tps: ~[@ast::Ty]
277-
) -> @ast::path {
278-
@ast::path {
277+
) -> @ast::Path {
278+
@ast::Path {
279279
span: span,
280280
global: false,
281281
idents: strs,
@@ -289,8 +289,8 @@ priv impl @ext_ctxt {
289289
span: span,
290290
+strs: ~[ast::ident],
291291
+tps: ~[@ast::Ty]
292-
) -> @ast::path {
293-
@ast::path {
292+
) -> @ast::Path {
293+
@ast::Path {
294294
span: span,
295295
global: true,
296296
idents: strs,
@@ -440,7 +440,7 @@ fn mk_impl(
440440
span: span,
441441
ident: ast::ident,
442442
ty_param: ast::TyParam,
443-
path: @ast::path,
443+
path: @ast::Path,
444444
generics: &ast::Generics,
445445
f: &fn(@ast::Ty) -> @ast::method
446446
) -> @ast::item {

0 commit comments

Comments
 (0)