Skip to content

Commit 94fc9c0

Browse files
committed
---
yaml --- r: 179574 b: refs/heads/master c: 8122ce8 h: refs/heads/master v: v3
1 parent dc8e462 commit 94fc9c0

File tree

37 files changed

+318
-3040
lines changed

37 files changed

+318
-3040
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 29ff00cc97e67ed6aec16aa6c30e152d6065e952
2+
refs/heads/master: 8122ce81d0909bed39c6df3e47bc751851bded84
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 0ba9e1fa52627404a1e5b90f745f96a872a0c564
55
refs/heads/try: ccf8fedf1cffcb8f6f3581d53d220039e192fe77

trunk/configure

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -653,7 +653,9 @@ probe CFG_GRUN grun
653653
probe CFG_FLEX flex
654654
probe CFG_BISON bison
655655
probe CFG_PANDOC pandoc
656+
probe CFG_PDFLATEX pdflatex
656657
probe CFG_XELATEX xelatex
658+
probe CFG_LUALATEX lualatex
657659
probe CFG_GDB gdb
658660
probe CFG_LLDB lldb
659661

trunk/mk/docs.mk

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -85,16 +85,27 @@ else
8585
HTML_DEPS :=
8686
endif
8787

88-
# Check for xelatex
89-
90-
ifeq ($(CFG_XELATEX),)
88+
# Check for the various external utilities for the EPUB/PDF docs:
89+
90+
ifeq ($(CFG_LUALATEX),)
91+
$(info cfg: no lualatex found, deferring to xelatex)
92+
ifeq ($(CFG_XELATEX),)
93+
$(info cfg: no xelatex found, deferring to pdflatex)
94+
ifeq ($(CFG_PDFLATEX),)
95+
$(info cfg: no pdflatex found, disabling LaTeX docs)
96+
NO_PDF_DOCS = 1
97+
else
98+
CFG_LATEX := $(CFG_PDFLATEX)
99+
endif
100+
else
91101
CFG_LATEX := $(CFG_XELATEX)
92102
XELATEX = 1
93-
else
94-
$(info cfg: no xelatex found, disabling LaTeX docs)
95-
NO_PDF_DOCS = 1
103+
endif
104+
else
105+
CFG_LATEX := $(CFG_LUALATEX)
96106
endif
97107

108+
98109
ifeq ($(CFG_PANDOC),)
99110
$(info cfg: no pandoc found, omitting PDF and EPUB docs)
100111
ONLY_HTML_DOCS = 1

trunk/src/libcollections/str.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ pub use core::str::{Lines, LinesAny, MatchIndices, SplitStr, CharRange};
8080
pub use core::str::{Split, SplitTerminator};
8181
pub use core::str::{SplitN, RSplitN};
8282
pub use core::str::{from_utf8, CharEq, Chars, CharIndices, Bytes};
83-
pub use core::str::{from_utf8_unchecked, from_c_str, ParseBoolError};
83+
pub use core::str::{from_utf8_unchecked, from_c_str};
8484
pub use unicode::str::{Words, Graphemes, GraphemeIndices};
8585

8686
/*

trunk/src/libcollections/vec.rs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -690,8 +690,7 @@ impl<T> Vec<T> {
690690
/// Panics if the number of elements in the vector overflows a `usize`.
691691
///
692692
/// # Examples
693-
///
694-
/// ```
693+
/// ```rust
695694
/// let mut vec = vec![1, 2, 3];
696695
/// let mut vec2 = vec![4, 5, 6];
697696
/// vec.append(&mut vec2);
@@ -1003,13 +1002,8 @@ impl<T> Vec<T> {
10031002
///
10041003
/// Note that the capacity of `self` does not change.
10051004
///
1006-
/// # Panics
1007-
///
1008-
/// Panics if `at > len`.
1009-
///
10101005
/// # Examples
1011-
///
1012-
/// ```
1006+
/// ```rust
10131007
/// let mut vec = vec![1,2,3];
10141008
/// let vec2 = vec.split_off(1);
10151009
/// assert_eq!(vec, vec![1]);
@@ -1019,7 +1013,7 @@ impl<T> Vec<T> {
10191013
#[unstable(feature = "collections",
10201014
reason = "new API, waiting for dust to settle")]
10211015
pub fn split_off(&mut self, at: usize) -> Self {
1022-
assert!(at <= self.len(), "`at` out of bounds");
1016+
assert!(at < self.len(), "`at` out of bounds");
10231017

10241018
let other_len = self.len - at;
10251019
let mut other = Vec::with_capacity(other_len);

trunk/src/librustc/diagnostics.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,8 @@ register_diagnostics! {
126126
E0312, // lifetime of reference outlives lifetime of borrowed content
127127
E0313, // lifetime of borrowed pointer outlives lifetime of captured variable
128128
E0314, // closure outlives stack frame
129-
E0315 // cannot invoke closure outside of its lifetime
129+
E0315, // cannot invoke closure outside of its lifetime
130+
E0316 // nested quantification of lifetimes
130131
}
131132

132133
__build_diagnostic_array! { DIAGNOSTICS }

trunk/src/librustc/middle/infer/error_reporting.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1076,7 +1076,8 @@ impl<'a, 'tcx> Rebuilder<'a, 'tcx> {
10761076
trait_ref: ast::TraitRef {
10771077
path: new_path,
10781078
ref_id: tr.ref_id,
1079-
}
1079+
},
1080+
span: poly_tr.span,
10801081
}, modifier)
10811082
}
10821083
}

trunk/src/librustc/middle/resolve_lifetime.rs

Lines changed: 52 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,31 @@ pub enum DefRegion {
4545
/* lifetime decl */ ast::NodeId),
4646
}
4747

48-
// maps the id of each lifetime reference to the lifetime decl
49-
// that it corresponds to
48+
// Maps the id of each lifetime reference to the lifetime decl
49+
// that it corresponds to.
5050
pub type NamedRegionMap = NodeMap<DefRegion>;
5151

5252
struct LifetimeContext<'a> {
5353
sess: &'a Session,
5454
named_region_map: &'a mut NamedRegionMap,
5555
scope: Scope<'a>,
5656
def_map: &'a DefMap,
57+
// Deep breath. Our representation for poly trait refs contains a single
58+
// binder and thus we only allow a single level of quantification. However,
59+
// the syntax of Rust permits quantification in two places, e.g., `T: for <'a> Foo<'a>`
60+
// and `for <'a, 'b> &'b T: Foo<'a>`. In order to get the de Bruijn indices
61+
// correct when representing these constraints, we should only introduce one
62+
// scope. However, we want to support both locations for the quantifier and
63+
// during lifetime resolution we want precise information (so we can't
64+
// desugar in an earlier phase).
65+
66+
// SO, if we encounter a quantifier at the outer scope, we set
67+
// trait_ref_hack to true (and introduce a scope), and then if we encounter
68+
// a quantifier at the inner scope, we error. If trait_ref_hack is false,
69+
// then we introduce the scope at the inner quantifier.
70+
71+
// I'm sorry.
72+
trait_ref_hack: bool,
5773
}
5874

5975
enum ScopeChain<'a> {
@@ -80,6 +96,7 @@ pub fn krate(sess: &Session, krate: &ast::Crate, def_map: &DefMap) -> NamedRegio
8096
named_region_map: &mut named_region_map,
8197
scope: &ROOT_SCOPE,
8298
def_map: def_map,
99+
trait_ref_hack: false,
83100
}, krate);
84101
sess.abort_if_errors();
85102
named_region_map
@@ -198,9 +215,22 @@ impl<'a, 'v> Visitor<'v> for LifetimeContext<'a> {
198215
match predicate {
199216
&ast::WherePredicate::BoundPredicate(ast::WhereBoundPredicate{ ref bounded_ty,
200217
ref bounds,
218+
ref bound_lifetimes,
201219
.. }) => {
202-
self.visit_ty(&**bounded_ty);
203-
visit::walk_ty_param_bounds_helper(self, bounds);
220+
if bound_lifetimes.len() > 0 {
221+
self.trait_ref_hack = true;
222+
let result = self.with(LateScope(bound_lifetimes, self.scope),
223+
|old_scope, this| {
224+
this.check_lifetime_defs(old_scope, bound_lifetimes);
225+
this.visit_ty(&**bounded_ty);
226+
visit::walk_ty_param_bounds_helper(this, bounds);
227+
});
228+
self.trait_ref_hack = false;
229+
result
230+
} else {
231+
self.visit_ty(&**bounded_ty);
232+
visit::walk_ty_param_bounds_helper(self, bounds);
233+
}
204234
}
205235
&ast::WherePredicate::RegionPredicate(ast::WhereRegionPredicate{ref lifetime,
206236
ref bounds,
@@ -222,18 +252,27 @@ impl<'a, 'v> Visitor<'v> for LifetimeContext<'a> {
222252
}
223253
}
224254

225-
fn visit_poly_trait_ref(&mut self, trait_ref:
226-
&ast::PolyTraitRef,
255+
fn visit_poly_trait_ref(&mut self,
256+
trait_ref: &ast::PolyTraitRef,
227257
_modifier: &ast::TraitBoundModifier) {
228258
debug!("visit_poly_trait_ref trait_ref={:?}", trait_ref);
229259

230-
self.with(LateScope(&trait_ref.bound_lifetimes, self.scope), |old_scope, this| {
231-
this.check_lifetime_defs(old_scope, &trait_ref.bound_lifetimes);
232-
for lifetime in &trait_ref.bound_lifetimes {
233-
this.visit_lifetime_def(lifetime);
260+
if !self.trait_ref_hack || trait_ref.bound_lifetimes.len() > 0 {
261+
if self.trait_ref_hack {
262+
println!("{:?}", trait_ref.span);
263+
span_err!(self.sess, trait_ref.span, E0316,
264+
"nested quantification of lifetimes");
234265
}
235-
this.visit_trait_ref(&trait_ref.trait_ref)
236-
})
266+
self.with(LateScope(&trait_ref.bound_lifetimes, self.scope), |old_scope, this| {
267+
this.check_lifetime_defs(old_scope, &trait_ref.bound_lifetimes);
268+
for lifetime in &trait_ref.bound_lifetimes {
269+
this.visit_lifetime_def(lifetime);
270+
}
271+
this.visit_trait_ref(&trait_ref.trait_ref)
272+
})
273+
} else {
274+
self.visit_trait_ref(&trait_ref.trait_ref)
275+
}
237276
}
238277

239278
fn visit_trait_ref(&mut self, trait_ref: &ast::TraitRef) {
@@ -251,6 +290,7 @@ impl<'a> LifetimeContext<'a> {
251290
named_region_map: *named_region_map,
252291
scope: &wrap_scope,
253292
def_map: self.def_map,
293+
trait_ref_hack: self.trait_ref_hack,
254294
};
255295
debug!("entering scope {:?}", this.scope);
256296
f(self.scope, &mut this);

trunk/src/librustc/middle/ty.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1478,7 +1478,7 @@ impl<'tcx> PolyTraitRef<'tcx> {
14781478
/// compiler's representation for things like `for<'a> Fn(&'a int)`
14791479
/// (which would be represented by the type `PolyTraitRef ==
14801480
/// Binder<TraitRef>`). Note that when we skolemize, instantiate,
1481-
/// erase, or otherwise "discharge" these bound reons, we change the
1481+
/// erase, or otherwise "discharge" these bound regions, we change the
14821482
/// type from `Binder<T>` to just `T` (see
14831483
/// e.g. `liberate_late_bound_regions`).
14841484
#[derive(Clone, PartialEq, Eq, Hash, Debug)]

trunk/src/librustc/session/config.rs

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,9 @@ use syntax::diagnostic::{ColorConfig, Auto, Always, Never, SpanHandler};
3333
use syntax::parse;
3434
use syntax::parse::token::InternedString;
3535

36-
use getopts;
3736
use std::collections::HashMap;
3837
use std::collections::hash_map::Entry::{Occupied, Vacant};
39-
use std::env;
38+
use getopts;
4039
use std::fmt;
4140

4241
use llvm;
@@ -822,6 +821,7 @@ pub fn parse_cfgspecs(cfgspecs: Vec<String> ) -> ast::CrateConfig {
822821
}
823822

824823
pub fn build_session_options(matches: &getopts::Matches) -> Options {
824+
825825
let unparsed_crate_types = matches.opt_strs("crate-type");
826826
let crate_types = parse_crate_types_from_list(unparsed_crate_types)
827827
.unwrap_or_else(|e| early_error(&e[]));
@@ -1041,22 +1041,7 @@ pub fn build_session_options(matches: &getopts::Matches) -> Options {
10411041
crate_name: crate_name,
10421042
alt_std_name: None,
10431043
libs: libs,
1044-
unstable_features: get_unstable_features_setting(),
1045-
}
1046-
}
1047-
1048-
pub fn get_unstable_features_setting() -> UnstableFeatures {
1049-
// Whether this is a feature-staged build, i.e. on the beta or stable channel
1050-
let disable_unstable_features = option_env!("CFG_DISABLE_UNSTABLE_FEATURES").is_some();
1051-
// The secret key needed to get through the rustc build itself by
1052-
// subverting the unstable features lints
1053-
let bootstrap_secret_key = option_env!("CFG_BOOTSTRAP_KEY");
1054-
// The matching key to the above, only known by the build system
1055-
let bootstrap_provided_key = env::var_string("RUSTC_BOOTSTRAP_KEY").ok();
1056-
match (disable_unstable_features, bootstrap_secret_key, bootstrap_provided_key) {
1057-
(_, Some(ref s), Some(ref p)) if s == p => UnstableFeatures::Cheat,
1058-
(true, _, _) => UnstableFeatures::Disallow,
1059-
(false, _, _) => UnstableFeatures::Default
1044+
unstable_features: UnstableFeatures::Disallow
10601045
}
10611046
}
10621047

trunk/src/librustc_driver/driver.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
22
// file at the top-level directory of this distribution and at
33
// http://rust-lang.org/COPYRIGHT.
44
//
@@ -27,7 +27,6 @@ use rustc_trans::back::write;
2727
use rustc_trans::trans;
2828
use rustc_typeck as typeck;
2929
use rustc_privacy;
30-
use super::Compilation;
3130

3231
use serialize::json;
3332

@@ -56,7 +55,7 @@ pub fn compile_input(sess: Session,
5655
let state = $make_state;
5756
(control.$point.callback)(state);
5857
}
59-
if control.$point.stop == Compilation::Stop {
58+
if control.$point.stop {
6059
return;
6160
}
6261
})}
@@ -207,14 +206,14 @@ impl<'a> CompileController<'a> {
207206
}
208207

209208
pub struct PhaseController<'a> {
210-
pub stop: Compilation,
209+
pub stop: bool,
211210
pub callback: Box<Fn(CompileState) -> () + 'a>,
212211
}
213212

214213
impl<'a> PhaseController<'a> {
215214
pub fn basic() -> PhaseController<'a> {
216215
PhaseController {
217-
stop: Compilation::Continue,
216+
stop: false,
218217
callback: box |_| {},
219218
}
220219
}

0 commit comments

Comments
 (0)