Skip to content

Commit 11bab50

Browse files
authored
Merge pull request #39140 from brson/beta-next
Beta next
2 parents dc4f0e8 + 77d74da commit 11bab50

File tree

10 files changed

+521
-21
lines changed

10 files changed

+521
-21
lines changed

RELEASES.md

+460
Large diffs are not rendered by default.

configure

+9-4
Original file line numberDiff line numberDiff line change
@@ -647,6 +647,7 @@ opt_nosave debug-assertions 0 "build with debugging assertions"
647647
opt_nosave llvm-release-debuginfo 0 "build LLVM with debugger metadata"
648648
opt_nosave debuginfo 0 "build with debugger metadata"
649649
opt_nosave debuginfo-lines 0 "build with line number debugger metadata"
650+
opt_nosave debuginfo-only-std 0 "build only libstd with debugging information"
650651
opt_nosave debug-jemalloc 0 "build jemalloc with --enable-debug --enable-fill"
651652

652653
valopt localstatedir "/var/lib" "local state directory"
@@ -732,23 +733,26 @@ case "$CFG_RELEASE_CHANNEL" in
732733
nightly )
733734
msg "overriding settings for $CFG_RELEASE_CHANNEL"
734735
CFG_ENABLE_LLVM_ASSERTIONS=1
735-
736-
# FIXME(#37364) shouldn't have to disable this on windows-gnu
736+
# FIXME(stage0) re-enable this on the next stage0 now that #35566 is
737+
# fixed
737738
case "$CFG_BUILD" in
738739
*-pc-windows-gnu)
739740
;;
740741
*)
741-
CFG_ENABLE_DEBUGINFO_LINES=1
742+
CFG_ENABLE_DEBUGINFO_LINES=1
743+
CFG_ENABLE_DEBUGINFO_ONLY_STD=1
742744
;;
743745
esac
746+
744747
;;
745748
beta | stable)
746749
msg "overriding settings for $CFG_RELEASE_CHANNEL"
747750
case "$CFG_BUILD" in
748751
*-pc-windows-gnu)
749752
;;
750753
*)
751-
CFG_ENABLE_DEBUGINFO_LINES=1
754+
CFG_ENABLE_DEBUGINFO_LINES=1
755+
CFG_ENABLE_DEBUGINFO_ONLY_STD=1
752756
;;
753757
esac
754758
;;
@@ -784,6 +788,7 @@ if [ -n "$CFG_ENABLE_DEBUG_ASSERTIONS" ]; then putvar CFG_ENABLE_DEBUG_ASSERTION
784788
if [ -n "$CFG_ENABLE_LLVM_RELEASE_DEBUGINFO" ]; then putvar CFG_ENABLE_LLVM_RELEASE_DEBUGINFO; fi
785789
if [ -n "$CFG_ENABLE_DEBUGINFO" ]; then putvar CFG_ENABLE_DEBUGINFO; fi
786790
if [ -n "$CFG_ENABLE_DEBUGINFO_LINES" ]; then putvar CFG_ENABLE_DEBUGINFO_LINES; fi
791+
if [ -n "$CFG_ENABLE_DEBUGINFO_ONLY_STD" ]; then putvar CFG_ENABLE_DEBUGINFO_ONLY_STD; fi
787792
if [ -n "$CFG_ENABLE_DEBUG_JEMALLOC" ]; then putvar CFG_ENABLE_DEBUG_JEMALLOC; fi
788793

789794
step_msg "looking for build programs"

src/bootstrap/compile.rs

+7
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,13 @@ pub fn rustc<'a>(build: &'a Build, target: &str, compiler: &Compiler<'a>) {
190190
.env("CFG_PREFIX", build.config.prefix.clone().unwrap_or(String::new()))
191191
.env("CFG_LIBDIR_RELATIVE", "lib");
192192

193+
// If we're not building a compiler with debugging information then remove
194+
// these two env vars which would be set otherwise.
195+
if build.config.rust_debuginfo_only_std {
196+
cargo.env_remove("RUSTC_DEBUGINFO");
197+
cargo.env_remove("RUSTC_DEBUGINFO_LINES");
198+
}
199+
193200
if let Some(ref ver_date) = build.ver_date {
194201
cargo.env("CFG_VER_DATE", ver_date);
195202
}

src/bootstrap/config.rs

+4
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ pub struct Config {
6161
pub rust_debug_assertions: bool,
6262
pub rust_debuginfo: bool,
6363
pub rust_debuginfo_lines: bool,
64+
pub rust_debuginfo_only_std: bool,
6465
pub rust_rpath: bool,
6566
pub rustc_default_linker: Option<String>,
6667
pub rustc_default_ar: Option<String>,
@@ -167,6 +168,7 @@ struct Rust {
167168
debug_assertions: Option<bool>,
168169
debuginfo: Option<bool>,
169170
debuginfo_lines: Option<bool>,
171+
debuginfo_only_std: Option<bool>,
170172
debug_jemalloc: Option<bool>,
171173
use_jemalloc: Option<bool>,
172174
backtrace: Option<bool>,
@@ -279,6 +281,7 @@ impl Config {
279281
set(&mut config.rust_debug_assertions, rust.debug_assertions);
280282
set(&mut config.rust_debuginfo, rust.debuginfo);
281283
set(&mut config.rust_debuginfo_lines, rust.debuginfo_lines);
284+
set(&mut config.rust_debuginfo_only_std, rust.debuginfo_only_std);
282285
set(&mut config.rust_optimize, rust.optimize);
283286
set(&mut config.rust_optimize_tests, rust.optimize_tests);
284287
set(&mut config.rust_debuginfo_tests, rust.debuginfo_tests);
@@ -371,6 +374,7 @@ impl Config {
371374
("DEBUG_ASSERTIONS", self.rust_debug_assertions),
372375
("DEBUGINFO", self.rust_debuginfo),
373376
("DEBUGINFO_LINES", self.rust_debuginfo_lines),
377+
("DEBUGINFO_ONLY_STD", self.rust_debuginfo_only_std),
374378
("JEMALLOC", self.use_jemalloc),
375379
("DEBUG_JEMALLOC", self.debug_jemalloc),
376380
("RPATH", self.rust_rpath),

src/bootstrap/config.toml.example

+5
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,11 @@
123123
# Whether or not line number debug information is emitted
124124
#debuginfo-lines = false
125125

126+
# Whether or not to only build debuginfo for the standard library if enabled.
127+
# If enabled, this will not compile the compiler with debuginfo, just the
128+
# standard library.
129+
#debuginfo-only-std = false
130+
126131
# Whether or not jemalloc is built and enabled
127132
#use-jemalloc = true
128133

src/librustc_mir/transform/promote_consts.rs

+15-13
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ impl<'a, 'tcx> Promoter<'a, 'tcx> {
238238
self.visit_rvalue(&mut rvalue, loc);
239239
self.assign(new_temp, rvalue, source_info.span);
240240
} else {
241-
let mut terminator = if self.keep_original {
241+
let terminator = if self.keep_original {
242242
self.source[loc.block].terminator().clone()
243243
} else {
244244
let terminator = self.source[loc.block].terminator_mut();
@@ -256,28 +256,30 @@ impl<'a, 'tcx> Promoter<'a, 'tcx> {
256256
}
257257
};
258258

259-
let last = self.promoted.basic_blocks().last().unwrap();
260-
let new_target = self.new_block();
261-
262-
terminator.kind = match terminator.kind {
259+
match terminator.kind {
263260
TerminatorKind::Call { mut func, mut args, .. } => {
264261
self.visit_operand(&mut func, loc);
265262
for arg in &mut args {
266263
self.visit_operand(arg, loc);
267264
}
268-
TerminatorKind::Call {
269-
func: func,
270-
args: args,
271-
cleanup: None,
272-
destination: Some((Lvalue::Local(new_temp), new_target))
273-
}
265+
266+
let last = self.promoted.basic_blocks().last().unwrap();
267+
let new_target = self.new_block();
268+
269+
*self.promoted[last].terminator_mut() = Terminator {
270+
kind: TerminatorKind::Call {
271+
func: func,
272+
args: args,
273+
cleanup: None,
274+
destination: Some((Lvalue::Local(new_temp), new_target))
275+
},
276+
..terminator
277+
};
274278
}
275279
ref kind => {
276280
span_bug!(terminator.source_info.span, "{:?} not promotable", kind);
277281
}
278282
};
279-
280-
*self.promoted[last].terminator_mut() = terminator;
281283
};
282284

283285
self.keep_original = old_keep_original;

src/librustc_resolve/build_reduced_graph.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ impl<'b> Resolver<'b> {
135135
let is_prelude = attr::contains_name(&item.attrs, "prelude_import");
136136

137137
match view_path.node {
138-
ViewPathSimple(binding, ref full_path) => {
138+
ViewPathSimple(mut binding, ref full_path) => {
139139
let mut source = full_path.segments.last().unwrap().identifier;
140140
let source_name = source.name;
141141
if source_name == "mod" || source_name == "self" {
@@ -149,6 +149,9 @@ impl<'b> Resolver<'b> {
149149
ModuleKind::Block(..) => unreachable!(),
150150
};
151151
source.name = crate_name;
152+
if binding.name == "$crate" {
153+
binding.name = crate_name;
154+
}
152155

153156
self.session.struct_span_warn(item.span, "`$crate` may not be imported")
154157
.note("`use $crate;` was erroneously allowed and \

src/test/compile-fail/auxiliary/import_crate_var.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,10 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
pub fn f() {}
12+
1113
#[macro_export]
12-
macro_rules! m { () => { use $crate; } }
14+
macro_rules! m { () => {
15+
use $crate;
16+
import_crate_var::f();
17+
} }

src/test/compile-fail/import-crate-var.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,13 @@
1111
// aux-build:import_crate_var.rs
1212
// error-pattern: `$crate` may not be imported
1313
// error-pattern: `use $crate;` was erroneously allowed and will become a hard error
14+
// error-pattern: compilation successful
1415

1516
#![feature(rustc_attrs)]
1617

1718
#[macro_use] extern crate import_crate_var;
18-
m!();
1919

2020
#[rustc_error]
21-
fn main() {}
21+
fn main() {
22+
m!();
23+
}

src/test/run-pass/issue-37991.rs

+7
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,14 @@ const fn foo() -> i64 {
1414
3
1515
}
1616

17+
const fn bar(x: i64) -> i64 {
18+
x*2
19+
}
20+
1721
fn main() {
1822
let val = &(foo() % 2);
1923
assert_eq!(*val, 1);
24+
25+
let val2 = &(bar(1+1) % 3);
26+
assert_eq!(*val2, 1);
2027
}

0 commit comments

Comments
 (0)