Skip to content

Commit b669e35

Browse files
committed
---
yaml --- r: 193246 b: refs/heads/beta c: 2b27dfd h: refs/heads/master v: v3
1 parent a0a24a7 commit b669e35

Some content is hidden

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

46 files changed

+689
-401
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ refs/heads/automation-fail: 1bf06495443584539b958873e04cc2f864ab10e4
3131
refs/heads/issue-18208-method-dispatch-3-quick-reject: 2009f85b9f99dedcec4404418eda9ddba90258a2
3232
refs/heads/batch: b7fd822592a4fb577552d93010c4a4e14f314346
3333
refs/heads/building: 126db549b038c84269a1e4fe46f051b2c15d6970
34-
refs/heads/beta: 63513d06a23152763d677f01bc6a3dfb5b2bb295
34+
refs/heads/beta: 2b27dfd30ac5a95608d49e3425a3ff40f8da7dee
3535
refs/heads/windistfix: 7608dbad651f02e837ed05eef3d74a6662a6e928
3636
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
3737
refs/heads/tmp: de8a23bbc3a7b9cbd7574b5b91a34af59bf030e6

branches/beta/src/compiletest/compiletest.rs

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

2625
#![deny(warnings)]

branches/beta/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.iter() {
568+
for x in &vec {
569569
println!("{}", x);
570570
}
571571
```

branches/beta/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/beta/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 some output that looks something like this:
73+
You should see the version number, commit hash, commit date and build date:
7474

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

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

branches/beta/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, MacExpr};
75-
use syntax::ext::build::AstBuilder; // trait for expr_uint
74+
use syntax::ext::base::{ExtCtxt, MacResult, DummyResult, MacEager};
75+
use syntax::ext::build::AstBuilder; // trait for expr_usize
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-
MacExpr::new(cx.expr_uint(sp, total))
110+
MacEager::expr(cx.expr_usize(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_uint`](../syntax/ext/build/trait.AstBuilder.html#tymethod.expr_uint).
186+
[`AstBuilder::expr_usize`](../syntax/ext/build/trait.AstBuilder.html#tymethod.expr_usize).
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/beta/src/libcore/iter.rs

Lines changed: 20 additions & 34 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, T, S>(mut a: T, mut b: S) -> bool where
2877+
pub fn equals<A, L, R>(mut a: L, mut b: R) -> bool where
28782878
A: Eq,
2879-
T: Iterator<Item=A>,
2880-
S: Iterator<Item=A>,
2879+
L: Iterator<Item=A>,
2880+
R: 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, T, S>(mut a: T, mut b: S) -> cmp::Ordering where
2892+
pub fn cmp<A, L, R>(mut a: L, mut b: R) -> cmp::Ordering where
28932893
A: Ord,
2894-
T: Iterator<Item=A>,
2895-
S: Iterator<Item=A>,
2894+
L: Iterator<Item=A>,
2895+
R: Iterator<Item=A>,
28962896
{
28972897
loop {
28982898
match (a.next(), b.next()) {
@@ -2908,10 +2908,8 @@ pub mod order {
29082908
}
29092909

29102910
/// Order `a` and `b` lexicographically using `PartialOrd`
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>,
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>
29152913
{
29162914
loop {
29172915
match (a.next(), b.next()) {
@@ -2927,10 +2925,8 @@ pub mod order {
29272925
}
29282926

29292927
/// Compare `a` and `b` for equality (Using partial equality, `PartialEq`)
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>,
2928+
pub fn eq<L: Iterator, R: Iterator>(mut a: L, mut b: R) -> bool where
2929+
L::Item: PartialEq<R::Item>,
29342930
{
29352931
loop {
29362932
match (a.next(), b.next()) {
@@ -2942,10 +2938,8 @@ pub mod order {
29422938
}
29432939

29442940
/// Compare `a` and `b` for nonequality (Using partial equality, `PartialEq`)
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>,
2941+
pub fn ne<L: Iterator, R: Iterator>(mut a: L, mut b: R) -> bool where
2942+
L::Item: PartialEq<R::Item>,
29492943
{
29502944
loop {
29512945
match (a.next(), b.next()) {
@@ -2957,10 +2951,8 @@ pub mod order {
29572951
}
29582952

29592953
/// Return `a` < `b` lexicographically (Using partial order, `PartialOrd`)
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>,
2954+
pub fn lt<R: Iterator, L: Iterator>(mut a: L, mut b: R) -> bool where
2955+
L::Item: PartialOrd<R::Item>,
29642956
{
29652957
loop {
29662958
match (a.next(), b.next()) {
@@ -2973,10 +2965,8 @@ pub mod order {
29732965
}
29742966

29752967
/// Return `a` <= `b` lexicographically (Using partial order, `PartialOrd`)
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>,
2968+
pub fn le<L: Iterator, R: Iterator>(mut a: L, mut b: R) -> bool where
2969+
L::Item: PartialOrd<R::Item>,
29802970
{
29812971
loop {
29822972
match (a.next(), b.next()) {
@@ -2989,10 +2979,8 @@ pub mod order {
29892979
}
29902980

29912981
/// Return `a` > `b` lexicographically (Using partial order, `PartialOrd`)
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>,
2982+
pub fn gt<L: Iterator, R: Iterator>(mut a: L, mut b: R) -> bool where
2983+
L::Item: PartialOrd<R::Item>,
29962984
{
29972985
loop {
29982986
match (a.next(), b.next()) {
@@ -3005,10 +2993,8 @@ pub mod order {
30052993
}
30062994

30072995
/// Return `a` >= `b` lexicographically (Using partial order, `PartialOrd`)
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>,
2996+
pub fn ge<L: Iterator, R: Iterator>(mut a: L, mut b: R) -> bool where
2997+
L::Item: PartialOrd<R::Item>,
30122998
{
30132999
loop {
30143000
match (a.next(), b.next()) {

branches/beta/src/liblog/lib.rs

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

179178
use std::boxed;
180179
use std::cell::RefCell;

branches/beta/src/librustc/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
#![feature(int_uint)]
3232
#![feature(old_io)]
3333
#![feature(libc)]
34-
#![feature(env)]
3534
#![feature(old_path)]
3635
#![feature(quote)]
3736
#![feature(rustc_diagnostic_macros)]

branches/beta/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/beta/src/librustc/middle/traits/select.rs

Lines changed: 64 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -1716,6 +1716,60 @@ 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+
17191773
///////////////////////////////////////////////////////////////////////////
17201774
// CONFIRMATION
17211775
//
@@ -1854,38 +1908,15 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
18541908
nested: Vec<Ty<'tcx>>)
18551909
-> VtableBuiltinData<PredicateObligation<'tcx>>
18561910
{
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(),
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+
}
18871916
};
18881917

1918+
let obligations = self.collect_predicates_for_types(obligation, trait_def, nested);
1919+
18891920
let obligations = VecPerParamSpace::new(obligations, Vec::new(), Vec::new());
18901921

18911922
debug!("vtable_builtin_data: obligations={}",
@@ -1928,39 +1959,10 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
19281959
nested: Vec<Ty<'tcx>>)
19291960
-> VtableDefaultImplData<PredicateObligation<'tcx>>
19301961
{
1931-
let derived_cause = self.derived_cause(obligation, ImplDerivedObligation);
19321962

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-
};
1963+
let mut obligations = self.collect_predicates_for_types(obligation,
1964+
trait_def_id,
1965+
nested);
19641966

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

branches/beta/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_default_trait_impl<'tcx>(
340+
pub fn predicate_for_trait_def<'tcx>(
341341
tcx: &ty::ctxt<'tcx>,
342342
cause: ObligationCause<'tcx>,
343343
trait_def_id: ast::DefId,

branches/beta/src/librustc_back/lib.rs

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

4645
extern crate syntax;

0 commit comments

Comments
 (0)