1
Fork 0

Auto merge of #50003 - kennytm:rollup, r=kennytm

Rollup of 8 pull requests

Successful merges:

 - #49555 (Inline most of the code paths for conversions with boxed slices)
 - #49606 (Prevent broken pipes causing ICEs)
 - #49646 (Use box syntax instead of Box::new in Mutex::remutex on Windows)
 - #49647 (Remove `underscore_lifetimes` and `match_default_bindings` from active feature list)
 - #49931 (Fix incorrect span in `&mut` suggestion)
 - #49959 (rustbuild: allow building tools with debuginfo)
 - #49965 (Remove warning about f64->f32 cast being potential UB)
 - #49994 (Remove unnecessary indentation in rustdoc book codeblock.)

Failed merges:
This commit is contained in:
bors 2018-04-16 20:35:57 +00:00
commit 4a3ab8b234
21 changed files with 90 additions and 49 deletions

View file

@ -121,6 +121,7 @@ configuration used in the build process. Some options to note:
#### `[rust]`:
- `debuginfo = true` - Build a compiler with debuginfo. Makes building rustc slower, but then you can use a debugger to debug `rustc`.
- `debuginfo-lines = true` - An alternative to `debuginfo = true` that doesn't let you use a debugger, but doesn't make building rustc slower and still gives you line numbers in backtraces.
- `debuginfo-tools = true` - Build the extended tools with debuginfo.
- `debug-assertions = true` - Makes the log output of `debug!` work.
- `optimize = false` - Disable optimizations to speed up compilation of stage1 rust, but makes the stage1 compiler x100 slower.

View file

@ -262,6 +262,10 @@
# standard library.
#debuginfo-only-std = false
# Enable debuginfo for the extended tools: cargo, rls, rustfmt
# Adding debuginfo makes them several times larger.
#debuginfo-tools = false
# Whether or not jemalloc is built and enabled
#use-jemalloc = true

View file

@ -622,10 +622,14 @@ impl<'a> Builder<'a> {
cargo.env("RUSTDOC_LIBDIR", self.rustc_libdir(self.compiler(2, self.build.build)));
}
if mode != Mode::Tool {
// Tools don't get debuginfo right now, e.g. cargo and rls don't
// get compiled with debuginfo.
// Adding debuginfo increases their sizes by a factor of 3-4.
if mode == Mode::Tool {
// Tools like cargo and rls don't get debuginfo by default right now, but this can be
// enabled in the config. Adding debuginfo makes them several times larger.
if self.config.rust_debuginfo_tools {
cargo.env("RUSTC_DEBUGINFO", self.config.rust_debuginfo.to_string());
cargo.env("RUSTC_DEBUGINFO_LINES", self.config.rust_debuginfo_lines.to_string());
}
} else {
cargo.env("RUSTC_DEBUGINFO", self.config.rust_debuginfo.to_string());
cargo.env("RUSTC_DEBUGINFO_LINES", self.config.rust_debuginfo_lines.to_string());
cargo.env("RUSTC_FORCE_UNSTABLE", "1");

View file

@ -94,6 +94,7 @@ pub struct Config {
pub rust_debuginfo: bool,
pub rust_debuginfo_lines: bool,
pub rust_debuginfo_only_std: bool,
pub rust_debuginfo_tools: bool,
pub rust_rpath: bool,
pub rustc_parallel_queries: bool,
pub rustc_default_linker: Option<String>,
@ -282,6 +283,7 @@ struct Rust {
debuginfo: Option<bool>,
debuginfo_lines: Option<bool>,
debuginfo_only_std: Option<bool>,
debuginfo_tools: Option<bool>,
experimental_parallel_queries: Option<bool>,
debug_jemalloc: Option<bool>,
use_jemalloc: Option<bool>,
@ -462,6 +464,7 @@ impl Config {
let mut llvm_assertions = None;
let mut debuginfo_lines = None;
let mut debuginfo_only_std = None;
let mut debuginfo_tools = None;
let mut debug = None;
let mut debug_jemalloc = None;
let mut debuginfo = None;
@ -499,6 +502,7 @@ impl Config {
debuginfo = rust.debuginfo;
debuginfo_lines = rust.debuginfo_lines;
debuginfo_only_std = rust.debuginfo_only_std;
debuginfo_tools = rust.debuginfo_tools;
optimize = rust.optimize;
ignore_git = rust.ignore_git;
debug_jemalloc = rust.debug_jemalloc;
@ -582,6 +586,7 @@ impl Config {
};
config.rust_debuginfo_lines = debuginfo_lines.unwrap_or(default);
config.rust_debuginfo_only_std = debuginfo_only_std.unwrap_or(default);
config.rust_debuginfo_tools = debuginfo_tools.unwrap_or(false);
let default = debug == Some(true);
config.debug_jemalloc = debug_jemalloc.unwrap_or(default);

View file

@ -79,6 +79,7 @@ o("llvm-release-debuginfo", "llvm.release-debuginfo", "build LLVM with debugger
o("debuginfo", "rust.debuginfo", "build with debugger metadata")
o("debuginfo-lines", "rust.debuginfo-lines", "build with line number debugger metadata")
o("debuginfo-only-std", "rust.debuginfo-only-std", "build only libstd with debugging information")
o("debuginfo-tools", "rust.debuginfo-tools", "build extended tools with debugging information")
o("debug-jemalloc", "rust.debug-jemalloc", "build jemalloc with --enable-debug --enable-fill")
v("save-toolstates", "rust.save-toolstates", "save build and test status of external tools into this file")

View file

@ -138,7 +138,7 @@ To keep each code block testable, we want the whole program in each block, but
we don't want the reader to see every line every time. Here's what we put in
our source code:
```text
``````markdown
First, we set `x` to five:
```
@ -162,7 +162,7 @@ our source code:
# let y = 6;
println!("{}", x + y);
```
```
``````
By repeating all parts of the example, you can ensure that your example still
compiles, while only showing the parts that are relevant to that part of your

View file

@ -429,6 +429,7 @@ impl<'a, T: Copy> From<&'a [T]> for Box<[T]> {
#[stable(feature = "box_from_slice", since = "1.17.0")]
impl<'a> From<&'a str> for Box<str> {
#[inline]
fn from(s: &'a str) -> Box<str> {
unsafe { from_boxed_utf8_unchecked(Box::from(s.as_bytes())) }
}
@ -436,6 +437,7 @@ impl<'a> From<&'a str> for Box<str> {
#[stable(feature = "boxed_str_conv", since = "1.19.0")]
impl From<Box<str>> for Box<[u8]> {
#[inline]
fn from(s: Box<str>) -> Self {
unsafe { Box::from_raw(Box::into_raw(s) as *mut [u8]) }
}

View file

@ -1827,6 +1827,7 @@ impl str {
/// assert_eq!(*boxed_bytes, *s.as_bytes());
/// ```
#[stable(feature = "str_box_extras", since = "1.20.0")]
#[inline]
pub fn into_boxed_bytes(self: Box<str>) -> Box<[u8]> {
self.into()
}
@ -2065,6 +2066,7 @@ impl str {
/// assert_eq!(boxed_str.into_string(), string);
/// ```
#[stable(feature = "box_str", since = "1.4.0")]
#[inline]
pub fn into_string(self: Box<str>) -> String {
let slice = Box::<[u8]>::from(self);
unsafe { String::from_utf8_unchecked(slice.into_vec()) }
@ -2323,6 +2325,7 @@ impl str {
/// assert_eq!("☺", &*smile);
/// ```
#[stable(feature = "str_box_extras", since = "1.20.0")]
#[inline]
pub unsafe fn from_boxed_utf8_unchecked(v: Box<[u8]>) -> Box<str> {
Box::from_raw(Box::into_raw(v) as *mut str)
}

View file

@ -1586,6 +1586,7 @@ impl String {
/// let b = s.into_boxed_str();
/// ```
#[stable(feature = "box_str", since = "1.4.0")]
#[inline]
pub fn into_boxed_str(self) -> Box<str> {
let slice = self.vec.into_boxed_slice();
unsafe { from_boxed_utf8_unchecked(slice) }

View file

@ -583,8 +583,10 @@ impl<T> Vec<T> {
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub fn shrink_to_fit(&mut self) {
if self.capacity() != self.len {
self.buf.shrink_to_fit(self.len);
}
}
/// Shrinks the capacity of the vector with a lower bound.
///

View file

@ -547,6 +547,18 @@ fn run_compiler_impl<'a>(args: &[String],
(result, Some(sess))
}
#[cfg(unix)]
pub fn set_sigpipe_handler() {
unsafe {
// Set the SIGPIPE signal handler, so that an EPIPE
// will cause rustc to terminate, as expected.
assert!(libc::signal(libc::SIGPIPE, libc::SIG_DFL) != libc::SIG_ERR);
}
}
#[cfg(windows)]
pub fn set_sigpipe_handler() {}
// Extract output directory and file from matches.
fn make_output(matches: &getopts::Matches) -> (Option<PathBuf>, Option<PathBuf>) {
let odir = matches.opt_str("out-dir").map(|o| PathBuf::from(&o));

View file

@ -1639,10 +1639,18 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
} else {
self.get_default_err_msg(place)
};
let sp = self.mir.source_info(locations[0]).span;
let mut to_suggest_span = String::new();
if let Ok(src) =
self.tcx.sess.codemap().span_to_snippet(sp) {
to_suggest_span = src[1..].to_string();
};
err_info = Some((
self.mir.source_info(locations[0]).span,
sp,
"consider changing this to be a \
mutable reference: `&mut`", item_msg,
mutable reference",
to_suggest_span,
item_msg,
self.get_primary_err_msg(base)));
}
},
@ -1652,9 +1660,15 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
_ => {},
}
if let Some((err_help_span, err_help_stmt, item_msg, sec_span)) = err_info {
if let Some((err_help_span,
err_help_stmt,
to_suggest_span,
item_msg,
sec_span)) = err_info {
let mut err = self.tcx.cannot_assign(span, &item_msg, Origin::Mir);
err.span_suggestion(err_help_span, err_help_stmt, format!(""));
err.span_suggestion(err_help_span,
err_help_stmt,
format!("&mut {}", to_suggest_span));
if place != place_err {
err.span_label(span, sec_span);
}

View file

@ -29,7 +29,6 @@
#![feature(slice_sort_by_cached_key)]
#![feature(optin_builtin_traits)]
#![feature(inclusive_range_fields)]
#![feature(underscore_lifetimes)]
use rustc::dep_graph::WorkProduct;
use syntax_pos::symbol::Symbol;

View file

@ -502,10 +502,6 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
&format!("{}, producing the closest possible value",
msg),
cast_suggestion);
err.warn("casting here will cause undefined behavior if the value is \
finite but larger or smaller than the largest or smallest \
finite value representable by `f32` (this is a bug and will be \
fixed)");
}
true
}

View file

@ -82,7 +82,6 @@ This API is completely unstable and subject to change.
#![feature(slice_patterns)]
#![feature(slice_sort_by_cached_key)]
#![feature(dyn_trait)]
#![feature(underscore_lifetimes)]
#[macro_use] extern crate log;
#[macro_use] extern crate syntax;

View file

@ -100,6 +100,7 @@ struct Output {
pub fn main() {
const STACK_SIZE: usize = 32_000_000; // 32MB
rustc_driver::set_sigpipe_handler();
env_logger::init();
let res = std::thread::Builder::new().stack_size(STACK_SIZE).spawn(move || {
syntax::with_globals(move || {

View file

@ -117,7 +117,7 @@ impl Mutex {
0 => {}
n => return n as *mut _,
}
let mut re = Box::new(ReentrantMutex::uninitialized());
let mut re = box ReentrantMutex::uninitialized();
re.init();
let re = Box::into_raw(re);
match self.lock.compare_and_swap(0, re as usize, Ordering::SeqCst) {

View file

@ -378,12 +378,6 @@ declare_features! (
// Future-proofing enums/structs with #[non_exhaustive] attribute (RFC 2008)
(active, non_exhaustive, "1.22.0", Some(44109), None),
// allow `'_` placeholder lifetimes
(active, underscore_lifetimes, "1.22.0", Some(44524), None),
// Default match binding modes (RFC 2005)
(active, match_default_bindings, "1.22.0", Some(42640), None),
// Trait object syntax with `dyn` prefix
(active, dyn_trait, "1.22.0", Some(44662), Some(Edition::Edition2018)),

View file

@ -23,4 +23,7 @@ extern {}
extern crate rustc_driver;
fn main() { rustc_driver::main() }
fn main() {
rustc_driver::set_sigpipe_handler();
rustc_driver::main()
}

View file

@ -2,7 +2,7 @@ error[E0594]: cannot assign to data in a `&` reference
--> $DIR/issue-47388.rs:18:5
|
LL | let fancy_ref = &(&mut fancy);
| ------------- help: consider changing this to be a mutable reference: `&mut`
| ------------- help: consider changing this to be a mutable reference: `&mut (&mut fancy)`
LL | fancy_ref.num = 6; //~ ERROR E0594
| ^^^^^^^^^^^^^^^^^ `fancy_ref` is a `&` reference, so the data it refers to cannot be written