Skip to content

Commit 60562ac

Browse files
committed
whitespace, reindentation, and comments only
1 parent ec0a64d commit 60562ac

File tree

6 files changed

+42
-27
lines changed

6 files changed

+42
-27
lines changed

src/librustc/middle/trans/base.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2787,7 +2787,8 @@ pub fn declare_intrinsics(llmod: ModuleRef) -> HashMap<&'static str, ValueRef> {
27872787

27882788
pub fn declare_dbg_intrinsics(llmod: ModuleRef, intrinsics: &mut HashMap<&'static str, ValueRef>) {
27892789
ifn!(intrinsics, "llvm.dbg.declare", [Type::metadata(), Type::metadata()], Type::void());
2790-
ifn!(intrinsics, "llvm.dbg.value", [Type::metadata(), Type::i64(), Type::metadata()], Type::void());
2790+
ifn!(intrinsics,
2791+
"llvm.dbg.value", [Type::metadata(), Type::i64(), Type::metadata()], Type::void());
27912792
}
27922793

27932794
pub fn trap(bcx: @mut Block) {

src/librustc/middle/trans/expr.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1176,8 +1176,9 @@ fn trans_rec_or_struct(bcx: @mut Block,
11761176
let mut need_base = vec::from_elem(field_tys.len(), true);
11771177

11781178
let numbered_fields = do fields.map |field| {
1179-
let opt_pos = field_tys.iter().position(|field_ty|
1180-
field_ty.ident.name == field.ident.name);
1179+
let opt_pos =
1180+
field_tys.iter().position(|field_ty|
1181+
field_ty.ident.name == field.ident.name);
11811182
match opt_pos {
11821183
Some(i) => {
11831184
need_base[i] = false;

src/libsyntax/ast.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,12 @@ impl Ident {
5151
if (self.ctxt == other.ctxt) {
5252
self.name == other.name
5353
} else {
54+
// IF YOU SEE ONE OF THESE FAILS: it means that you're comparing
55+
// idents that have different contexts. You can't fix this without
56+
// knowing whether the comparison should be hygienic or non-hygienic.
57+
// if it should be non-hygienic (most things are), just compare the
58+
// 'name' fields of the idents. Or, even better, replace the idents
59+
// with Name's.
5460
fail!(fmt!("not allowed to compare these idents: %?, %?", self, other));
5561
}
5662
}
@@ -128,6 +134,7 @@ pub type FnIdent = Option<Ident>;
128134
pub struct Lifetime {
129135
id: NodeId,
130136
span: Span,
137+
// FIXME #7743 : change this to Name!
131138
ident: Ident
132139
}
133140

@@ -647,7 +654,6 @@ pub enum matcher_ {
647654
// lo, hi position-in-match-array used:
648655
match_seq(~[matcher], Option<::parse::token::Token>, bool, uint, uint),
649656
// parse a Rust NT: name to bind, name of NT, position in match array:
650-
// NOTE: 'name of NT' shouldnt really be represented as an ident, should it?
651657
match_nonterminal(Ident, Ident, uint)
652658
}
653659

src/libsyntax/ast_util.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -948,11 +948,14 @@ pub fn resolve_internal(id : Ident,
948948
match table.table[id.ctxt] {
949949
EmptyCtxt => id.name,
950950
// ignore marks here:
951-
Mark(_,subctxt) => resolve_internal(Ident{name:id.name, ctxt: subctxt},table,resolve_table),
951+
Mark(_,subctxt) =>
952+
resolve_internal(Ident{name:id.name, ctxt: subctxt},table,resolve_table),
952953
// do the rename if necessary:
953954
Rename(Ident{name,ctxt},toname,subctxt) => {
954-
let resolvedfrom = resolve_internal(Ident{name:name,ctxt:ctxt},table,resolve_table);
955-
let resolvedthis = resolve_internal(Ident{name:id.name,ctxt:subctxt},table,resolve_table);
955+
let resolvedfrom =
956+
resolve_internal(Ident{name:name,ctxt:ctxt},table,resolve_table);
957+
let resolvedthis =
958+
resolve_internal(Ident{name:id.name,ctxt:subctxt},table,resolve_table);
956959
if ((resolvedthis == resolvedfrom)
957960
&& (marksof(ctxt,resolvedthis,table)
958961
== marksof(subctxt,resolvedthis,table))) {
@@ -1034,8 +1037,9 @@ pub fn segments_name_eq(a : &[ast::PathSegment], b : &[ast::PathSegment]) -> boo
10341037
} else {
10351038
for (idx,seg) in a.iter().enumerate() {
10361039
if (seg.identifier.name != b[idx].identifier.name)
1037-
// ident -> name problems in lifetime comparison?
1040+
// FIXME #7743: ident -> name problems in lifetime comparison?
10381041
|| (seg.lifetime != b[idx].lifetime)
1042+
// can types contain idents?
10391043
|| (seg.types != b[idx].types) {
10401044
return false;
10411045
}

src/libsyntax/ext/expand.rs

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -76,19 +76,20 @@ pub fn expand_expr(extsbox: @mut SyntaxEnv,
7676
// mark before:
7777
let marked_before = mark_tts(*tts,fm);
7878
let marked_ctxt = new_mark(fm, ctxt);
79-
let expanded = match expandfun(cx, mac.span, marked_before, marked_ctxt) {
80-
MRExpr(e) => e,
81-
MRAny(expr_maker,_,_) => expr_maker(),
82-
_ => {
83-
cx.span_fatal(
84-
pth.span,
85-
fmt!(
86-
"non-expr macro in expr pos: %s",
87-
extnamestr
79+
let expanded =
80+
match expandfun(cx, mac.span, marked_before, marked_ctxt) {
81+
MRExpr(e) => e,
82+
MRAny(expr_maker,_,_) => expr_maker(),
83+
_ => {
84+
cx.span_fatal(
85+
pth.span,
86+
fmt!(
87+
"non-expr macro in expr pos: %s",
88+
extnamestr
89+
)
8890
)
89-
)
90-
}
91-
};
91+
}
92+
};
9293
// mark after:
9394
let marked_after = mark_expr(expanded,fm);
9495

@@ -1735,12 +1736,14 @@ mod test {
17351736
~[~[0]])
17361737
// FIXME #6994: the next string exposes the bug referred to in issue 6994, so I'm
17371738
// commenting it out.
1738-
// the z flows into and out of two macros (g & f) along one path, and one (just g) along the
1739-
// other, so the result of the whole thing should be "let z_123 = 3; z_123"
1740-
//"macro_rules! g (($x:ident) => ({macro_rules! f(($y:ident)=>({let $y=3;$x}));f!($x)}))
1739+
// the z flows into and out of two macros (g & f) along one path, and one
1740+
// (just g) along the other, so the result of the whole thing should
1741+
// be "let z_123 = 3; z_123"
1742+
//"macro_rules! g (($x:ident) =>
1743+
// ({macro_rules! f(($y:ident)=>({let $y=3;$x}));f!($x)}))
17411744
// fn a(){g!(z)}"
1742-
// create a really evil test case where a $x appears inside a binding of $x but *shouldnt*
1743-
// bind because it was inserted by a different macro....
1745+
// create a really evil test case where a $x appears inside a binding of $x
1746+
// but *shouldnt* bind because it was inserted by a different macro....
17441747
];
17451748
for s in tests.iter() {
17461749
run_renaming_test(s);
@@ -1820,7 +1823,8 @@ mod test {
18201823
// find the ext_cx binding
18211824
let bindings = @mut ~[];
18221825
visit::walk_crate(&mut new_name_finder(bindings), crate, ());
1823-
let cxbinds : ~[&ast::Ident] = bindings.iter().filter(|b|{@"ext_cx" == (ident_to_str(*b))}).collect();
1826+
let cxbinds : ~[&ast::Ident] =
1827+
bindings.iter().filter(|b|{@"ext_cx" == (ident_to_str(*b))}).collect();
18241828
let cxbind = match cxbinds {
18251829
[b] => b,
18261830
_ => fail!("expected just one binding for ext_cx")

src/libsyntax/ext/tt/macro_rules.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ pub fn add_new_extension(cx: @ExtCtxt,
4949
// ...quasiquoting this would be nice.
5050
let argument_gram = ~[
5151
ms(match_seq(~[
52-
// NOTE : probably just use an enum for the NT_name ?
5352
ms(match_nonterminal(lhs_nm, special_idents::matchers, 0u)),
5453
ms(match_tok(FAT_ARROW)),
5554
ms(match_nonterminal(rhs_nm, special_idents::tt, 1u)),

0 commit comments

Comments
 (0)