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 next #39140

Merged
merged 5 commits into from
Jan 17, 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
460 changes: 460 additions & 0 deletions RELEASES.md

Large diffs are not rendered by default.

13 changes: 9 additions & 4 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -647,6 +647,7 @@ opt_nosave debug-assertions 0 "build with debugging assertions"
opt_nosave llvm-release-debuginfo 0 "build LLVM with debugger metadata"
opt_nosave debuginfo 0 "build with debugger metadata"
opt_nosave debuginfo-lines 0 "build with line number debugger metadata"
opt_nosave debuginfo-only-std 0 "build only libstd with debugging information"
opt_nosave debug-jemalloc 0 "build jemalloc with --enable-debug --enable-fill"

valopt localstatedir "/var/lib" "local state directory"
Expand Down Expand Up @@ -732,23 +733,26 @@ case "$CFG_RELEASE_CHANNEL" in
nightly )
msg "overriding settings for $CFG_RELEASE_CHANNEL"
CFG_ENABLE_LLVM_ASSERTIONS=1

# FIXME(#37364) shouldn't have to disable this on windows-gnu
# FIXME(stage0) re-enable this on the next stage0 now that #35566 is
# fixed
case "$CFG_BUILD" in
*-pc-windows-gnu)
;;
*)
CFG_ENABLE_DEBUGINFO_LINES=1
CFG_ENABLE_DEBUGINFO_LINES=1
CFG_ENABLE_DEBUGINFO_ONLY_STD=1
;;
esac

;;
beta | stable)
msg "overriding settings for $CFG_RELEASE_CHANNEL"
case "$CFG_BUILD" in
*-pc-windows-gnu)
;;
*)
CFG_ENABLE_DEBUGINFO_LINES=1
CFG_ENABLE_DEBUGINFO_LINES=1
CFG_ENABLE_DEBUGINFO_ONLY_STD=1
;;
esac
;;
Expand Down Expand Up @@ -784,6 +788,7 @@ if [ -n "$CFG_ENABLE_DEBUG_ASSERTIONS" ]; then putvar CFG_ENABLE_DEBUG_ASSERTION
if [ -n "$CFG_ENABLE_LLVM_RELEASE_DEBUGINFO" ]; then putvar CFG_ENABLE_LLVM_RELEASE_DEBUGINFO; fi
if [ -n "$CFG_ENABLE_DEBUGINFO" ]; then putvar CFG_ENABLE_DEBUGINFO; fi
if [ -n "$CFG_ENABLE_DEBUGINFO_LINES" ]; then putvar CFG_ENABLE_DEBUGINFO_LINES; fi
if [ -n "$CFG_ENABLE_DEBUGINFO_ONLY_STD" ]; then putvar CFG_ENABLE_DEBUGINFO_ONLY_STD; fi
if [ -n "$CFG_ENABLE_DEBUG_JEMALLOC" ]; then putvar CFG_ENABLE_DEBUG_JEMALLOC; fi

step_msg "looking for build programs"
Expand Down
7 changes: 7 additions & 0 deletions src/bootstrap/compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,13 @@ pub fn rustc<'a>(build: &'a Build, target: &str, compiler: &Compiler<'a>) {
.env("CFG_PREFIX", build.config.prefix.clone().unwrap_or(String::new()))
.env("CFG_LIBDIR_RELATIVE", "lib");

// If we're not building a compiler with debugging information then remove
// these two env vars which would be set otherwise.
if build.config.rust_debuginfo_only_std {
cargo.env_remove("RUSTC_DEBUGINFO");
cargo.env_remove("RUSTC_DEBUGINFO_LINES");
}

if let Some(ref ver_date) = build.ver_date {
cargo.env("CFG_VER_DATE", ver_date);
}
Expand Down
4 changes: 4 additions & 0 deletions src/bootstrap/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ pub struct Config {
pub rust_debug_assertions: bool,
pub rust_debuginfo: bool,
pub rust_debuginfo_lines: bool,
pub rust_debuginfo_only_std: bool,
pub rust_rpath: bool,
pub rustc_default_linker: Option<String>,
pub rustc_default_ar: Option<String>,
Expand Down Expand Up @@ -167,6 +168,7 @@ struct Rust {
debug_assertions: Option<bool>,
debuginfo: Option<bool>,
debuginfo_lines: Option<bool>,
debuginfo_only_std: Option<bool>,
debug_jemalloc: Option<bool>,
use_jemalloc: Option<bool>,
backtrace: Option<bool>,
Expand Down Expand Up @@ -279,6 +281,7 @@ impl Config {
set(&mut config.rust_debug_assertions, rust.debug_assertions);
set(&mut config.rust_debuginfo, rust.debuginfo);
set(&mut config.rust_debuginfo_lines, rust.debuginfo_lines);
set(&mut config.rust_debuginfo_only_std, rust.debuginfo_only_std);
set(&mut config.rust_optimize, rust.optimize);
set(&mut config.rust_optimize_tests, rust.optimize_tests);
set(&mut config.rust_debuginfo_tests, rust.debuginfo_tests);
Expand Down Expand Up @@ -371,6 +374,7 @@ impl Config {
("DEBUG_ASSERTIONS", self.rust_debug_assertions),
("DEBUGINFO", self.rust_debuginfo),
("DEBUGINFO_LINES", self.rust_debuginfo_lines),
("DEBUGINFO_ONLY_STD", self.rust_debuginfo_only_std),
("JEMALLOC", self.use_jemalloc),
("DEBUG_JEMALLOC", self.debug_jemalloc),
("RPATH", self.rust_rpath),
Expand Down
5 changes: 5 additions & 0 deletions src/bootstrap/config.toml.example
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,11 @@
# Whether or not line number debug information is emitted
#debuginfo-lines = false

# Whether or not to only build debuginfo for the standard library if enabled.
# If enabled, this will not compile the compiler with debuginfo, just the
# standard library.
#debuginfo-only-std = false

# Whether or not jemalloc is built and enabled
#use-jemalloc = true

Expand Down
28 changes: 15 additions & 13 deletions src/librustc_mir/transform/promote_consts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ impl<'a, 'tcx> Promoter<'a, 'tcx> {
self.visit_rvalue(&mut rvalue, loc);
self.assign(new_temp, rvalue, source_info.span);
} else {
let mut terminator = if self.keep_original {
let terminator = if self.keep_original {
self.source[loc.block].terminator().clone()
} else {
let terminator = self.source[loc.block].terminator_mut();
Expand All @@ -256,28 +256,30 @@ impl<'a, 'tcx> Promoter<'a, 'tcx> {
}
};

let last = self.promoted.basic_blocks().last().unwrap();
let new_target = self.new_block();

terminator.kind = match terminator.kind {
match terminator.kind {
TerminatorKind::Call { mut func, mut args, .. } => {
self.visit_operand(&mut func, loc);
for arg in &mut args {
self.visit_operand(arg, loc);
}
TerminatorKind::Call {
func: func,
args: args,
cleanup: None,
destination: Some((Lvalue::Local(new_temp), new_target))
}

let last = self.promoted.basic_blocks().last().unwrap();
let new_target = self.new_block();

*self.promoted[last].terminator_mut() = Terminator {
kind: TerminatorKind::Call {
func: func,
args: args,
cleanup: None,
destination: Some((Lvalue::Local(new_temp), new_target))
},
..terminator
};
}
ref kind => {
span_bug!(terminator.source_info.span, "{:?} not promotable", kind);
}
};

*self.promoted[last].terminator_mut() = terminator;
};

self.keep_original = old_keep_original;
Expand Down
5 changes: 4 additions & 1 deletion src/librustc_resolve/build_reduced_graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ impl<'b> Resolver<'b> {
let is_prelude = attr::contains_name(&item.attrs, "prelude_import");

match view_path.node {
ViewPathSimple(binding, ref full_path) => {
ViewPathSimple(mut binding, ref full_path) => {
let mut source = full_path.segments.last().unwrap().identifier;
let source_name = source.name;
if source_name == "mod" || source_name == "self" {
Expand All @@ -149,6 +149,9 @@ impl<'b> Resolver<'b> {
ModuleKind::Block(..) => unreachable!(),
};
source.name = crate_name;
if binding.name == "$crate" {
binding.name = crate_name;
}

self.session.struct_span_warn(item.span, "`$crate` may not be imported")
.note("`use $crate;` was erroneously allowed and \
Expand Down
7 changes: 6 additions & 1 deletion src/test/compile-fail/auxiliary/import_crate_var.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,10 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

pub fn f() {}

#[macro_export]
macro_rules! m { () => { use $crate; } }
macro_rules! m { () => {
use $crate;
import_crate_var::f();
} }
6 changes: 4 additions & 2 deletions src/test/compile-fail/import-crate-var.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@
// aux-build:import_crate_var.rs
// error-pattern: `$crate` may not be imported
// error-pattern: `use $crate;` was erroneously allowed and will become a hard error
// error-pattern: compilation successful

#![feature(rustc_attrs)]

#[macro_use] extern crate import_crate_var;
m!();

#[rustc_error]
fn main() {}
fn main() {
m!();
}
7 changes: 7 additions & 0 deletions src/test/run-pass/issue-37991.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,14 @@ const fn foo() -> i64 {
3
}

const fn bar(x: i64) -> i64 {
x*2
}

fn main() {
let val = &(foo() % 2);
assert_eq!(*val, 1);

let val2 = &(bar(1+1) % 3);
assert_eq!(*val2, 1);
}