Skip to content

Commit 10c88b6

Browse files
committed
---
yaml --- r: 277901 b: refs/heads/auto c: 700d3e2 h: refs/heads/master i: 277899: 17dd37d
1 parent b1f3b1a commit 10c88b6

File tree

24 files changed

+488
-637
lines changed

24 files changed

+488
-637
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
88
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
99
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1010
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
11-
refs/heads/auto: a70e42a953d71e356e170de8b6bd525d4a32dc4d
11+
refs/heads/auto: 700d3e23748c10c4203491856186333dd2952ebf
1212
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c
1313
refs/tags/0.1: b19db808c2793fe2976759b85a355c3ad8c8b336
1414
refs/tags/0.2: 1754d02027f2924bed83b0160ee340c7f41d5ea1

branches/auto/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Read ["Installing Rust"] from [The Book].
1616

1717
1. Make sure you have installed the dependencies:
1818

19-
* `g++` 4.7 or `clang++` 3.x
19+
* `g++` 4.7 or later or `clang++` 3.x
2020
* `python` 2.7 (but not 3.x)
2121
* GNU `make` 3.81 or later
2222
* `curl`

branches/auto/configure

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1453,6 +1453,19 @@ then
14531453
cd ${CFG_BUILD_DIR}
14541454
fi
14551455

1456+
# Do a sanity check that the submodule source exists. Because GitHub
1457+
# automatically publishes broken tarballs that can't be disabled, and
1458+
# people download them and try to use them.
1459+
if [ ! -e "${CFG_SRC_DIR}/src/liblibc" ]; then
1460+
err "some submodules are missing. Is this a broken tarball?
1461+
1462+
If you downloaded this tarball from the GitHub release pages at
1463+
https://github.com/rust-lang/rust/releases,
1464+
then please delete it and instead download the source from
1465+
https://www.rust-lang.org/downloads.html"
1466+
1467+
fi
1468+
14561469
# Configure llvm, only if necessary
14571470
step_msg "looking at LLVM"
14581471
CFG_LLVM_SRC_DIR=${CFG_SRC_DIR}src/llvm/

branches/auto/src/libcollections/btree/map.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1654,6 +1654,15 @@ impl<'a, K: Ord, V> Entry<'a, K, V> {
16541654
Vacant(entry) => entry.insert(default()),
16551655
}
16561656
}
1657+
1658+
/// Returns a reference to this entry's key.
1659+
#[unstable(feature = "map_entry_keys", issue = "32281")]
1660+
pub fn key(&self) -> &K {
1661+
match *self {
1662+
Occupied(ref entry) => entry.key(),
1663+
Vacant(ref entry) => entry.key(),
1664+
}
1665+
}
16571666
}
16581667

16591668
impl<'a, K: Ord, V> VacantEntry<'a, K, V> {

branches/auto/src/libcollections/btree/set.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -477,9 +477,9 @@ impl<T: Ord> BTreeSet<T> {
477477

478478
/// Adds a value to the set.
479479
///
480-
/// If the set did not have a value present, `true` is returned.
480+
/// If the set did not have this value present, `true` is returned.
481481
///
482-
/// If the set did have this key present, `false` is returned, and the
482+
/// If the set did have this value present, `false` is returned, and the
483483
/// entry is not updated. See the [module-level documentation] for more.
484484
///
485485
/// [module-level documentation]: index.html#insert-and-complex-keys

branches/auto/src/librustc/hir/lowering.rs

Lines changed: 336 additions & 569 deletions
Large diffs are not rendered by default.

branches/auto/src/librustc_driver/driver.rs

Lines changed: 5 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,7 @@ pub fn compile_input(sess: &Session,
165165
&hir_map,
166166
&expanded_crate,
167167
&hir_map.krate(),
168-
&id[..],
169-
&lcx),
168+
&id[..]),
170169
Ok(()));
171170
}
172171

@@ -203,7 +202,6 @@ pub fn compile_input(sess: &Session,
203202
&analysis,
204203
mir_map.as_ref(),
205204
tcx,
206-
&lcx,
207205
&id);
208206
(control.after_analysis.callback)(state);
209207

@@ -248,9 +246,7 @@ pub fn compile_input(sess: &Session,
248246
}
249247

250248
fn keep_mtwt_tables(sess: &Session) -> bool {
251-
sess.opts.debugging_opts.keep_mtwt_tables ||
252-
sess.opts.debugging_opts.save_analysis ||
253-
sess.opts.debugging_opts.save_analysis_csv
249+
sess.opts.debugging_opts.keep_mtwt_tables
254250
}
255251

256252
fn keep_ast(sess: &Session) -> bool {
@@ -345,7 +341,6 @@ pub struct CompileState<'a, 'ast: 'a, 'tcx: 'a> {
345341
pub mir_map: Option<&'a MirMap<'tcx>>,
346342
pub analysis: Option<&'a ty::CrateAnalysis<'a>>,
347343
pub tcx: Option<&'a TyCtxt<'tcx>>,
348-
pub lcx: Option<&'a LoweringContext<'a>>,
349344
pub trans: Option<&'a trans::CrateTranslation>,
350345
}
351346

@@ -368,7 +363,6 @@ impl<'a, 'ast, 'tcx> CompileState<'a, 'ast, 'tcx> {
368363
analysis: None,
369364
mir_map: None,
370365
tcx: None,
371-
lcx: None,
372366
trans: None,
373367
}
374368
}
@@ -400,15 +394,13 @@ impl<'a, 'ast, 'tcx> CompileState<'a, 'ast, 'tcx> {
400394
hir_map: &'a hir_map::Map<'ast>,
401395
krate: &'a ast::Crate,
402396
hir_crate: &'a hir::Crate,
403-
crate_name: &'a str,
404-
lcx: &'a LoweringContext<'a>)
397+
crate_name: &'a str)
405398
-> CompileState<'a, 'ast, 'tcx> {
406399
CompileState {
407400
crate_name: Some(crate_name),
408401
ast_map: Some(hir_map),
409402
krate: Some(krate),
410403
hir_crate: Some(hir_crate),
411-
lcx: Some(lcx),
412404
..CompileState::empty(input, session, out_dir)
413405
}
414406
}
@@ -421,7 +413,6 @@ impl<'a, 'ast, 'tcx> CompileState<'a, 'ast, 'tcx> {
421413
analysis: &'a ty::CrateAnalysis,
422414
mir_map: Option<&'a MirMap<'tcx>>,
423415
tcx: &'a TyCtxt<'tcx>,
424-
lcx: &'a LoweringContext<'a>,
425416
crate_name: &'a str)
426417
-> CompileState<'a, 'ast, 'tcx> {
427418
CompileState {
@@ -430,7 +421,6 @@ impl<'a, 'ast, 'tcx> CompileState<'a, 'ast, 'tcx> {
430421
tcx: Some(tcx),
431422
krate: krate,
432423
hir_crate: Some(hir_crate),
433-
lcx: Some(lcx),
434424
crate_name: Some(crate_name),
435425
..CompileState::empty(input, session, out_dir)
436426
}
@@ -645,21 +635,6 @@ pub fn phase_2_configure_and_expand(sess: &Session,
645635
ret
646636
});
647637

648-
// Needs to go *after* expansion to be able to check the results
649-
// of macro expansion. This runs before #[cfg] to try to catch as
650-
// much as possible (e.g. help the programmer avoid platform
651-
// specific differences)
652-
time(time_passes, "complete gated feature checking 1", || {
653-
sess.track_errors(|| {
654-
let features = syntax::feature_gate::check_crate(sess.codemap(),
655-
&sess.parse_sess.span_diagnostic,
656-
&krate,
657-
&attributes,
658-
sess.opts.unstable_features);
659-
*sess.features.borrow_mut() = features;
660-
})
661-
})?;
662-
663638
// JBC: make CFG processing part of expansion to avoid this problem:
664639

665640
// strip again, in case expansion added anything with a #[cfg].
@@ -698,10 +673,8 @@ pub fn phase_2_configure_and_expand(sess: &Session,
698673
"checking for inline asm in case the target doesn't support it",
699674
|| no_asm::check_crate(sess, &krate));
700675

701-
// One final feature gating of the true AST that gets compiled
702-
// later, to make sure we've got everything (e.g. configuration
703-
// can insert new attributes via `cfg_attr`)
704-
time(time_passes, "complete gated feature checking 2", || {
676+
// Needs to go *after* expansion to be able to check the results of macro expansion.
677+
time(time_passes, "complete gated feature checking", || {
705678
sess.track_errors(|| {
706679
let features = syntax::feature_gate::check_crate(sess.codemap(),
707680
&sess.parse_sess.span_diagnostic,

branches/auto/src/librustc_driver/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,6 @@ impl<'a> CompilerCalls<'a> for RustcDefaultCalls {
499499
control.after_analysis.callback = box |state| {
500500
time(state.session.time_passes(), "save analysis", || {
501501
save::process_crate(state.tcx.unwrap(),
502-
state.lcx.unwrap(),
503502
state.krate.unwrap(),
504503
state.analysis.unwrap(),
505504
state.crate_name.unwrap(),

branches/auto/src/librustc_resolve/diagnostics.rs

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -948,6 +948,51 @@ use something_which_doesnt_exist;
948948
Please verify you didn't misspell the import's name.
949949
"##,
950950

951+
E0434: r##"
952+
This error indicates that a variable usage inside an inner function is invalid
953+
because the variable comes from a dynamic environment. Inner functions do not
954+
have access to their containing environment.
955+
956+
Example of erroneous code:
957+
958+
```compile_fail
959+
fn foo() {
960+
let y = 5;
961+
fn bar() -> u32 {
962+
y // error: can't capture dynamic environment in a fn item; use the
963+
// || { ... } closure form instead.
964+
}
965+
}
966+
```
967+
968+
Functions do not capture local variables. To fix this error, you can replace the
969+
function with a closure:
970+
971+
```
972+
fn foo() {
973+
let y = 5;
974+
let bar = || {
975+
y
976+
};
977+
}
978+
```
979+
980+
or replace the captured variable with a constant or a static item:
981+
982+
```
983+
fn foo() {
984+
static mut X: u32 = 4;
985+
const Y: u32 = 5;
986+
fn bar() -> u32 {
987+
unsafe {
988+
X = 3;
989+
}
990+
Y
991+
}
992+
}
993+
```
994+
"##,
995+
951996
E0435: r##"
952997
A non-constant value was used to initialise a constant. Example of erroneous
953998
code:
@@ -1044,5 +1089,4 @@ register_diagnostics! {
10441089
E0421, // unresolved associated const
10451090
E0427, // cannot use `ref` binding mode with ...
10461091
E0429, // `self` imports are only allowed within a { } list
1047-
E0434, // can't capture dynamic environment in a fn item
10481092
}

branches/auto/src/librustc_save_analysis/dump_visitor.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,6 @@ use syntax::visit::{self, Visitor};
4242
use syntax::print::pprust::{path_to_string, ty_to_string};
4343
use syntax::ptr::P;
4444

45-
use rustc::hir::lowering::lower_expr;
46-
4745
use super::{escape, generated_code, SaveContext, PathCollector};
4846
use super::data::*;
4947
use super::dump::Dump;
@@ -1222,7 +1220,7 @@ impl<'v, 'l, 'tcx: 'l, 'll, D: Dump +'ll> Visitor<'v> for DumpVisitor<'l, 'tcx,
12221220
visit::walk_expr(self, ex);
12231221
}
12241222
ast::ExprKind::Struct(ref path, ref fields, ref base) => {
1225-
let hir_expr = lower_expr(self.save_ctxt.lcx, ex);
1223+
let hir_expr = self.save_ctxt.tcx.map.expect_expr(ex.id);
12261224
let adt = self.tcx.expr_ty(&hir_expr).ty_adt_def().unwrap();
12271225
let def = self.tcx.resolve_expr(&hir_expr);
12281226
self.process_struct_lit(ex, path, fields, adt.variant_of_def(def), base)
@@ -1241,7 +1239,7 @@ impl<'v, 'l, 'tcx: 'l, 'll, D: Dump +'ll> Visitor<'v> for DumpVisitor<'l, 'tcx,
12411239
ast::ExprKind::TupField(ref sub_ex, idx) => {
12421240
self.visit_expr(&sub_ex);
12431241

1244-
let hir_node = lower_expr(self.save_ctxt.lcx, sub_ex);
1242+
let hir_node = self.save_ctxt.tcx.map.expect_expr(sub_ex.id);
12451243
let ty = &self.tcx.expr_ty_adjusted(&hir_node).sty;
12461244
match *ty {
12471245
ty::TyStruct(def, _) => {

branches/auto/src/librustc_save_analysis/lib.rs

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
#[macro_use] extern crate syntax;
2929
extern crate serialize as rustc_serialize;
3030

31-
use rustc::hir::{self, lowering};
31+
use rustc::hir;
3232
use rustc::hir::map::NodeItem;
3333
use rustc::hir::def::Def;
3434
use rustc::hir::def_id::DefId;
@@ -75,7 +75,6 @@ pub mod recorder {
7575

7676
pub struct SaveContext<'l, 'tcx: 'l> {
7777
tcx: &'l TyCtxt<'tcx>,
78-
lcx: &'l lowering::LoweringContext<'l>,
7978
span_utils: SpanUtils<'tcx>,
8079
}
8180

@@ -84,20 +83,16 @@ macro_rules! option_try(
8483
);
8584

8685
impl<'l, 'tcx: 'l> SaveContext<'l, 'tcx> {
87-
pub fn new(tcx: &'l TyCtxt<'tcx>,
88-
lcx: &'l lowering::LoweringContext<'l>)
89-
-> SaveContext<'l, 'tcx> {
86+
pub fn new(tcx: &'l TyCtxt<'tcx>) -> SaveContext<'l, 'tcx> {
9087
let span_utils = SpanUtils::new(&tcx.sess);
91-
SaveContext::from_span_utils(tcx, lcx, span_utils)
88+
SaveContext::from_span_utils(tcx, span_utils)
9289
}
9390

9491
pub fn from_span_utils(tcx: &'l TyCtxt<'tcx>,
95-
lcx: &'l lowering::LoweringContext<'l>,
9692
span_utils: SpanUtils<'tcx>)
9793
-> SaveContext<'l, 'tcx> {
9894
SaveContext {
9995
tcx: tcx,
100-
lcx: lcx,
10196
span_utils: span_utils,
10297
}
10398
}
@@ -378,14 +373,14 @@ impl<'l, 'tcx: 'l> SaveContext<'l, 'tcx> {
378373
}
379374

380375
pub fn get_expr_data(&self, expr: &ast::Expr) -> Option<Data> {
381-
let hir_node = lowering::lower_expr(self.lcx, expr);
376+
let hir_node = self.tcx.map.expect_expr(expr.id);
382377
let ty = self.tcx.expr_ty_adjusted_opt(&hir_node);
383378
if ty.is_none() || ty.unwrap().sty == ty::TyError {
384379
return None;
385380
}
386381
match expr.node {
387382
ast::ExprKind::Field(ref sub_ex, ident) => {
388-
let hir_node = lowering::lower_expr(self.lcx, sub_ex);
383+
let hir_node = self.tcx.map.expect_expr(sub_ex.id);
389384
match self.tcx.expr_ty_adjusted(&hir_node).sty {
390385
ty::TyStruct(def, _) => {
391386
let f = def.struct_variant().field_named(ident.node.name);
@@ -405,7 +400,7 @@ impl<'l, 'tcx: 'l> SaveContext<'l, 'tcx> {
405400
}
406401
}
407402
ast::ExprKind::Struct(ref path, _, _) => {
408-
let hir_node = lowering::lower_expr(self.lcx, expr);
403+
let hir_node = self.tcx.map.expect_expr(expr.id);
409404
match self.tcx.expr_ty_adjusted(&hir_node).sty {
410405
ty::TyStruct(def, _) => {
411406
let sub_span = self.span_utils.span_for_last_ident(path.span);
@@ -704,7 +699,6 @@ impl Format {
704699
}
705700

706701
pub fn process_crate<'l, 'tcx>(tcx: &'l TyCtxt<'tcx>,
707-
lcx: &'l lowering::LoweringContext<'l>,
708702
krate: &ast::Crate,
709703
analysis: &'l ty::CrateAnalysis<'l>,
710704
cratename: &str,
@@ -755,7 +749,7 @@ pub fn process_crate<'l, 'tcx>(tcx: &'l TyCtxt<'tcx>,
755749
let output = &mut output_file;
756750

757751
let utils: SpanUtils<'tcx> = SpanUtils::new(&tcx.sess);
758-
let save_ctxt = SaveContext::new(tcx, lcx);
752+
let save_ctxt = SaveContext::new(tcx);
759753

760754
macro_rules! dump {
761755
($new_dumper: expr) => {{

branches/auto/src/libstd/collections/hash/map.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1533,6 +1533,15 @@ impl<'a, K, V> Entry<'a, K, V> {
15331533
Vacant(entry) => entry.insert(default()),
15341534
}
15351535
}
1536+
1537+
/// Returns a reference to this entry's key.
1538+
#[unstable(feature = "map_entry_keys", issue = "32281")]
1539+
pub fn key(&self) -> &K {
1540+
match *self {
1541+
Occupied(ref entry) => entry.key(),
1542+
Vacant(ref entry) => entry.key(),
1543+
}
1544+
}
15361545
}
15371546

15381547
impl<'a, K, V> OccupiedEntry<'a, K, V> {

branches/auto/src/libsyntax/ext/expand.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -327,9 +327,7 @@ macro_rules! with_exts_frame {
327327
// When we enter a module, record it, for the sake of `module!`
328328
pub fn expand_item(it: P<ast::Item>, fld: &mut MacroExpander)
329329
-> SmallVector<P<ast::Item>> {
330-
let it = expand_item_multi_modifier(Annotatable::Item(it), fld);
331-
332-
expand_annotatable(it, fld)
330+
expand_annotatable(Annotatable::Item(it), fld)
333331
.into_iter().map(|i| i.expect_item()).collect()
334332
}
335333

branches/auto/src/test/codegen-units/partitioning/extern-drop-glue.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@
99
// except according to those terms.
1010

1111
// ignore-tidy-linelength
12-
// compile-flags:-Zprint-trans-items=lazy -Zincremental=tmp
12+
13+
// We specify -Z incremental here because we want to test the partitioning for
14+
// incremental compilation
15+
// compile-flags:-Zprint-trans-items=lazy -Zincremental=tmp/partitioning-tests/extern-drop-glue
1316

1417
#![allow(dead_code)]
1518
#![crate_type="lib"]

0 commit comments

Comments
 (0)