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

Rollup of 28 pull requests #40091

Merged
merged 72 commits into from
Feb 25, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
72 commits
Select commit Hold shift + click to select a range
cbafac5
Fix compilation on Redox
jackpot51 Feb 9, 2017
0e45a5e
[rustbuild] add a way to run command after failure
nagisa Feb 16, 2017
047a215
Set rustdoc --test files' path relative to the current directory
GuillaumeGomez Feb 15, 2017
2e756e2
add solaris sparcv9 support
binarycrusader Feb 17, 2017
038a166
Properly display note/expected details
estebank Feb 17, 2017
6091330
Follow rename of mx_handle_wait Magenta syscalls
raphlinus Feb 17, 2017
5205e2f
Normalize labeled and unlabeled breaks
cramertj Feb 15, 2017
4d65622
Properly implement labeled breaks in while conditions
cramertj Feb 16, 2017
56e519d
Add tests for control flow in while condition
cramertj Feb 17, 2017
a611bbc
Rename hir::Label to hir::Destination
cramertj Feb 18, 2017
9322a38
Use ARM instead of SystemZ for testing not installed targets
petrochenkov Feb 18, 2017
e606a43
Fix rustdoc test with new file path
GuillaumeGomez Feb 19, 2017
df28569
bootstrap: stop trashing (DY)LD_LIBRARY_PATH
ishitatsuyuki Feb 19, 2017
a84eb95
check_match: don't treat privately uninhabited types as uninhabited
arielb1 Feb 20, 2017
25b1488
Simplify adaptive hashmap
arthurprs Feb 20, 2017
0b06db5
incr-comp: track the -Z sanitizer flag
Feb 21, 2017
7af3406
Set metadata for vtable-related loads
Aatch Feb 21, 2017
d80cf80
Update codegen test with new attributes
Aatch Feb 21, 2017
305aca8
travis: Compile a more compatible libc.a for musl
alexcrichton Feb 21, 2017
9a08f40
travis: Move -mrelax-relocations to Docker config
alexcrichton Feb 21, 2017
347e1af
std: Relax UnwindSafe impl for Unique
alexcrichton Feb 21, 2017
163698c
Switch Fuchsia to readdir (instead of readdir_r)
raphlinus Feb 21, 2017
9ce8bb9
Add save-analysis data to nightly manifests.
nrc Feb 22, 2017
802a826
Stabilize static_recursion
cramertj Feb 22, 2017
f557e71
Ignore ASM tests on powerpc
er-1 Feb 22, 2017
ffc6ddd
add `-C overflow-checks` option
froydnj Feb 17, 2017
b576abd
detect "bootstrap outputs" when serializing the dep-graph
nikomatsakis Feb 22, 2017
81b9b3c
Update name_bytes, scoop up latest libc
raphlinus Feb 22, 2017
b3ee249
Merge branch 'master' of https://github.com/rust-lang/rust into readdir
raphlinus Feb 22, 2017
b7b58ff
Added test for inclusive_range_syntax in compile-fail test suite
nikhilshagri Feb 22, 2017
958fbc5
Make path separator replacement for subfiles as well
GuillaumeGomez Feb 22, 2017
6f0447b
Change break or continue with no label to error nmbr 590
cramertj Feb 23, 2017
4ecdc68
Move MacroKind into Def::Macro
keeperofdakeys Feb 23, 2017
da6dc53
Add macro suggestions for macros imported with `use`
keeperofdakeys Feb 23, 2017
ae32b6e
Better handling of lib defaults
wagenet Feb 21, 2017
4e2c993
trans: don't ICE when trying to create ADT trans-items
arielb1 Feb 23, 2017
69c5359
Add tests for lib defaults
wagenet Feb 23, 2017
87e544b
use a more conservative inhabitableness rule
arielb1 Feb 23, 2017
1b9b322
Implement non-capturing closure to fn coercion
est31 Feb 22, 2017
f753a6e
Feature gate
est31 Feb 23, 2017
21c3898
Two more tests
est31 Feb 23, 2017
77f131d
Review changes
est31 Feb 23, 2017
1f75085
Add Gankro's table to nomicon/src/phantom-data.md
Rufflewind Feb 24, 2017
07a8026
Move COMPILER_TESTS.md out of the root directory
danobi Feb 25, 2017
46fed6e
Rollup merge of #39859 - GuillaumeGomez:rustdoc-test-relative-path, r…
eddyb Feb 25, 2017
ad9079b
Rollup merge of #39864 - cramertj:normalize-breaks, r=nikomatsakis
eddyb Feb 25, 2017
e31d464
Rollup merge of #39888 - nagisa:on-fail-bootstrap, r=alexcrichton
eddyb Feb 25, 2017
a692417
Rollup merge of #39903 - binarycrusader:issue-39901, r=alexcrichton
eddyb Feb 25, 2017
aa7eb65
Rollup merge of #39905 - estebank:useless-error, r=arielb1
eddyb Feb 25, 2017
a8ab222
Rollup merge of #39914 - raphlinus:mx_handle_wait, r=alexcrichton
eddyb Feb 25, 2017
1620286
Rollup merge of #39945 - petrochenkov:llvmtarg, r=alexcrichton
eddyb Feb 25, 2017
be66a60
Rollup merge of #39950 - ishitatsuyuki:stop-trashing-ldpath, r=alexcr…
eddyb Feb 25, 2017
a6a5c32
Rollup merge of #39953 - keeperofdakeys:macro-error, r=jseyfried
eddyb Feb 25, 2017
ef043a7
Rollup merge of #39961 - redox-os:redox, r=alexcrichton
eddyb Feb 25, 2017
33c1912
Rollup merge of #39980 - arielb1:privately-uninhabited, r=nikomatsakis
eddyb Feb 25, 2017
d78a7fc
Rollup merge of #39988 - arthurprs:hm-adapt2, r=alexcrichton
eddyb Feb 25, 2017
0a950bd
Rollup merge of #39993 - japaric:incr-san, r=alexcrichton
eddyb Feb 25, 2017
5c0b4b3
Rollup merge of #39995 - Aatch:vtable-ptr-metadata, r=arielb1
eddyb Feb 25, 2017
411d8e9
Rollup merge of #40019 - alexcrichton:fix-musl, r=brson
eddyb Feb 25, 2017
3ece892
Rollup merge of #40020 - alexcrichton:fix-unwind-safe, r=sfackler
eddyb Feb 25, 2017
ebde617
Rollup merge of #40022 - wagenet:lib-defaults, r=alexcrichton
eddyb Feb 25, 2017
32af4ce
Rollup merge of #40024 - raphlinus:readdir, r=alexcrichton
eddyb Feb 25, 2017
c3075f3
Rollup merge of #40025 - est31:master, r=eddyb
eddyb Feb 25, 2017
f135040
Rollup merge of #40026 - nrc:analysis-manifest, r=alexcrichton
eddyb Feb 25, 2017
69e5967
Rollup merge of #40027 - cramertj:stabilize_static_recursion, r=nrc
eddyb Feb 25, 2017
6ffc9e4
Rollup merge of #40031 - cynicaldevil:master, r=est31
eddyb Feb 25, 2017
4f9d6d6
Rollup merge of #40035 - er-1:master, r=alexcrichton
eddyb Feb 25, 2017
582d5d9
Rollup merge of #40037 - froydnj:overflow-checks, r=alexcrichton
eddyb Feb 25, 2017
393d80d
Rollup merge of #40038 - nikomatsakis:issue-39828, r=michaelwoerister
eddyb Feb 25, 2017
ecae5bf
Rollup merge of #40064 - arielb1:virtual-enum, r=nikomatsakis
eddyb Feb 25, 2017
49c8d58
Rollup merge of #40069 - Rufflewind:master, r=steveklabnik
eddyb Feb 25, 2017
207c763
Rollup merge of #40086 - danobi:move-compiler_tests, r=brson
eddyb Feb 25, 2017
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
18 changes: 15 additions & 3 deletions src/bootstrap/bin/rustc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ fn main() {
};
let stage = env::var("RUSTC_STAGE").expect("RUSTC_STAGE was not set");
let sysroot = env::var_os("RUSTC_SYSROOT").expect("RUSTC_SYSROOT was not set");
let mut on_fail = env::var_os("RUSTC_ON_FAIL").map(|of| Command::new(of));

let rustc = env::var_os(rustc).unwrap_or_else(|| panic!("{:?} was not set", rustc));
let libdir = env::var_os(libdir).unwrap_or_else(|| panic!("{:?} was not set", libdir));
Expand Down Expand Up @@ -217,9 +218,20 @@ fn main() {
}

// Actually run the compiler!
std::process::exit(match exec_cmd(&mut cmd) {
Ok(s) => s.code().unwrap_or(0xfe),
Err(e) => panic!("\n\nfailed to run {:?}: {}\n\n", cmd, e),
std::process::exit(if let Some(ref mut on_fail) = on_fail {
match cmd.status() {
Ok(s) if s.success() => 0,
_ => {
println!("\nDid not run successfully:\n{:?}\n-------------", cmd);
exec_cmd(on_fail).expect("could not run the backup command");
1
}
}
} else {
std::process::exit(match exec_cmd(&mut cmd) {
Ok(s) => s.code().unwrap_or(0xfe),
Err(e) => panic!("\n\nfailed to run {:?}: {}\n\n", cmd, e),
})
})
}

Expand Down
10 changes: 8 additions & 2 deletions src/bootstrap/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -355,8 +355,12 @@ def build_bootstrap(self):
env = os.environ.copy()
env["CARGO_TARGET_DIR"] = build_dir
env["RUSTC"] = self.rustc()
env["LD_LIBRARY_PATH"] = os.path.join(self.bin_root(), "lib")
env["DYLD_LIBRARY_PATH"] = os.path.join(self.bin_root(), "lib")
env["LD_LIBRARY_PATH"] = os.path.join(self.bin_root(), "lib") + \
(os.pathsep + env["LD_LIBRARY_PATH"]) \
if "LD_LIBRARY_PATH" in env else ""
env["DYLD_LIBRARY_PATH"] = os.path.join(self.bin_root(), "lib") + \
(os.pathsep + env["DYLD_LIBRARY_PATH"]) \
if "DYLD_LIBRARY_PATH" in env else ""
env["PATH"] = os.path.join(self.bin_root(), "bin") + \
os.pathsep + env["PATH"]
if not os.path.isfile(self.cargo()):
Expand Down Expand Up @@ -485,6 +489,8 @@ def build_triple(self):
ostype += 'abi64'
elif cputype in {'powerpc', 'ppc', 'ppc64'}:
cputype = 'powerpc'
elif cputype == 'sparcv9':
pass
elif cputype in {'amd64', 'x86_64', 'x86-64', 'x64'}:
cputype = 'x86_64'
else:
Expand Down
3 changes: 3 additions & 0 deletions src/bootstrap/flags.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ use step;
/// Deserialized version of all flags for this compile.
pub struct Flags {
pub verbose: usize, // verbosity level: 0 == not verbose, 1 == verbose, 2 == very verbose
pub on_fail: Option<String>,
pub stage: Option<u32>,
pub keep_stage: Option<u32>,
pub build: String,
Expand Down Expand Up @@ -81,6 +82,7 @@ impl Flags {
opts.optopt("", "build", "build target of the stage0 compiler", "BUILD");
opts.optmulti("", "host", "host targets to build", "HOST");
opts.optmulti("", "target", "target targets to build", "TARGET");
opts.optopt("", "on-fail", "command to run on failure", "CMD");
opts.optopt("", "stage", "stage to build", "N");
opts.optopt("", "keep-stage", "stage to keep without recompiling", "N");
opts.optopt("", "src", "path to the root of the rust checkout", "DIR");
Expand Down Expand Up @@ -283,6 +285,7 @@ To learn more about a subcommand, run `./x.py <command> -h`
Flags {
verbose: m.opt_count("v"),
stage: stage,
on_fail: m.opt_str("on-fail"),
keep_stage: m.opt_str("keep-stage").map(|j| j.parse().unwrap()),
build: m.opt_str("build").unwrap_or_else(|| {
env::var("BUILD").unwrap()
Expand Down
15 changes: 4 additions & 11 deletions src/bootstrap/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -499,6 +499,10 @@ impl Build {
cargo.env("RUSTC_INCREMENTAL", incr_dir);
}

if let Some(ref on_fail) = self.flags.on_fail {
cargo.env("RUSTC_ON_FAIL", on_fail);
}

let verbose = cmp::max(self.config.verbose, self.flags.verbose);
cargo.env("RUSTC_VERBOSE", format!("{}", verbose));

Expand Down Expand Up @@ -828,17 +832,6 @@ impl Build {
if target.contains("apple-darwin") {
base.push("-stdlib=libc++".into());
}
// This is a hack, because newer binutils broke things on some vms/distros
// (i.e., linking against unknown relocs disabled by the following flag)
// See: https://github.com/rust-lang/rust/issues/34978
match target {
"i586-unknown-linux-gnu" |
"i686-unknown-linux-musl" |
"x86_64-unknown-linux-musl" => {
base.push("-Wa,-mrelax-relocations=no".into());
},
_ => {},
}
return base
}

Expand Down
8 changes: 8 additions & 0 deletions src/ci/docker/linux-tested-targets/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,14 @@ ENV RUST_CONFIGURE_ARGS \
--musl-root-x86_64=/musl-x86_64 \
--musl-root-i686=/musl-i686

# Newer binutils broke things on some vms/distros (i.e., linking against
# unknown relocs disabled by the following flag), so we need to go out of our
# way to produce "super compatible" binaries.
#
# See: https://github.com/rust-lang/rust/issues/34978
ENV CFLAGS_i686_unknown_linux_gnu=-Wa,-mrelax-relocations=no \
CFLAGS_x86_64_unknown_linux_gnu=-Wa,-mrelax-relocations=no

ENV SCRIPT \
python2.7 ../x.py test \
--target x86_64-unknown-linux-musl \
Expand Down
5 changes: 4 additions & 1 deletion src/ci/docker/linux-tested-targets/build-musl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@

set -ex

export CFLAGS="-fPIC"
# We need to mitigate rust-lang/rust#34978 when compiling musl itself as well
export CFLAGS="-fPIC -Wa,-mrelax-relocations=no"
export CXXFLAGS="-Wa,-mrelax-relocations=no"

MUSL=musl-1.1.14
curl https://www.musl-libc.org/releases/$MUSL.tar.gz | tar xzf -
cd $MUSL
Expand Down
22 changes: 20 additions & 2 deletions src/doc/nomicon/src/phantom-data.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,5 +82,23 @@ standard library made a utility for itself called `Unique<T>` which:

* wraps a `*const T` for variance
* includes a `PhantomData<T>`
* auto-derives Send/Sync as if T was contained
* marks the pointer as NonZero for the null-pointer optimization
* auto-derives `Send`/`Sync` as if T was contained
* marks the pointer as `NonZero` for the null-pointer optimization

## Table of `PhantomData` patterns

Here’s a table of all the wonderful ways `PhantomData` could be used:

| Phantom type | `'a` | `T` |
|-----------------------------|-----------|---------------------------|
| `PhantomData<T>` | - | variant (with drop check) |
| `PhantomData<&'a T>` | variant | variant |
| `PhantomData<&'a mut T>` | variant | invariant |
| `PhantomData<*const T>` | - | variant |
| `PhantomData<*mut T>` | - | invariant |
| `PhantomData<fn(T)>` | - | contravariant (*) |
| `PhantomData<fn() -> T>` | - | variant |
| `PhantomData<fn(T) -> T>` | - | invariant |
| `PhantomData<Cell<&'a ()>>` | invariant | - |

(*) If contravariance gets scrapped, this would be invariant.
10 changes: 9 additions & 1 deletion src/libcompiler_builtins/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,15 @@ fn main() {
// compiler-rt's build system already
cfg.flag("-fno-builtin");
cfg.flag("-fvisibility=hidden");
cfg.flag("-fomit-frame-pointer");
// Accepted practice on Solaris is to never omit frame pointer so that
// system observability tools work as expected. In addition, at least
// on Solaris, -fomit-frame-pointer on sparcv9 appears to generate
// references to data outside of the current stack frame. A search of
// the gcc bug database provides a variety of issues surrounding
// -fomit-frame-pointer on non-x86 platforms.
if !target.contains("solaris") && !target.contains("sparc") {
cfg.flag("-fomit-frame-pointer");
}
cfg.flag("-ffreestanding");
cfg.define("VISIBILITY_HIDDEN", None);
}
Expand Down
36 changes: 23 additions & 13 deletions src/librustc/cfg/construct.rs
Original file line number Diff line number Diff line change
Expand Up @@ -220,15 +220,24 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> {
// Note that `break` and `continue` statements
// may cause additional edges.

// Is the condition considered part of the loop?
let loopback = self.add_dummy_node(&[pred]); // 1
let cond_exit = self.expr(&cond, loopback); // 2
let expr_exit = self.add_ast_node(expr.id, &[cond_exit]); // 3

// Create expr_exit without pred (cond_exit)
let expr_exit = self.add_ast_node(expr.id, &[]); // 3

// The LoopScope needs to be on the loop_scopes stack while evaluating the
// condition and the body of the loop (both can break out of the loop)
self.loop_scopes.push(LoopScope {
loop_id: expr.id,
continue_index: loopback,
break_index: expr_exit
});

let cond_exit = self.expr(&cond, loopback); // 2

// Add pred (cond_exit) to expr_exit
self.add_contained_edge(cond_exit, expr_exit);

let body_exit = self.block(&body, cond_exit); // 4
self.add_contained_edge(body_exit, loopback); // 5
self.loop_scopes.pop();
Expand Down Expand Up @@ -294,17 +303,17 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> {
self.add_unreachable_node()
}

hir::ExprBreak(label, ref opt_expr) => {
hir::ExprBreak(destination, ref opt_expr) => {
let v = self.opt_expr(opt_expr, pred);
let loop_scope = self.find_scope(expr, label);
let loop_scope = self.find_scope(expr, destination);
let b = self.add_ast_node(expr.id, &[v]);
self.add_exiting_edge(expr, b,
loop_scope, loop_scope.break_index);
self.add_unreachable_node()
}

hir::ExprAgain(label) => {
let loop_scope = self.find_scope(expr, label);
hir::ExprAgain(destination) => {
let loop_scope = self.find_scope(expr, destination);
let a = self.add_ast_node(expr.id, &[pred]);
self.add_exiting_edge(expr, a,
loop_scope, loop_scope.continue_index);
Expand Down Expand Up @@ -579,17 +588,18 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> {

fn find_scope(&self,
expr: &hir::Expr,
label: Option<hir::Label>) -> LoopScope {
match label {
None => *self.loop_scopes.last().unwrap(),
Some(label) => {
destination: hir::Destination) -> LoopScope {

match destination.loop_id.into() {
Ok(loop_id) => {
for l in &self.loop_scopes {
if l.loop_id == label.loop_id {
if l.loop_id == loop_id {
return *l;
}
}
span_bug!(expr.span, "no loop scope for id {}", label.loop_id);
span_bug!(expr.span, "no loop scope for id {}", loop_id);
}
Err(err) => span_bug!(expr.span, "loop scope error: {}", err)
}
}
}
5 changes: 3 additions & 2 deletions src/librustc/hir/def.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use hir::def_id::DefId;
use util::nodemap::NodeMap;
use syntax::ast;
use syntax::ext::base::MacroKind;
use hir;

#[derive(Clone, Copy, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)]
Expand Down Expand Up @@ -53,7 +54,7 @@ pub enum Def {
Label(ast::NodeId),

// Macro namespace
Macro(DefId),
Macro(DefId, MacroKind),

// Both namespaces
Err,
Expand Down Expand Up @@ -141,7 +142,7 @@ impl Def {
Def::Variant(id) | Def::VariantCtor(id, ..) | Def::Enum(id) | Def::TyAlias(id) |
Def::AssociatedTy(id) | Def::TyParam(id) | Def::Struct(id) | Def::StructCtor(id, ..) |
Def::Union(id) | Def::Trait(id) | Def::Method(id) | Def::Const(id) |
Def::AssociatedConst(id) | Def::Local(id) | Def::Upvar(id, ..) | Def::Macro(id) => {
Def::AssociatedConst(id) | Def::Local(id) | Def::Upvar(id, ..) | Def::Macro(id, ..) => {
id
}

Expand Down
24 changes: 14 additions & 10 deletions src/librustc/hir/intravisit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1006,18 +1006,22 @@ pub fn walk_expr<'v, V: Visitor<'v>>(visitor: &mut V, expression: &'v Expr) {
ExprPath(ref qpath) => {
visitor.visit_qpath(qpath, expression.id, expression.span);
}
ExprBreak(None, ref opt_expr) => {
ExprBreak(label, ref opt_expr) => {
label.ident.map(|ident| {
if let Ok(loop_id) = label.loop_id.into() {
visitor.visit_def_mention(Def::Label(loop_id));
}
visitor.visit_name(ident.span, ident.node.name);
});
walk_list!(visitor, visit_expr, opt_expr);
}
ExprBreak(Some(label), ref opt_expr) => {
visitor.visit_def_mention(Def::Label(label.loop_id));
visitor.visit_name(label.span, label.name);
walk_list!(visitor, visit_expr, opt_expr);
}
ExprAgain(None) => {}
ExprAgain(Some(label)) => {
visitor.visit_def_mention(Def::Label(label.loop_id));
visitor.visit_name(label.span, label.name);
ExprAgain(label) => {
label.ident.map(|ident| {
if let Ok(loop_id) = label.loop_id.into() {
visitor.visit_def_mention(Def::Label(loop_id));
}
visitor.visit_name(ident.span, ident.node.name);
});
}
ExprRet(ref optional_expression) => {
walk_list!(visitor, visit_expr, optional_expression);
Expand Down
Loading