Skip to content

Commit 975489b

Browse files
committed
---
yaml --- r: 156669 b: refs/heads/try c: d44ea72 h: refs/heads/master i: 156667: 1f724a9 v: v3
1 parent 656fa9a commit 975489b

File tree

6 files changed

+75
-5
lines changed

6 files changed

+75
-5
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: a34b8dec697014f15e725215e17ea8d956c0ab1a
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: d44ea720fa9dfe062ef06d0eb49a58d4e7e92344
5-
refs/heads/try: aeba2ccf3082522f56e9aaefc0a961e2ed737f53
5+
refs/heads/try: d44ea720fa9dfe062ef06d0eb49a58d4e7e92344
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 6601b0501e31d08d3892a2d5a7d8a57ab120bf75

branches/try/mk/main.mk

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,13 @@ RUSTFLAGS_STAGE1 += -C prefer-dynamic
157157
# by not emitting them.
158158
RUSTFLAGS_STAGE0 += -Z no-landing-pads
159159

160+
# Go fast for stage0, and also for stage1/stage2 if optimization is off.
161+
RUSTFLAGS_STAGE0 += -C codegen-units=4
162+
ifdef CFG_DISABLE_OPTIMIZE
163+
RUSTFLAGS_STAGE1 += -C codegen-units=4
164+
RUSTFLAGS_STAGE2 += -C codegen-units=4
165+
endif
166+
160167
# platform-specific auto-configuration
161168
include $(CFG_SRC_DIR)mk/platform.mk
162169

branches/try/mk/tests.mk

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -628,6 +628,10 @@ CTEST_RUSTC_FLAGS := $$(subst -O,,$$(CTEST_RUSTC_FLAGS))
628628
ifndef CFG_DISABLE_OPTIMIZE_TESTS
629629
CTEST_RUSTC_FLAGS += -O
630630
endif
631+
# Force codegen-units=1 for compiletest tests. compiletest does its own
632+
# parallelization internally, so rustc's default codegen-units=2 will actually
633+
# slow things down.
634+
CTEST_RUSTC_FLAGS += -C codegen-units=1
631635

632636
CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3) := \
633637
--compile-lib-path $$(HLIB$(1)_H_$(3)) \

branches/try/src/librustc/driver/config.rs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -780,7 +780,20 @@ pub fn build_session_options(matches: &getopts::Matches) -> Options {
780780
early_warn("the --crate-file-name argument has been renamed to \
781781
--print-file-name");
782782
}
783-
let cg = build_codegen_options(matches);
783+
784+
let mut cg = build_codegen_options(matches);
785+
786+
if cg.codegen_units == 0 {
787+
match opt_level {
788+
// `-C lto` doesn't work with multiple codegen units.
789+
_ if cg.lto => cg.codegen_units = 1,
790+
791+
No | Less => cg.codegen_units = 2,
792+
Default | Aggressive => cg.codegen_units = 1,
793+
}
794+
}
795+
let cg = cg;
796+
784797

785798
if !cg.remark.is_empty() && debuginfo == NoDebugInfo {
786799
early_warn("-C remark will not show source locations without --debuginfo");

branches/try/src/libsyntax/parse/mod.rs

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -721,7 +721,7 @@ pub fn integer_lit(s: &str, sd: &SpanHandler, sp: Span) -> ast::Lit_ {
721721
mod test {
722722
use super::*;
723723
use serialize::json;
724-
use codemap::{Span, BytePos, Spanned, NO_EXPANSION};
724+
use codemap::{Span, BytePos, Pos, Spanned, NO_EXPANSION};
725725
use owned_slice::OwnedSlice;
726726
use ast;
727727
use abi;
@@ -1121,6 +1121,46 @@ mod test {
11211121
span: sp(0,21)})));
11221122
}
11231123

1124+
fn get_spans_of_pat_idents(src: &str) -> Vec<Span> {
1125+
let item = string_to_item(src.to_string()).unwrap();
1126+
1127+
struct PatIdentVisitor {
1128+
spans: Vec<Span>
1129+
}
1130+
impl<'v> ::visit::Visitor<'v> for PatIdentVisitor {
1131+
fn visit_pat(&mut self, p: &'v ast::Pat) {
1132+
match p.node {
1133+
ast::PatIdent(_ , ref spannedident, _) => {
1134+
self.spans.push(spannedident.span.clone());
1135+
}
1136+
_ => {
1137+
::visit::walk_pat(self, p);
1138+
}
1139+
}
1140+
}
1141+
}
1142+
let mut v = PatIdentVisitor { spans: Vec::new() };
1143+
::visit::walk_item(&mut v, &*item);
1144+
return v.spans;
1145+
}
1146+
1147+
#[test] fn span_of_self_arg_pat_idents_are_correct() {
1148+
1149+
let srcs = ["impl z { fn a (&self, &myarg: int) {} }",
1150+
"impl z { fn a (&mut self, &myarg: int) {} }",
1151+
"impl z { fn a (&'a self, &myarg: int) {} }",
1152+
"impl z { fn a (self, &myarg: int) {} }",
1153+
"impl z { fn a (self: Foo, &myarg: int) {} }",
1154+
];
1155+
1156+
for &src in srcs.iter() {
1157+
let spans = get_spans_of_pat_idents(src);
1158+
let Span{lo:lo,hi:hi,..} = spans[0];
1159+
assert!("self" == src.slice(lo.to_uint(), hi.to_uint()),
1160+
"\"{}\" != \"self\". src=\"{}\"",
1161+
src.slice(lo.to_uint(), hi.to_uint()), src)
1162+
}
1163+
}
11241164

11251165
#[test] fn parse_exprs () {
11261166
// just make sure that they parse....

branches/try/src/libsyntax/parse/parser.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4165,10 +4165,16 @@ impl<'a> Parser<'a> {
41654165
// A bit of complexity and lookahead is needed here in order to be
41664166
// backwards compatible.
41674167
let lo = self.span.lo;
4168+
let mut self_ident_lo = self.span.lo;
4169+
let mut self_ident_hi = self.span.hi;
4170+
41684171
let mut mutbl_self = MutImmutable;
41694172
let explicit_self = match self.token {
41704173
token::BINOP(token::AND) => {
4171-
maybe_parse_borrowed_explicit_self(self)
4174+
let eself = maybe_parse_borrowed_explicit_self(self);
4175+
self_ident_lo = self.last_span.lo;
4176+
self_ident_hi = self.last_span.hi;
4177+
eself
41724178
}
41734179
token::TILDE => {
41744180
// We need to make sure it isn't a type
@@ -4240,7 +4246,7 @@ impl<'a> Parser<'a> {
42404246
_ => SelfStatic,
42414247
};
42424248

4243-
let explicit_self_sp = mk_sp(lo, self.span.hi);
4249+
let explicit_self_sp = mk_sp(self_ident_lo, self_ident_hi);
42444250

42454251
// shared fall-through for the three cases below. borrowing prevents simply
42464252
// writing this as a closure

0 commit comments

Comments
 (0)