Skip to content

Commit 5181b24

Browse files
committed
Auto merge of #42841 - brson:beta-next, r=alexcrichton
[beta] backports - #42785 - #42740 - #42735 - #42728 - #42695 - #42659 - #42634 - #42566 I just unilaterally accepted all the non-accepted nominations. Everything picked cleanly. Still testing locally. cc @rust-lang/compiler r? @alexcrichton
2 parents 4795a8f + fc87577 commit 5181b24

21 files changed

+405
-201
lines changed

src/bootstrap/bin/main.rs

+1-7
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,6 @@ use bootstrap::{Flags, Config, Build};
2626
fn main() {
2727
let args = env::args().skip(1).collect::<Vec<_>>();
2828
let flags = Flags::parse(&args);
29-
let mut config = Config::parse(&flags.build, flags.config.clone());
30-
31-
// compat with `./configure` while we're still using that
32-
if std::fs::metadata("config.mk").is_ok() {
33-
config.update_with_config_mk();
34-
}
35-
29+
let config = Config::parse(&flags.build, flags.config.clone());
3630
Build::new(flags, config).build();
3731
}

src/bootstrap/config.rs

+8-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
1616
use std::collections::HashMap;
1717
use std::env;
18-
use std::fs::File;
18+
use std::fs::{self, File};
1919
use std::io::prelude::*;
2020
use std::path::PathBuf;
2121
use std::process;
@@ -404,6 +404,12 @@ impl Config {
404404
set(&mut config.rust_dist_src, t.src_tarball);
405405
}
406406

407+
408+
// compat with `./configure` while we're still using that
409+
if fs::metadata("config.mk").is_ok() {
410+
config.update_with_config_mk();
411+
}
412+
407413
return config
408414
}
409415

@@ -412,7 +418,7 @@ impl Config {
412418
/// While we still have `./configure` this implements the ability to decode
413419
/// that configuration into this. This isn't exactly a full-blown makefile
414420
/// parser, but hey it gets the job done!
415-
pub fn update_with_config_mk(&mut self) {
421+
fn update_with_config_mk(&mut self) {
416422
let mut config = String::new();
417423
File::open("config.mk").unwrap().read_to_string(&mut config).unwrap();
418424
for line in config.lines() {

src/bootstrap/flags.rs

+8-9
Original file line numberDiff line numberDiff line change
@@ -237,11 +237,18 @@ Arguments:
237237
let cwd = t!(env::current_dir());
238238
let paths = matches.free[1..].iter().map(|p| cwd.join(p)).collect::<Vec<_>>();
239239

240+
let cfg_file = matches.opt_str("config").map(PathBuf::from).or_else(|| {
241+
if fs::metadata("config.toml").is_ok() {
242+
Some(PathBuf::from("config.toml"))
243+
} else {
244+
None
245+
}
246+
});
240247

241248
// All subcommands can have an optional "Available paths" section
242249
if matches.opt_present("verbose") {
243250
let flags = Flags::parse(&["build".to_string()]);
244-
let mut config = Config::default();
251+
let mut config = Config::parse(&flags.build, cfg_file.clone());
245252
config.build = flags.build.clone();
246253
let mut build = Build::new(flags, config);
247254
metadata::build(&mut build);
@@ -302,14 +309,6 @@ Arguments:
302309
};
303310

304311

305-
let cfg_file = matches.opt_str("config").map(PathBuf::from).or_else(|| {
306-
if fs::metadata("config.toml").is_ok() {
307-
Some(PathBuf::from("config.toml"))
308-
} else {
309-
None
310-
}
311-
});
312-
313312
let mut stage = matches.opt_str("stage").map(|j| j.parse().unwrap());
314313

315314
if matches.opt_present("incremental") {

src/jemalloc

Submodule jemalloc updated 145 files

src/liballoc_jemalloc/build.rs

+23-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,29 @@ fn main() {
9393
.env("AR", &ar)
9494
.env("RANLIB", format!("{} s", ar.display()));
9595

96-
if target.contains("ios") {
96+
if target.contains("windows") {
97+
// A bit of history here, this used to be --enable-lazy-lock added in
98+
// #14006 which was filed with jemalloc in jemalloc/jemalloc#83 which
99+
// was also reported to MinGW:
100+
//
101+
// http://sourceforge.net/p/mingw-w64/bugs/395/
102+
//
103+
// When updating jemalloc to 4.0, however, it was found that binaries
104+
// would exit with the status code STATUS_RESOURCE_NOT_OWNED indicating
105+
// that a thread was unlocking a mutex it never locked. Disabling this
106+
// "lazy lock" option seems to fix the issue, but it was enabled by
107+
// default for MinGW targets in 13473c7 for jemalloc.
108+
//
109+
// As a result of all that, force disabling lazy lock on Windows, and
110+
// after reading some code it at least *appears* that the initialization
111+
// of mutexes is otherwise ok in jemalloc, so shouldn't cause problems
112+
// hopefully...
113+
//
114+
// tl;dr: make windows behave like other platforms by disabling lazy
115+
// locking, but requires passing an option due to a historical
116+
// default with jemalloc.
117+
cmd.arg("--disable-lazy-lock");
118+
} else if target.contains("ios") {
97119
cmd.arg("--disable-tls");
98120
} else if target.contains("android") {
99121
// We force android to have prefixed symbols because apparently

src/libcore/iter/mod.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -191,10 +191,12 @@
191191
//! {
192192
//! let result = match IntoIterator::into_iter(values) {
193193
//! mut iter => loop {
194-
//! let x = match iter.next() {
195-
//! Some(val) => val,
194+
//! let next;
195+
//! match iter.next() {
196+
//! Some(val) => next = val,
196197
//! None => break,
197198
//! };
199+
//! let x = next;
198200
//! let () = { println!("{}", x); };
199201
//! },
200202
//! };

src/librustc/hir/lowering.rs

+36-10
Original file line numberDiff line numberDiff line change
@@ -2168,11 +2168,13 @@ impl<'a> LoweringContext<'a> {
21682168
// let result = match ::std::iter::IntoIterator::into_iter(<head>) {
21692169
// mut iter => {
21702170
// [opt_ident]: loop {
2171-
// let <pat> = match ::std::iter::Iterator::next(&mut iter) {
2172-
// ::std::option::Option::Some(val) => val,
2171+
// let mut _next;
2172+
// match ::std::iter::Iterator::next(&mut iter) {
2173+
// ::std::option::Option::Some(val) => _next = val,
21732174
// ::std::option::Option::None => break
21742175
// };
2175-
// SemiExpr(<body>);
2176+
// let <pat> = _next;
2177+
// StmtExpr(<body>);
21762178
// }
21772179
// }
21782180
// };
@@ -2184,13 +2186,22 @@ impl<'a> LoweringContext<'a> {
21842186

21852187
let iter = self.str_to_ident("iter");
21862188

2187-
// `::std::option::Option::Some(val) => val`
2189+
let next_ident = self.str_to_ident("_next");
2190+
let next_pat = self.pat_ident_binding_mode(e.span,
2191+
next_ident,
2192+
hir::BindByValue(hir::MutMutable));
2193+
2194+
// `::std::option::Option::Some(val) => next = val`
21882195
let pat_arm = {
21892196
let val_ident = self.str_to_ident("val");
21902197
let val_pat = self.pat_ident(e.span, val_ident);
21912198
let val_expr = P(self.expr_ident(e.span, val_ident, val_pat.id));
2199+
let next_expr = P(self.expr_ident(e.span, next_ident, next_pat.id));
2200+
let assign = P(self.expr(e.span,
2201+
hir::ExprAssign(next_expr, val_expr),
2202+
ThinVec::new()));
21922203
let some_pat = self.pat_some(e.span, val_pat);
2193-
self.arm(hir_vec![some_pat], val_expr)
2204+
self.arm(hir_vec![some_pat], assign)
21942205
};
21952206

21962207
// `::std::option::Option::None => break`
@@ -2220,10 +2231,20 @@ impl<'a> LoweringContext<'a> {
22202231
hir::MatchSource::ForLoopDesugar),
22212232
ThinVec::new()))
22222233
};
2234+
let match_stmt = respan(e.span, hir::StmtExpr(match_expr, self.next_id()));
2235+
2236+
let next_expr = P(self.expr_ident(e.span, next_ident, next_pat.id));
2237+
2238+
// `let mut _next`
2239+
let next_let = self.stmt_let_pat(e.span,
2240+
None,
2241+
next_pat,
2242+
hir::LocalSource::ForLoopDesugar);
22232243

2244+
// `let <pat> = _next`
22242245
let pat = self.lower_pat(pat);
22252246
let pat_let = self.stmt_let_pat(e.span,
2226-
match_expr,
2247+
Some(next_expr),
22272248
pat,
22282249
hir::LocalSource::ForLoopDesugar);
22292250

@@ -2232,7 +2253,12 @@ impl<'a> LoweringContext<'a> {
22322253
let body_expr = P(self.expr_block(body_block, ThinVec::new()));
22332254
let body_stmt = respan(e.span, hir::StmtExpr(body_expr, self.next_id()));
22342255

2235-
let loop_block = P(self.block_all(e.span, hir_vec![pat_let, body_stmt], None));
2256+
let loop_block = P(self.block_all(e.span,
2257+
hir_vec![next_let,
2258+
match_stmt,
2259+
pat_let,
2260+
body_stmt],
2261+
None));
22362262

22372263
// `[opt_ident]: loop { ... }`
22382264
let loop_expr = hir::ExprLoop(loop_block, self.lower_opt_sp_ident(opt_ident),
@@ -2599,14 +2625,14 @@ impl<'a> LoweringContext<'a> {
25992625

26002626
fn stmt_let_pat(&mut self,
26012627
sp: Span,
2602-
ex: P<hir::Expr>,
2628+
ex: Option<P<hir::Expr>>,
26032629
pat: P<hir::Pat>,
26042630
source: hir::LocalSource)
26052631
-> hir::Stmt {
26062632
let local = P(hir::Local {
26072633
pat: pat,
26082634
ty: None,
2609-
init: Some(ex),
2635+
init: ex,
26102636
id: self.next_id(),
26112637
span: sp,
26122638
attrs: ThinVec::new(),
@@ -2624,7 +2650,7 @@ impl<'a> LoweringContext<'a> {
26242650
self.pat_ident(sp, ident)
26252651
};
26262652
let pat_id = pat.id;
2627-
(self.stmt_let_pat(sp, ex, pat, hir::LocalSource::Normal), pat_id)
2653+
(self.stmt_let_pat(sp, Some(ex), pat, hir::LocalSource::Normal), pat_id)
26282654
}
26292655

26302656
fn block_expr(&mut self, expr: P<hir::Expr>) -> hir::Block {

src/librustc/middle/free_region.rs

+1-19
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
use hir::def_id::DefId;
1919
use middle::region::RegionMaps;
2020
use ty::{self, Lift, TyCtxt, Region};
21-
use ty::wf::ImpliedBound;
2221
use rustc_data_structures::transitive_relation::TransitiveRelation;
2322

2423
/// Combines a `RegionMaps` (which governs relationships between
@@ -136,23 +135,6 @@ impl<'tcx> FreeRegionMap<'tcx> {
136135
self.relation.is_empty()
137136
}
138137

139-
pub fn relate_free_regions_from_implied_bounds(&mut self,
140-
implied_bounds: &[ImpliedBound<'tcx>])
141-
{
142-
debug!("relate_free_regions_from_implied_bounds()");
143-
for implied_bound in implied_bounds {
144-
debug!("implied bound: {:?}", implied_bound);
145-
match *implied_bound {
146-
ImpliedBound::RegionSubRegion(a, b) => {
147-
self.relate_regions(a, b);
148-
}
149-
ImpliedBound::RegionSubParam(..) |
150-
ImpliedBound::RegionSubProjection(..) => {
151-
}
152-
}
153-
}
154-
}
155-
156138
pub fn relate_free_regions_from_predicates(&mut self,
157139
predicates: &[ty::Predicate<'tcx>]) {
158140
debug!("relate_free_regions_from_predicates(predicates={:?})", predicates);
@@ -177,7 +159,7 @@ impl<'tcx> FreeRegionMap<'tcx> {
177159

178160
// Record that `'sup:'sub`. Or, put another way, `'sub <= 'sup`.
179161
// (with the exception that `'static: 'x` is not notable)
180-
fn relate_regions(&mut self, sub: Region<'tcx>, sup: Region<'tcx>) {
162+
pub fn relate_regions(&mut self, sub: Region<'tcx>, sup: Region<'tcx>) {
181163
if (is_free(sub) || *sub == ty::ReStatic) && is_free(sup) {
182164
self.relation.add(sub, sup)
183165
}

0 commit comments

Comments
 (0)