Skip to content

Commit 424d79e

Browse files
committed
---
yaml --- r: 157429 b: refs/heads/snap-stage3 c: 96991e9 h: refs/heads/master i: 157427: e1a0327 v: v3
1 parent 4b4c073 commit 424d79e

File tree

96 files changed

+266
-47
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

96 files changed

+266
-47
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 065caf34f5ff29e04605f95d9c5d511af219439a
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 7b021859a4ea33bb0f5512649a5c9792648e9ad6
4+
refs/heads/snap-stage3: 96991e9335e260d2684785ee97dc1af9cbed5aad
55
refs/heads/try: 0ee4d8b0b112c608646fa75463ab4dc59132efd9
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/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/snap-stage3/mk/tests.mk

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -584,13 +584,14 @@ ifeq ($(CFG_LLDB),)
584584
CTEST_DISABLE_debuginfo-lldb = "no lldb found"
585585
endif
586586

587-
# Completely disable LLDB tests for now
588-
CTEST_DISABLE_debuginfo-lldb = "LLDB tests are not enabled yet"
589-
590587
ifeq ($(CFG_CLANG),)
591588
CTEST_DISABLE_codegen = "no clang found"
592589
endif
593590

591+
ifneq ($(CFG_OSTYPE),apple-darwin)
592+
CTEST_DISABLE_debuginfo-lldb = "lldb tests are only run on darwin"
593+
endif
594+
594595
ifeq ($(CFG_OSTYPE),apple-darwin)
595596
CTEST_DISABLE_debuginfo-gdb = "gdb on darwing needs root"
596597
endif
@@ -628,6 +629,10 @@ CTEST_RUSTC_FLAGS := $$(subst -O,,$$(CTEST_RUSTC_FLAGS))
628629
ifndef CFG_DISABLE_OPTIMIZE_TESTS
629630
CTEST_RUSTC_FLAGS += -O
630631
endif
632+
# Force codegen-units=1 for compiletest tests. compiletest does its own
633+
# parallelization internally, so rustc's default codegen-units=2 will actually
634+
# slow things down.
635+
CTEST_RUSTC_FLAGS += -C codegen-units=1
631636

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

branches/snap-stage3/src/compiletest/compiletest.rs

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ use std::io::fs;
2525
use std::from_str::FromStr;
2626
use getopts::{optopt, optflag, reqopt};
2727
use common::Config;
28-
use common::{Pretty, DebugInfoGdb, DebugInfoLldb, Codegen};
28+
use common::{Pretty, DebugInfoGdb, Codegen};
2929
use util::logv;
3030
use regex::Regex;
3131

@@ -235,16 +235,6 @@ pub fn run_tests(config: &Config) {
235235
os::setenv("RUST_TEST_TASKS","1");
236236
}
237237

238-
match config.mode {
239-
DebugInfoLldb => {
240-
// Some older versions of LLDB seem to have problems with multiple
241-
// instances running in parallel, so only run one test task at a
242-
// time.
243-
os::setenv("RUST_TEST_TASKS", "1");
244-
}
245-
_ => { /* proceed */ }
246-
}
247-
248238
let opts = test_opts(config);
249239
let tests = make_tests(config);
250240
// sadly osx needs some file descriptor limits raised for running tests in

branches/snap-stage3/src/compiletest/runtest.rs

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -653,7 +653,15 @@ fn run_debuginfo_lldb_test(config: &Config, props: &TestProps, testfile: &Path)
653653
script_str.push_str("version\n");
654654

655655
// Switch LLDB into "Rust mode"
656-
script_str.push_str("command script import ./src/etc/lldb_rust_formatters.py\n");
656+
let rust_src_root = find_rust_src_root(config)
657+
.expect("Could not find Rust source root");
658+
let rust_pp_module_rel_path = Path::new("./src/etc/lldb_rust_formatters.py");
659+
let rust_pp_module_abs_path = rust_src_root.join(rust_pp_module_rel_path)
660+
.as_str()
661+
.unwrap()
662+
.to_string();
663+
664+
script_str.push_str(format!("command script import {}\n", rust_pp_module_abs_path[])[]);
657665
script_str.push_str("type summary add --no-value ");
658666
script_str.push_str("--python-function lldb_rust_formatters.print_val ");
659667
script_str.push_str("-x \".*\" --category Rust\n");
@@ -683,18 +691,27 @@ fn run_debuginfo_lldb_test(config: &Config, props: &TestProps, testfile: &Path)
683691
let debugger_script = make_out_name(config, testfile, "debugger.script");
684692

685693
// Let LLDB execute the script via lldb_batchmode.py
686-
let debugger_run_result = run_lldb(config, &exe_file, &debugger_script);
694+
let debugger_run_result = run_lldb(config,
695+
&exe_file,
696+
&debugger_script,
697+
&rust_src_root);
687698

688699
if !debugger_run_result.status.success() {
689700
fatal_proc_rec("Error while running LLDB", &debugger_run_result);
690701
}
691702

692703
check_debugger_output(&debugger_run_result, check_lines.as_slice());
693704

694-
fn run_lldb(config: &Config, test_executable: &Path, debugger_script: &Path) -> ProcRes {
705+
fn run_lldb(config: &Config,
706+
test_executable: &Path,
707+
debugger_script: &Path,
708+
rust_src_root: &Path)
709+
-> ProcRes {
695710
// Prepare the lldb_batchmode which executes the debugger script
711+
let lldb_script_path = rust_src_root.join(Path::new("./src/etc/lldb_batchmode.py"));
712+
696713
let mut cmd = Command::new("python");
697-
cmd.arg("./src/etc/lldb_batchmode.py")
714+
cmd.arg(lldb_script_path)
698715
.arg(test_executable)
699716
.arg(debugger_script)
700717
.env_set_all([("PYTHONPATH", config.lldb_python_dir.clone().unwrap().as_slice())]);

branches/snap-stage3/src/doc/guide.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4326,7 +4326,7 @@ The most common consumer is `collect()`. This code doesn't quite compile,
43264326
but it shows the intention:
43274327

43284328
```{rust,ignore}
4329-
let one_to_one_hundred = range(0i, 100i).collect();
4329+
let one_to_one_hundred = range(1i, 101i).collect();
43304330
```
43314331

43324332
As you can see, we call `collect()` on our iterator. `collect()` takes
@@ -4336,7 +4336,7 @@ type of things you want to collect, and so you need to let it know.
43364336
Here's the version that does compile:
43374337

43384338
```{rust}
4339-
let one_to_one_hundred = range(0i, 100i).collect::<Vec<int>>();
4339+
let one_to_one_hundred = range(1i, 101i).collect::<Vec<int>>();
43404340
```
43414341

43424342
If you remember, the `::<>` syntax allows us to give a type hint,

branches/snap-stage3/src/etc/lldb_batchmode.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,11 @@ def listen():
141141
target_path = sys.argv[1]
142142
script_path = sys.argv[2]
143143

144+
print("LLDB batch-mode script")
145+
print("----------------------")
146+
print("Debugger commands script is '%s'." % script_path)
147+
print("Target executable is '%s'." % target_path)
148+
print("Current working directory is '%s'" % os.getcwd())
144149

145150
# Create a new debugger instance
146151
debugger = lldb.SBDebugger.Create()
@@ -151,10 +156,12 @@ def listen():
151156

152157
# Create a target from a file and arch
153158
print("Creating a target for '%s'" % target_path)
154-
target = debugger.CreateTargetWithFileAndArch(target_path, lldb.LLDB_ARCH_DEFAULT)
159+
target_error = lldb.SBError()
160+
target = debugger.CreateTarget(target_path, None, None, True, target_error)
155161

156162
if not target:
157-
print("Could not create debugging target '" + target_path + "'. Aborting.", file=sys.stderr)
163+
print("Could not create debugging target '" + target_path + "': " + str(target_error) +
164+
". Aborting.", file=sys.stderr)
158165
sys.exit(1)
159166

160167

branches/snap-stage3/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/snap-stage3/src/librustc/middle/traits/coherence.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,9 @@ pub fn impl_is_local(tcx: &ty::ctxt,
6767
return true;
6868
}
6969

70-
// Otherwise, self type must be local to the crate.
71-
let self_ty = ty::lookup_item_type(tcx, impl_def_id).ty;
72-
return ty_is_local(tcx, self_ty);
70+
// Otherwise, at least one of the input types must be local to the
71+
// crate.
72+
trait_ref.input_types().iter().any(|&t| ty_is_local(tcx, t))
7373
}
7474

7575
pub fn ty_is_local(tcx: &ty::ctxt,

branches/snap-stage3/src/librustdoc/passes.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,18 @@ impl<'a> fold::DocFolder for Stripper<'a> {
134134
clean::StructItem(..) | clean::EnumItem(..) |
135135
clean::TraitItem(..) | clean::FunctionItem(..) |
136136
clean::VariantItem(..) | clean::MethodItem(..) |
137-
clean::ForeignFunctionItem(..) | clean::ForeignStaticItem(..) |
137+
clean::ForeignFunctionItem(..) | clean::ForeignStaticItem(..) => {
138+
if ast_util::is_local(i.def_id) {
139+
if !self.exported_items.contains(&i.def_id.node) {
140+
return None;
141+
}
142+
// Traits are in exported_items even when they're totally private.
143+
if i.is_trait() && i.visibility != Some(ast::Public) {
144+
return None;
145+
}
146+
}
147+
}
148+
138149
clean::ConstantItem(..) => {
139150
if ast_util::is_local(i.def_id) &&
140151
!self.exported_items.contains(&i.def_id.node) {

branches/snap-stage3/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/snap-stage3/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
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
pub trait TheTrait<T> {
12+
fn the_fn(&self);
13+
}
14+
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
// aux-build:coherence-orphan-lib.rs
12+
13+
extern crate "coherence-orphan-lib" as lib;
14+
15+
use lib::TheTrait;
16+
17+
struct TheType;
18+
19+
impl TheTrait<uint> for int { } //~ ERROR E0117
20+
21+
impl TheTrait<TheType> for int { }
22+
23+
impl TheTrait<int> for TheType { }
24+
25+
fn main() { }

branches/snap-stage3/src/test/debuginfo/basic-types-globals-metadata.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
// ignore-windows: FIXME #13256
1212
// ignore-android: FIXME(#10381)
13+
// min-lldb-version: 310
1314

1415
// compile-flags:-g
1516
// gdb-command:rbreak zzz

branches/snap-stage3/src/test/debuginfo/basic-types-globals.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
// ignore-windows: FIXME #13256
1818
// ignore-android: FIXME(#10381)
19+
// min-lldb-version: 310
1920

2021
// compile-flags:-g
2122
// gdb-command:rbreak zzz

branches/snap-stage3/src/test/debuginfo/basic-types-metadata.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
// except according to those terms.
1010

1111
// ignore-android: FIXME(#10381)
12+
// min-lldb-version: 310
1213

1314
// compile-flags:-g
1415
// gdb-command:rbreak zzz

branches/snap-stage3/src/test/debuginfo/basic-types-mut-globals.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
// ignore-windows: FIXME #13256
1818
// ignore-android: FIXME(#10381)
19+
// min-lldb-version: 310
1920

2021
// compile-flags:-g
2122
// gdb-command:rbreak zzz

branches/snap-stage3/src/test/debuginfo/basic-types.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
// its numerical value.
1616

1717
// ignore-android: FIXME(#10381)
18+
// min-lldb-version: 310
1819

1920
// compile-flags:-g
2021

branches/snap-stage3/src/test/debuginfo/borrowed-basic.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
// its numerical value.
1515

1616
// compile-flags:-g
17+
// min-lldb-version: 310
1718

1819
// === GDB TESTS ===================================================================================
1920

0 commit comments

Comments
 (0)