Skip to content

Commit 5b44d8a

Browse files
committed
---
yaml --- r: 187493 b: refs/heads/try c: 63513d0 h: refs/heads/master i: 187491: 7be8ea5 v: v3
1 parent ac676e2 commit 5b44d8a

Some content is hidden

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

48 files changed

+418
-707
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: b4c965ee803a4521d8b4575f634e036f93e408f3
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 3a96d6a9818fe2affc98a187fb1065120458cee9
5-
refs/heads/try: 890293655251c372ea99694c0c9f0795e2663286
5+
refs/heads/try: 63513d06a23152763d677f01bc6a3dfb5b2bb295
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
88
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596

branches/try/src/compiletest/compiletest.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#![feature(std_misc)]
2121
#![feature(test)]
2222
#![feature(unicode)]
23+
#![feature(env)]
2324
#![feature(core)]
2425

2526
#![deny(warnings)]

branches/try/src/doc/intro.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -536,7 +536,7 @@ use std::thread::Thread;
536536
537537
fn main() {
538538
let numbers = vec![1, 2, 3];
539-
539+
540540
let guards: Vec<_> = (0..3).map(|i| {
541541
Thread::scoped(move || {
542542
println!("{}", numbers[i]);
@@ -565,7 +565,7 @@ while retaining safety. The answer is iterators:
565565
```{rust}
566566
let vec = vec![1, 2, 3];
567567
568-
for x in &vec {
568+
for x in vec.iter() {
569569
println!("{}", x);
570570
}
571571
```

branches/try/src/doc/reference.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3765,9 +3765,9 @@ An example of creating and calling a closure:
37653765
```rust
37663766
let captured_var = 10;
37673767

3768-
let closure_no_args = || println!("captured_var={}", captured_var);
3768+
let closure_no_args = |&:| println!("captured_var={}", captured_var);
37693769

3770-
let closure_args = |arg: i32| -> i32 {
3770+
let closure_args = |&: arg: i32| -> i32 {
37713771
println!("captured_var={}, arg={}", captured_var, arg);
37723772
arg // Note lack of semicolon after 'arg'
37733773
};

branches/try/src/doc/trpl/installing-rust.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,10 @@ If you've got Rust installed, you can open up a shell, and type this:
7070
$ rustc --version
7171
```
7272

73-
You should see the version number, commit hash, commit date and build date:
73+
You should see some output that looks something like this:
7474

7575
```bash
76-
rustc 1.0.0-nightly (f11f3e7ba 2015-01-04) (built 2015-01-06)
76+
rustc 1.0.0-nightly (f11f3e7ba 2015-01-04 20:02:14 +0000)
7777
```
7878

7979
If you did, Rust has been installed successfully! Congrats!

branches/try/src/doc/trpl/plugins.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ extern crate rustc;
7171
use syntax::codemap::Span;
7272
use syntax::parse::token;
7373
use syntax::ast::{TokenTree, TtToken};
74-
use syntax::ext::base::{ExtCtxt, MacResult, DummyResult, MacEager};
75-
use syntax::ext::build::AstBuilder; // trait for expr_usize
74+
use syntax::ext::base::{ExtCtxt, MacResult, DummyResult, MacExpr};
75+
use syntax::ext::build::AstBuilder; // trait for expr_uint
7676
use rustc::plugin::Registry;
7777
7878
fn expand_rn(cx: &mut ExtCtxt, sp: Span, args: &[TokenTree])
@@ -107,7 +107,7 @@ fn expand_rn(cx: &mut ExtCtxt, sp: Span, args: &[TokenTree])
107107
}
108108
}
109109
110-
MacEager::expr(cx.expr_usize(sp, total))
110+
MacExpr::new(cx.expr_uint(sp, total))
111111
}
112112
113113
#[plugin_registrar]
@@ -183,7 +183,7 @@ with
183183
[`syntax::print::pprust::*_to_string`](http://doc.rust-lang.org/syntax/print/pprust/index.html#functions).
184184

185185
The example above produced an integer literal using
186-
[`AstBuilder::expr_usize`](../syntax/ext/build/trait.AstBuilder.html#tymethod.expr_usize).
186+
[`AstBuilder::expr_uint`](../syntax/ext/build/trait.AstBuilder.html#tymethod.expr_uint).
187187
As an alternative to the `AstBuilder` trait, `libsyntax` provides a set of
188188
[quasiquote macros](../syntax/ext/quote/index.html). They are undocumented and
189189
very rough around the edges. However, the implementation may be a good

branches/try/src/libcore/iter.rs

Lines changed: 34 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2874,10 +2874,10 @@ pub mod order {
28742874
use super::Iterator;
28752875

28762876
/// Compare `a` and `b` for equality using `Eq`
2877-
pub fn equals<A, L, R>(mut a: L, mut b: R) -> bool where
2877+
pub fn equals<A, T, S>(mut a: T, mut b: S) -> bool where
28782878
A: Eq,
2879-
L: Iterator<Item=A>,
2880-
R: Iterator<Item=A>,
2879+
T: Iterator<Item=A>,
2880+
S: Iterator<Item=A>,
28812881
{
28822882
loop {
28832883
match (a.next(), b.next()) {
@@ -2889,10 +2889,10 @@ pub mod order {
28892889
}
28902890

28912891
/// Order `a` and `b` lexicographically using `Ord`
2892-
pub fn cmp<A, L, R>(mut a: L, mut b: R) -> cmp::Ordering where
2892+
pub fn cmp<A, T, S>(mut a: T, mut b: S) -> cmp::Ordering where
28932893
A: Ord,
2894-
L: Iterator<Item=A>,
2895-
R: Iterator<Item=A>,
2894+
T: Iterator<Item=A>,
2895+
S: Iterator<Item=A>,
28962896
{
28972897
loop {
28982898
match (a.next(), b.next()) {
@@ -2908,8 +2908,10 @@ pub mod order {
29082908
}
29092909

29102910
/// Order `a` and `b` lexicographically using `PartialOrd`
2911-
pub fn partial_cmp<L: Iterator, R: Iterator>(mut a: L, mut b: R) -> Option<cmp::Ordering> where
2912-
L::Item: PartialOrd<R::Item>
2911+
pub fn partial_cmp<A, T, S>(mut a: T, mut b: S) -> Option<cmp::Ordering> where
2912+
A: PartialOrd,
2913+
T: Iterator<Item=A>,
2914+
S: Iterator<Item=A>,
29132915
{
29142916
loop {
29152917
match (a.next(), b.next()) {
@@ -2925,8 +2927,10 @@ pub mod order {
29252927
}
29262928

29272929
/// Compare `a` and `b` for equality (Using partial equality, `PartialEq`)
2928-
pub fn eq<L: Iterator, R: Iterator>(mut a: L, mut b: R) -> bool where
2929-
L::Item: PartialEq<R::Item>,
2930+
pub fn eq<A, B, L, R>(mut a: L, mut b: R) -> bool where
2931+
A: PartialEq<B>,
2932+
L: Iterator<Item=A>,
2933+
R: Iterator<Item=B>,
29302934
{
29312935
loop {
29322936
match (a.next(), b.next()) {
@@ -2938,8 +2942,10 @@ pub mod order {
29382942
}
29392943

29402944
/// Compare `a` and `b` for nonequality (Using partial equality, `PartialEq`)
2941-
pub fn ne<L: Iterator, R: Iterator>(mut a: L, mut b: R) -> bool where
2942-
L::Item: PartialEq<R::Item>,
2945+
pub fn ne<A, B, L, R>(mut a: L, mut b: R) -> bool where
2946+
A: PartialEq<B>,
2947+
L: Iterator<Item=A>,
2948+
R: Iterator<Item=B>,
29432949
{
29442950
loop {
29452951
match (a.next(), b.next()) {
@@ -2951,8 +2957,10 @@ pub mod order {
29512957
}
29522958

29532959
/// Return `a` < `b` lexicographically (Using partial order, `PartialOrd`)
2954-
pub fn lt<R: Iterator, L: Iterator>(mut a: L, mut b: R) -> bool where
2955-
L::Item: PartialOrd<R::Item>,
2960+
pub fn lt<A, T, S>(mut a: T, mut b: S) -> bool where
2961+
A: PartialOrd,
2962+
T: Iterator<Item=A>,
2963+
S: Iterator<Item=A>,
29562964
{
29572965
loop {
29582966
match (a.next(), b.next()) {
@@ -2965,8 +2973,10 @@ pub mod order {
29652973
}
29662974

29672975
/// Return `a` <= `b` lexicographically (Using partial order, `PartialOrd`)
2968-
pub fn le<L: Iterator, R: Iterator>(mut a: L, mut b: R) -> bool where
2969-
L::Item: PartialOrd<R::Item>,
2976+
pub fn le<A, T, S>(mut a: T, mut b: S) -> bool where
2977+
A: PartialOrd,
2978+
T: Iterator<Item=A>,
2979+
S: Iterator<Item=A>,
29702980
{
29712981
loop {
29722982
match (a.next(), b.next()) {
@@ -2979,8 +2989,10 @@ pub mod order {
29792989
}
29802990

29812991
/// Return `a` > `b` lexicographically (Using partial order, `PartialOrd`)
2982-
pub fn gt<L: Iterator, R: Iterator>(mut a: L, mut b: R) -> bool where
2983-
L::Item: PartialOrd<R::Item>,
2992+
pub fn gt<A, T, S>(mut a: T, mut b: S) -> bool where
2993+
A: PartialOrd,
2994+
T: Iterator<Item=A>,
2995+
S: Iterator<Item=A>,
29842996
{
29852997
loop {
29862998
match (a.next(), b.next()) {
@@ -2993,8 +3005,10 @@ pub mod order {
29933005
}
29943006

29953007
/// Return `a` >= `b` lexicographically (Using partial order, `PartialOrd`)
2996-
pub fn ge<L: Iterator, R: Iterator>(mut a: L, mut b: R) -> bool where
2997-
L::Item: PartialOrd<R::Item>,
3008+
pub fn ge<A, T, S>(mut a: T, mut b: S) -> bool where
3009+
A: PartialOrd,
3010+
T: Iterator<Item=A>,
3011+
S: Iterator<Item=A>,
29983012
{
29993013
loop {
30003014
match (a.next(), b.next()) {

branches/try/src/liblog/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@
174174
#![feature(core)]
175175
#![feature(old_io)]
176176
#![feature(std_misc)]
177+
#![feature(env)]
177178

178179
use std::boxed;
179180
use std::cell::RefCell;

branches/try/src/librustc/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
#![feature(int_uint)]
3232
#![feature(old_io)]
3333
#![feature(libc)]
34+
#![feature(env)]
3435
#![feature(old_path)]
3536
#![feature(quote)]
3637
#![feature(rustc_diagnostic_macros)]

branches/try/src/librustc/middle/const_eval.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ pub fn eval_const_expr_partial<'tcx>(tcx: &ty::ctxt<'tcx>,
257257
}
258258
}
259259
(Ok(const_int(a)), Ok(const_int(b))) => {
260-
let is_a_min_value = || {
260+
let is_a_min_value = |&:| {
261261
let int_ty = match ty::expr_ty_opt(tcx, e).map(|ty| &ty.sty) {
262262
Some(&ty::ty_int(int_ty)) => int_ty,
263263
_ => return false

branches/try/src/librustc/middle/traits/select.rs

Lines changed: 62 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1716,60 +1716,6 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
17161716
}
17171717
}
17181718

1719-
fn collect_predicates_for_types(&mut self,
1720-
obligation: &TraitObligation<'tcx>,
1721-
trait_def_id: ast::DefId,
1722-
types: Vec<Ty<'tcx>>) -> Vec<PredicateObligation<'tcx>> {
1723-
1724-
let derived_cause = match self.tcx().lang_items.to_builtin_kind(trait_def_id) {
1725-
Some(_) => {
1726-
self.derived_cause(obligation, BuiltinDerivedObligation)
1727-
},
1728-
None => {
1729-
self.derived_cause(obligation, ImplDerivedObligation)
1730-
}
1731-
};
1732-
1733-
let normalized = project::normalize_with_depth(self, obligation.cause.clone(),
1734-
obligation.recursion_depth + 1,
1735-
&types);
1736-
1737-
let obligations = normalized.value.iter().map(|&nested_ty| {
1738-
// the obligation might be higher-ranked, e.g. for<'a> &'a
1739-
// int : Copy. In that case, we will wind up with
1740-
// late-bound regions in the `nested` vector. So for each
1741-
// one we instantiate to a skolemized region, do our work
1742-
// to produce something like `&'0 int : Copy`, and then
1743-
// re-bind it. This is a bit of busy-work but preserves
1744-
// the invariant that we only manipulate free regions, not
1745-
// bound ones.
1746-
self.infcx.try(|snapshot| {
1747-
let (skol_ty, skol_map) =
1748-
self.infcx().skolemize_late_bound_regions(&ty::Binder(nested_ty), snapshot);
1749-
let skol_predicate =
1750-
util::predicate_for_trait_def(
1751-
self.tcx(),
1752-
derived_cause.clone(),
1753-
trait_def_id,
1754-
obligation.recursion_depth + 1,
1755-
skol_ty);
1756-
match skol_predicate {
1757-
Ok(skol_predicate) => Ok(self.infcx().plug_leaks(skol_map, snapshot,
1758-
&skol_predicate)),
1759-
Err(ErrorReported) => Err(ErrorReported)
1760-
}
1761-
})
1762-
}).collect::<Result<Vec<PredicateObligation<'tcx>>, _>>();
1763-
1764-
match obligations {
1765-
Ok(mut obls) => {
1766-
obls.push_all(normalized.obligations.as_slice());
1767-
obls
1768-
},
1769-
Err(ErrorReported) => Vec::new()
1770-
}
1771-
}
1772-
17731719
///////////////////////////////////////////////////////////////////////////
17741720
// CONFIRMATION
17751721
//
@@ -1908,15 +1854,38 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
19081854
nested: Vec<Ty<'tcx>>)
19091855
-> VtableBuiltinData<PredicateObligation<'tcx>>
19101856
{
1911-
let trait_def = match self.tcx().lang_items.from_builtin_kind(bound) {
1912-
Ok(def_id) => def_id,
1913-
Err(_) => {
1914-
self.tcx().sess.bug("builtin trait definition not found");
1915-
}
1857+
let derived_cause = self.derived_cause(obligation, BuiltinDerivedObligation);
1858+
let obligations = nested.iter().map(|&bound_ty| {
1859+
// the obligation might be higher-ranked, e.g. for<'a> &'a
1860+
// int : Copy. In that case, we will wind up with
1861+
// late-bound regions in the `nested` vector. So for each
1862+
// one we instantiate to a skolemized region, do our work
1863+
// to produce something like `&'0 int : Copy`, and then
1864+
// re-bind it. This is a bit of busy-work but preserves
1865+
// the invariant that we only manipulate free regions, not
1866+
// bound ones.
1867+
self.infcx.try(|snapshot| {
1868+
let (skol_ty, skol_map) =
1869+
self.infcx().skolemize_late_bound_regions(&ty::Binder(bound_ty), snapshot);
1870+
let skol_predicate =
1871+
util::predicate_for_builtin_bound(
1872+
self.tcx(),
1873+
derived_cause.clone(),
1874+
bound,
1875+
obligation.recursion_depth + 1,
1876+
skol_ty);
1877+
match skol_predicate {
1878+
Ok(skol_predicate) => Ok(self.infcx().plug_leaks(skol_map, snapshot,
1879+
&skol_predicate)),
1880+
Err(ErrorReported) => Err(ErrorReported)
1881+
}
1882+
})
1883+
}).collect::<Result<_, _>>();
1884+
let obligations = match obligations {
1885+
Ok(o) => o,
1886+
Err(ErrorReported) => Vec::new(),
19161887
};
19171888

1918-
let obligations = self.collect_predicates_for_types(obligation, trait_def, nested);
1919-
19201889
let obligations = VecPerParamSpace::new(obligations, Vec::new(), Vec::new());
19211890

19221891
debug!("vtable_builtin_data: obligations={}",
@@ -1959,10 +1928,39 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
19591928
nested: Vec<Ty<'tcx>>)
19601929
-> VtableDefaultImplData<PredicateObligation<'tcx>>
19611930
{
1931+
let derived_cause = self.derived_cause(obligation, ImplDerivedObligation);
19621932

1963-
let mut obligations = self.collect_predicates_for_types(obligation,
1964-
trait_def_id,
1965-
nested);
1933+
let obligations = nested.iter().map(|&nested_ty| {
1934+
// the obligation might be higher-ranked, e.g. for<'a> &'a
1935+
// int : Copy. In that case, we will wind up with
1936+
// late-bound regions in the `nested` vector. So for each
1937+
// one we instantiate to a skolemized region, do our work
1938+
// to produce something like `&'0 int : Copy`, and then
1939+
// re-bind it. This is a bit of busy-work but preserves
1940+
// the invariant that we only manipulate free regions, not
1941+
// bound ones.
1942+
self.infcx.try(|snapshot| {
1943+
let (skol_ty, skol_map) =
1944+
self.infcx().skolemize_late_bound_regions(&ty::Binder(nested_ty), snapshot);
1945+
let skol_predicate =
1946+
util::predicate_for_default_trait_impl(
1947+
self.tcx(),
1948+
derived_cause.clone(),
1949+
trait_def_id,
1950+
obligation.recursion_depth + 1,
1951+
skol_ty);
1952+
match skol_predicate {
1953+
Ok(skol_predicate) => Ok(self.infcx().plug_leaks(skol_map, snapshot,
1954+
&skol_predicate)),
1955+
Err(ErrorReported) => Err(ErrorReported)
1956+
}
1957+
})
1958+
}).collect::<Result<_, _>>();
1959+
1960+
let mut obligations = match obligations {
1961+
Ok(o) => o,
1962+
Err(ErrorReported) => Vec::new()
1963+
};
19661964

19671965
let _: Result<(),()> = self.infcx.try(|snapshot| {
19681966
let (_, skol_map) =

branches/try/src/librustc/middle/traits/util.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ pub fn predicate_for_trait_ref<'tcx>(
337337
})
338338
}
339339

340-
pub fn predicate_for_trait_def<'tcx>(
340+
pub fn predicate_for_default_trait_impl<'tcx>(
341341
tcx: &ty::ctxt<'tcx>,
342342
cause: ObligationCause<'tcx>,
343343
trait_def_id: ast::DefId,

branches/try/src/librustc_back/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
#![feature(old_path)]
4141
#![feature(rustc_private)]
4242
#![feature(staged_api)]
43+
#![feature(env)]
4344
#![feature(path)]
4445

4546
extern crate syntax;

0 commit comments

Comments
 (0)