Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[beta] backports #42927

Merged
merged 18 commits into from
Jun 27, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions src/bootstrap/bin/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,6 @@ use bootstrap::{Flags, Config, Build};
fn main() {
let args = env::args().skip(1).collect::<Vec<_>>();
let flags = Flags::parse(&args);
let mut config = Config::parse(&flags.build, flags.config.clone());

// compat with `./configure` while we're still using that
if std::fs::metadata("config.mk").is_ok() {
config.update_with_config_mk();
}

let config = Config::parse(&flags.build, flags.config.clone());
Build::new(flags, config).build();
}
10 changes: 8 additions & 2 deletions src/bootstrap/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

use std::collections::HashMap;
use std::env;
use std::fs::File;
use std::fs::{self, File};
use std::io::prelude::*;
use std::path::PathBuf;
use std::process;
Expand Down Expand Up @@ -404,6 +404,12 @@ impl Config {
set(&mut config.rust_dist_src, t.src_tarball);
}


// compat with `./configure` while we're still using that
if fs::metadata("config.mk").is_ok() {
config.update_with_config_mk();
}

return config
}

Expand All @@ -412,7 +418,7 @@ impl Config {
/// While we still have `./configure` this implements the ability to decode
/// that configuration into this. This isn't exactly a full-blown makefile
/// parser, but hey it gets the job done!
pub fn update_with_config_mk(&mut self) {
fn update_with_config_mk(&mut self) {
let mut config = String::new();
File::open("config.mk").unwrap().read_to_string(&mut config).unwrap();
for line in config.lines() {
Expand Down
17 changes: 8 additions & 9 deletions src/bootstrap/flags.rs
Original file line number Diff line number Diff line change
Expand Up @@ -237,11 +237,18 @@ Arguments:
let cwd = t!(env::current_dir());
let paths = matches.free[1..].iter().map(|p| cwd.join(p)).collect::<Vec<_>>();

let cfg_file = matches.opt_str("config").map(PathBuf::from).or_else(|| {
if fs::metadata("config.toml").is_ok() {
Some(PathBuf::from("config.toml"))
} else {
None
}
});

// All subcommands can have an optional "Available paths" section
if matches.opt_present("verbose") {
let flags = Flags::parse(&["build".to_string()]);
let mut config = Config::default();
let mut config = Config::parse(&flags.build, cfg_file.clone());
config.build = flags.build.clone();
let mut build = Build::new(flags, config);
metadata::build(&mut build);
Expand Down Expand Up @@ -302,14 +309,6 @@ Arguments:
};


let cfg_file = matches.opt_str("config").map(PathBuf::from).or_else(|| {
if fs::metadata("config.toml").is_ok() {
Some(PathBuf::from("config.toml"))
} else {
None
}
});

let mut stage = matches.opt_str("stage").map(|j| j.parse().unwrap());

if matches.opt_present("incremental") {
Expand Down
2 changes: 1 addition & 1 deletion src/jemalloc
Submodule jemalloc updated 145 files
24 changes: 23 additions & 1 deletion src/liballoc_jemalloc/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,29 @@ fn main() {
.env("AR", &ar)
.env("RANLIB", format!("{} s", ar.display()));

if target.contains("ios") {
if target.contains("windows") {
// A bit of history here, this used to be --enable-lazy-lock added in
// #14006 which was filed with jemalloc in jemalloc/jemalloc#83 which
// was also reported to MinGW:
//
// http://sourceforge.net/p/mingw-w64/bugs/395/
//
// When updating jemalloc to 4.0, however, it was found that binaries
// would exit with the status code STATUS_RESOURCE_NOT_OWNED indicating
// that a thread was unlocking a mutex it never locked. Disabling this
// "lazy lock" option seems to fix the issue, but it was enabled by
// default for MinGW targets in 13473c7 for jemalloc.
//
// As a result of all that, force disabling lazy lock on Windows, and
// after reading some code it at least *appears* that the initialization
// of mutexes is otherwise ok in jemalloc, so shouldn't cause problems
// hopefully...
//
// tl;dr: make windows behave like other platforms by disabling lazy
// locking, but requires passing an option due to a historical
// default with jemalloc.
cmd.arg("--disable-lazy-lock");
} else if target.contains("ios") {
cmd.arg("--disable-tls");
} else if target.contains("android") {
// We force android to have prefixed symbols because apparently
Expand Down
6 changes: 4 additions & 2 deletions src/libcore/iter/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,10 +191,12 @@
//! {
//! let result = match IntoIterator::into_iter(values) {
//! mut iter => loop {
//! let x = match iter.next() {
//! Some(val) => val,
//! let next;
//! match iter.next() {
//! Some(val) => next = val,
//! None => break,
//! };
//! let x = next;
//! let () = { println!("{}", x); };
//! },
//! };
Expand Down
46 changes: 36 additions & 10 deletions src/librustc/hir/lowering.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2168,11 +2168,13 @@ impl<'a> LoweringContext<'a> {
// let result = match ::std::iter::IntoIterator::into_iter(<head>) {
// mut iter => {
// [opt_ident]: loop {
// let <pat> = match ::std::iter::Iterator::next(&mut iter) {
// ::std::option::Option::Some(val) => val,
// let mut _next;
// match ::std::iter::Iterator::next(&mut iter) {
// ::std::option::Option::Some(val) => _next = val,
// ::std::option::Option::None => break
// };
// SemiExpr(<body>);
// let <pat> = _next;
// StmtExpr(<body>);
// }
// }
// };
Expand All @@ -2184,13 +2186,22 @@ impl<'a> LoweringContext<'a> {

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

// `::std::option::Option::Some(val) => val`
let next_ident = self.str_to_ident("_next");
let next_pat = self.pat_ident_binding_mode(e.span,
next_ident,
hir::BindByValue(hir::MutMutable));

// `::std::option::Option::Some(val) => next = val`
let pat_arm = {
let val_ident = self.str_to_ident("val");
let val_pat = self.pat_ident(e.span, val_ident);
let val_expr = P(self.expr_ident(e.span, val_ident, val_pat.id));
let next_expr = P(self.expr_ident(e.span, next_ident, next_pat.id));
let assign = P(self.expr(e.span,
hir::ExprAssign(next_expr, val_expr),
ThinVec::new()));
let some_pat = self.pat_some(e.span, val_pat);
self.arm(hir_vec![some_pat], val_expr)
self.arm(hir_vec![some_pat], assign)
};

// `::std::option::Option::None => break`
Expand Down Expand Up @@ -2220,10 +2231,20 @@ impl<'a> LoweringContext<'a> {
hir::MatchSource::ForLoopDesugar),
ThinVec::new()))
};
let match_stmt = respan(e.span, hir::StmtExpr(match_expr, self.next_id()));

let next_expr = P(self.expr_ident(e.span, next_ident, next_pat.id));

// `let mut _next`
let next_let = self.stmt_let_pat(e.span,
None,
next_pat,
hir::LocalSource::ForLoopDesugar);

// `let <pat> = _next`
let pat = self.lower_pat(pat);
let pat_let = self.stmt_let_pat(e.span,
match_expr,
Some(next_expr),
pat,
hir::LocalSource::ForLoopDesugar);

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

let loop_block = P(self.block_all(e.span, hir_vec![pat_let, body_stmt], None));
let loop_block = P(self.block_all(e.span,
hir_vec![next_let,
match_stmt,
pat_let,
body_stmt],
None));

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

fn stmt_let_pat(&mut self,
sp: Span,
ex: P<hir::Expr>,
ex: Option<P<hir::Expr>>,
pat: P<hir::Pat>,
source: hir::LocalSource)
-> hir::Stmt {
let local = P(hir::Local {
pat: pat,
ty: None,
init: Some(ex),
init: ex,
id: self.next_id(),
span: sp,
attrs: ThinVec::new(),
Expand All @@ -2624,7 +2650,7 @@ impl<'a> LoweringContext<'a> {
self.pat_ident(sp, ident)
};
let pat_id = pat.id;
(self.stmt_let_pat(sp, ex, pat, hir::LocalSource::Normal), pat_id)
(self.stmt_let_pat(sp, Some(ex), pat, hir::LocalSource::Normal), pat_id)
}

fn block_expr(&mut self, expr: P<hir::Expr>) -> hir::Block {
Expand Down
20 changes: 1 addition & 19 deletions src/librustc/middle/free_region.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
use hir::def_id::DefId;
use middle::region::RegionMaps;
use ty::{self, Lift, TyCtxt, Region};
use ty::wf::ImpliedBound;
use rustc_data_structures::transitive_relation::TransitiveRelation;

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

pub fn relate_free_regions_from_implied_bounds(&mut self,
implied_bounds: &[ImpliedBound<'tcx>])
{
debug!("relate_free_regions_from_implied_bounds()");
for implied_bound in implied_bounds {
debug!("implied bound: {:?}", implied_bound);
match *implied_bound {
ImpliedBound::RegionSubRegion(a, b) => {
self.relate_regions(a, b);
}
ImpliedBound::RegionSubParam(..) |
ImpliedBound::RegionSubProjection(..) => {
}
}
}
}

pub fn relate_free_regions_from_predicates(&mut self,
predicates: &[ty::Predicate<'tcx>]) {
debug!("relate_free_regions_from_predicates(predicates={:?})", predicates);
Expand All @@ -177,7 +159,7 @@ impl<'tcx> FreeRegionMap<'tcx> {

// Record that `'sup:'sub`. Or, put another way, `'sub <= 'sup`.
// (with the exception that `'static: 'x` is not notable)
fn relate_regions(&mut self, sub: Region<'tcx>, sup: Region<'tcx>) {
pub fn relate_regions(&mut self, sub: Region<'tcx>, sup: Region<'tcx>) {
if (is_free(sub) || *sub == ty::ReStatic) && is_free(sup) {
self.relation.add(sub, sup)
}
Expand Down
Loading