Skip to content

Commit 4c714fe

Browse files
committed
---
yaml --- r: 157421 b: refs/heads/snap-stage3 c: 9f0c29a h: refs/heads/master i: 157419: cd37fbd v: v3
1 parent bf6d5c3 commit 4c714fe

Some content is hidden

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

50 files changed

+1585
-884
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: 370c9c54c2e9b9a308b4fa2a48460e0d54794729
4+
refs/heads/snap-stage3: 9f0c29af0263a13c123722122877f818dfec3b8f
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: 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/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/libcore/num/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1374,7 +1374,7 @@ macro_rules! checkeddiv_int_impl(
13741374
if *v == 0 || (*self == $min && *v == -1) {
13751375
None
13761376
} else {
1377-
Some(self / *v)
1377+
Some(*self / *v)
13781378
}
13791379
}
13801380
}
@@ -1395,7 +1395,7 @@ macro_rules! checkeddiv_uint_impl(
13951395
if *v == 0 {
13961396
None
13971397
} else {
1398-
Some(self / *v)
1398+
Some(*self / *v)
13991399
}
14001400
}
14011401
}

branches/snap-stage3/src/libcore/ops.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -638,7 +638,7 @@ shr_impl!(uint u8 u16 u32 u64 int i8 i16 i32 i64)
638638
* ```
639639
*/
640640
#[lang="index"]
641-
pub trait Index<Index, Result> {
641+
pub trait Index<Index, Sized? Result> {
642642
/// The method for the indexing (`Foo[Bar]`) operation
643643
fn index<'a>(&'a self, index: &Index) -> &'a Result;
644644
}

branches/snap-stage3/src/libcore/option.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ impl<T> Option<T> {
245245
/// ```
246246
/// let mut x = Some(2u);
247247
/// match x.as_mut() {
248-
/// Some(&ref mut v) => *v = 42,
248+
/// Some(v) => *v = 42,
249249
/// None => {},
250250
/// }
251251
/// assert_eq!(x, Some(42u));

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/borrowck/graphviz.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,8 @@ impl<'a, 'tcx> dot::Labeller<'a, Node<'a>, Edge<'a>> for DataflowLabeller<'a, 't
142142
}
143143

144144
impl<'a, 'tcx> dot::GraphWalk<'a, Node<'a>, Edge<'a>> for DataflowLabeller<'a, 'tcx> {
145-
fn nodes(&self) -> dot::Nodes<'a, Node<'a>> { self.inner.nodes() }
146-
fn edges(&self) -> dot::Edges<'a, Edge<'a>> { self.inner.edges() }
147-
fn source(&self, edge: &Edge<'a>) -> Node<'a> { self.inner.source(edge) }
148-
fn target(&self, edge: &Edge<'a>) -> Node<'a> { self.inner.target(edge) }
145+
fn nodes(&'a self) -> dot::Nodes<'a, Node<'a>> { self.inner.nodes() }
146+
fn edges(&'a self) -> dot::Edges<'a, Edge<'a>> { self.inner.edges() }
147+
fn source(&'a self, edge: &Edge<'a>) -> Node<'a> { self.inner.source(edge) }
148+
fn target(&'a self, edge: &Edge<'a>) -> Node<'a> { self.inner.target(edge) }
149149
}

branches/snap-stage3/src/librustc/middle/cfg/graphviz.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -91,29 +91,29 @@ impl<'a, 'ast> dot::Labeller<'a, Node<'a>, Edge<'a>> for LabelledCFG<'a, 'ast> {
9191
}
9292

9393
impl<'a> dot::GraphWalk<'a, Node<'a>, Edge<'a>> for &'a cfg::CFG {
94-
fn nodes(&self) -> dot::Nodes<'a, Node<'a>> {
94+
fn nodes(&'a self) -> dot::Nodes<'a, Node<'a>> {
9595
let mut v = Vec::new();
9696
self.graph.each_node(|i, nd| { v.push((i, nd)); true });
9797
dot::maybe_owned_vec::Growable(v)
9898
}
99-
fn edges(&self) -> dot::Edges<'a, Edge<'a>> {
99+
fn edges(&'a self) -> dot::Edges<'a, Edge<'a>> {
100100
self.graph.all_edges().iter().collect()
101101
}
102-
fn source(&self, edge: &Edge<'a>) -> Node<'a> {
102+
fn source(&'a self, edge: &Edge<'a>) -> Node<'a> {
103103
let i = edge.source();
104104
(i, self.graph.node(i))
105105
}
106-
fn target(&self, edge: &Edge<'a>) -> Node<'a> {
106+
fn target(&'a self, edge: &Edge<'a>) -> Node<'a> {
107107
let i = edge.target();
108108
(i, self.graph.node(i))
109109
}
110110
}
111111

112112
impl<'a, 'ast> dot::GraphWalk<'a, Node<'a>, Edge<'a>> for LabelledCFG<'a, 'ast>
113113
{
114-
fn nodes(&self) -> dot::Nodes<'a, Node<'a>> { self.cfg.nodes() }
115-
fn edges(&self) -> dot::Edges<'a, Edge<'a>> { self.cfg.edges() }
116-
fn source(&self, edge: &Edge<'a>) -> Node<'a> { self.cfg.source(edge) }
117-
fn target(&self, edge: &Edge<'a>) -> Node<'a> { self.cfg.target(edge) }
114+
fn nodes(&'a self) -> dot::Nodes<'a, Node<'a>> { self.cfg.nodes() }
115+
fn edges(&'a self) -> dot::Edges<'a, Edge<'a>> { self.cfg.edges() }
116+
fn source(&'a self, edge: &Edge<'a>) -> Node<'a> { self.cfg.source(edge) }
117+
fn target(&'a self, edge: &Edge<'a>) -> Node<'a> { self.cfg.target(edge) }
118118
}
119119

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/librustc/middle/traits/doc.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,4 +272,11 @@ nested obligation `int : Bar<U>` to find out that `U=uint`.
272272
It would be good to only do *just as much* nested resolution as
273273
necessary. Currently, though, we just do a full resolution.
274274
275+
## Method matching
276+
277+
Method dispach follows a slightly different path than normal trait
278+
selection. This is because it must account for the transformed self
279+
type of the receiver and various other complications. The procedure is
280+
described in `select.rs` in the "METHOD MATCHING" section.
281+
275282
*/

branches/snap-stage3/src/librustc/middle/traits/mod.rs

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ use syntax::codemap::{Span, DUMMY_SP};
2424
pub use self::fulfill::FulfillmentContext;
2525
pub use self::select::SelectionContext;
2626
pub use self::select::SelectionCache;
27+
pub use self::select::{MethodMatchResult, MethodMatched, MethodAmbiguous, MethodDidNotMatch};
28+
pub use self::select::{MethodMatchedData}; // intentionally don't export variants
2729
pub use self::util::supertraits;
2830
pub use self::util::transitive_bounds;
2931
pub use self::util::Supertraits;
@@ -219,22 +221,6 @@ pub struct VtableParamData {
219221
pub bound: Rc<ty::TraitRef>,
220222
}
221223

222-
pub fn evaluate_obligation<'a,'tcx>(infcx: &InferCtxt<'a,'tcx>,
223-
param_env: &ty::ParameterEnvironment,
224-
obligation: &Obligation,
225-
typer: &Typer<'tcx>)
226-
-> bool
227-
{
228-
/*!
229-
* Attempts to resolve the obligation given. Returns `None` if
230-
* we are unable to resolve, either because of ambiguity or
231-
* due to insufficient inference.
232-
*/
233-
234-
let mut selcx = select::SelectionContext::new(infcx, param_env, typer);
235-
selcx.evaluate_obligation(obligation)
236-
}
237-
238224
pub fn select_inherent_impl<'a,'tcx>(infcx: &InferCtxt<'a,'tcx>,
239225
param_env: &ty::ParameterEnvironment,
240226
typer: &Typer<'tcx>,

0 commit comments

Comments
 (0)