From adfebed9db8d280487a8056f5b56331e3af7a33a Mon Sep 17 00:00:00 2001 From: Samuel Holland Date: Mon, 28 Aug 2017 11:22:11 -0500 Subject: [PATCH 01/14] Explicitly run perl for OpenSSL Configure OpenSSL's Configure script is missing a shebang. On some platforms, execve falls back to execution with the shell. Some other platforms, like musl, will fail with an exec format error. Avoid this by calling perl explicitly (since it's a perl script). --- src/bootstrap/native.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/bootstrap/native.rs b/src/bootstrap/native.rs index 0a307e72bf61d..dfbef044fee86 100644 --- a/src/bootstrap/native.rs +++ b/src/bootstrap/native.rs @@ -388,7 +388,8 @@ impl Step for Openssl { drop(fs::remove_dir_all(&dst)); build.run(Command::new("tar").arg("xf").arg(&tarball).current_dir(&out)); - let mut configure = Command::new(obj.join("Configure")); + let mut configure = Command::new("perl"); + configure.arg(obj.join("Configure")); configure.arg(format!("--prefix={}", dst.display())); configure.arg("no-dso"); configure.arg("no-ssl2"); From 51a478c90b31c1b2248a1d24fa933c570048593c Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Fri, 1 Sep 2017 22:29:49 -0700 Subject: [PATCH 02/14] rustc: Separately feature gate repr(i128) Brought up during the discussion of #35118, the support for this is still somewhat buggy and so stabilization likely wants to be considered independently of the type itself. --- src/librustc_typeck/check/mod.rs | 7 +++++-- src/libsyntax/feature_gate.rs | 3 +++ src/test/compile-fail/feature-gate-repr128.rs | 17 +++++++++++++++++ 3 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 src/test/compile-fail/feature-gate-repr128.rs diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs index 2fa80a10d12e4..538d9ee72d64b 100644 --- a/src/librustc_typeck/check/mod.rs +++ b/src/librustc_typeck/check/mod.rs @@ -1599,9 +1599,12 @@ pub fn check_enum<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, let repr_type_ty = def.repr.discr_type().to_ty(tcx); if repr_type_ty == tcx.types.i128 || repr_type_ty == tcx.types.u128 { - if !tcx.sess.features.borrow().i128_type { + if !tcx.sess.features.borrow().repr128 { emit_feature_err(&tcx.sess.parse_sess, - "i128_type", sp, GateIssue::Language, "128-bit type is unstable"); + "repr128", + sp, + GateIssue::Language, + "repr with 128-bit type is unstable"); } } diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs index 8251b03632aeb..83827a25d61bf 100644 --- a/src/libsyntax/feature_gate.rs +++ b/src/libsyntax/feature_gate.rs @@ -312,6 +312,9 @@ declare_features! ( // The `i128` type (active, i128_type, "1.16.0", Some(35118)), + // The `repr(i128)` annotation for enums + (active, repr128, "1.16.0", Some(35118)), + // The `unadjusted` ABI. Perma unstable. (active, abi_unadjusted, "1.16.0", None), diff --git a/src/test/compile-fail/feature-gate-repr128.rs b/src/test/compile-fail/feature-gate-repr128.rs new file mode 100644 index 0000000000000..96fffa6cdd0dc --- /dev/null +++ b/src/test/compile-fail/feature-gate-repr128.rs @@ -0,0 +1,17 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#[repr(u128)] +enum A { //~ ERROR repr with 128-bit type is unstable + //~| HELP: add #![feature(repr128)] + A(u64) +} + +fn main() {} From 7e0b79d14ef0ba274c5b3d70ea037e981f02db2d Mon Sep 17 00:00:00 2001 From: Eduard-Mihai Burtescu Date: Mon, 4 Sep 2017 13:23:49 +0300 Subject: [PATCH 03/14] Use rvalue promotion to 'static instead of static items. --- src/libcore/macros.rs | 13 ++----- src/librustc_mir/transform/elaborate_drops.rs | 1 - src/libstd/ffi/c_str.rs | 2 +- src/libstd/macros.rs | 18 ++------- src/libsyntax_ext/format.rs | 39 ++----------------- 5 files changed, 10 insertions(+), 63 deletions(-) diff --git a/src/libcore/macros.rs b/src/libcore/macros.rs index ce183389a8083..debff08df22b5 100644 --- a/src/libcore/macros.rs +++ b/src/libcore/macros.rs @@ -17,18 +17,11 @@ macro_rules! panic { panic!("explicit panic") ); ($msg:expr) => ({ - static _MSG_FILE_LINE_COL: (&'static str, &'static str, u32, u32) = - ($msg, file!(), line!(), __rust_unstable_column!()); - $crate::panicking::panic(&_MSG_FILE_LINE_COL) + $crate::panicking::panic(&($msg, file!(), line!(), __rust_unstable_column!())) }); ($fmt:expr, $($arg:tt)*) => ({ - // The leading _'s are to avoid dead code warnings if this is - // used inside a dead function. Just `#[allow(dead_code)]` is - // insufficient, since the user may have - // `#[forbid(dead_code)]` and which cannot be overridden. - static _MSG_FILE_LINE_COL: (&'static str, u32, u32) = - (file!(), line!(), __rust_unstable_column!()); - $crate::panicking::panic_fmt(format_args!($fmt, $($arg)*), &_MSG_FILE_LINE_COL) + $crate::panicking::panic_fmt(format_args!($fmt, $($arg)*), + &(file!(), line!(), __rust_unstable_column!())) }); } diff --git a/src/librustc_mir/transform/elaborate_drops.rs b/src/librustc_mir/transform/elaborate_drops.rs index 417083c4ff801..d6477f2babf76 100644 --- a/src/librustc_mir/transform/elaborate_drops.rs +++ b/src/librustc_mir/transform/elaborate_drops.rs @@ -29,7 +29,6 @@ use syntax::ast; use syntax_pos::Span; use std::fmt; -use std::u32; pub struct ElaborateDrops; diff --git a/src/libstd/ffi/c_str.rs b/src/libstd/ffi/c_str.rs index 7392a153e3b87..7992aefcb4203 100644 --- a/src/libstd/ffi/c_str.rs +++ b/src/libstd/ffi/c_str.rs @@ -545,7 +545,7 @@ impl fmt::Debug for CStr { #[stable(feature = "cstr_default", since = "1.10.0")] impl<'a> Default for &'a CStr { fn default() -> &'a CStr { - static SLICE: &'static [c_char] = &[0]; + const SLICE: &'static [c_char] = &[0]; unsafe { CStr::from_ptr(SLICE.as_ptr()) } } } diff --git a/src/libstd/macros.rs b/src/libstd/macros.rs index 72d561fae3bd9..8089671f309d2 100644 --- a/src/libstd/macros.rs +++ b/src/libstd/macros.rs @@ -66,23 +66,11 @@ macro_rules! panic { panic!("explicit panic") }); ($msg:expr) => ({ - $crate::rt::begin_panic($msg, { - // static requires less code at runtime, more constant data - static _FILE_LINE_COL: (&'static str, u32, u32) = (file!(), line!(), - __rust_unstable_column!()); - &_FILE_LINE_COL - }) + $crate::rt::begin_panic($msg, &(file!(), line!(), __rust_unstable_column!())) }); ($fmt:expr, $($arg:tt)+) => ({ - $crate::rt::begin_panic_fmt(&format_args!($fmt, $($arg)+), { - // The leading _'s are to avoid dead code warnings if this is - // used inside a dead function. Just `#[allow(dead_code)]` is - // insufficient, since the user may have - // `#[forbid(dead_code)]` and which cannot be overridden. - static _FILE_LINE_COL: (&'static str, u32, u32) = (file!(), line!(), - __rust_unstable_column!()); - &_FILE_LINE_COL - }) + $crate::rt::begin_panic_fmt(&format_args!($fmt, $($arg)+), + &(file!(), line!(), __rust_unstable_column!())) }); } diff --git a/src/libsyntax_ext/format.rs b/src/libsyntax_ext/format.rs index 3e20bc481bde8..63c533df198d0 100644 --- a/src/libsyntax_ext/format.rs +++ b/src/libsyntax_ext/format.rs @@ -19,7 +19,7 @@ use syntax::ext::base; use syntax::ext::build::AstBuilder; use syntax::parse::token; use syntax::ptr::P; -use syntax::symbol::{Symbol, keywords}; +use syntax::symbol::Symbol; use syntax_pos::{Span, DUMMY_SP}; use syntax::tokenstream; @@ -501,32 +501,6 @@ impl<'a, 'b> Context<'a, 'b> { } } - fn static_array(ecx: &mut ExtCtxt, - name: &str, - piece_ty: P, - pieces: Vec>) - -> P { - let sp = piece_ty.span; - let ty = ecx.ty_rptr(sp, - ecx.ty(sp, ast::TyKind::Slice(piece_ty)), - Some(ecx.lifetime(sp, keywords::StaticLifetime.ident())), - ast::Mutability::Immutable); - let slice = ecx.expr_vec_slice(sp, pieces); - // static instead of const to speed up codegen by not requiring this to be inlined - let st = ast::ItemKind::Static(ty, ast::Mutability::Immutable, slice); - - let name = ecx.ident_of(name); - let item = ecx.item(sp, name, vec![], st); - let stmt = ast::Stmt { - id: ast::DUMMY_NODE_ID, - node: ast::StmtKind::Item(item), - span: sp, - }; - - // Wrap the declaration in a block so that it forms a single expression. - ecx.expr_block(ecx.block(sp, vec![stmt, ecx.stmt_expr(ecx.expr_ident(sp, name))])) - } - /// Actually builds the expression which the format_args! block will be /// expanded to fn into_expr(self) -> P { @@ -537,12 +511,7 @@ impl<'a, 'b> Context<'a, 'b> { // First, build up the static array which will become our precompiled // format "string" - let static_lifetime = self.ecx.lifetime(self.fmtsp, keywords::StaticLifetime.ident()); - let piece_ty = self.ecx.ty_rptr(self.fmtsp, - self.ecx.ty_ident(self.fmtsp, self.ecx.ident_of("str")), - Some(static_lifetime), - ast::Mutability::Immutable); - let pieces = Context::static_array(self.ecx, "__STATIC_FMTSTR", piece_ty, self.str_pieces); + let pieces = self.ecx.expr_vec_slice(self.fmtsp, self.str_pieces); // Before consuming the expressions, we have to remember spans for // count arguments as they are now generated separate from other @@ -623,9 +592,7 @@ impl<'a, 'b> Context<'a, 'b> { } else { // Build up the static array which will store our precompiled // nonstandard placeholders, if there are any. - let piece_ty = self.ecx - .ty_path(self.ecx.path_global(self.macsp, Context::rtpath(self.ecx, "Argument"))); - let fmt = Context::static_array(self.ecx, "__STATIC_FMTARGS", piece_ty, self.pieces); + let fmt = self.ecx.expr_vec_slice(self.macsp, self.pieces); ("new_v1_formatted", vec![pieces, args_slice, fmt]) }; From cf318c3718b0fc78659cab4595c41ad1a5998564 Mon Sep 17 00:00:00 2001 From: "Jonathan A. Kollasch" Date: Thu, 31 Aug 2017 09:17:50 -0500 Subject: [PATCH 04/14] bootstrap: use shasum(1) on NetBSD build hosts NetBSD doesn't ship with sha256sum. The openssl build will probably try to use perl anyway, so using perl's shasum is reasonable. --- src/bootstrap/native.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bootstrap/native.rs b/src/bootstrap/native.rs index 8173903c03440..f357c5dc2d892 100644 --- a/src/bootstrap/native.rs +++ b/src/bootstrap/native.rs @@ -366,7 +366,7 @@ impl Step for Openssl { if !ok { panic!("failed to download openssl source") } - let mut shasum = if target.contains("apple") { + let mut shasum = if target.contains("apple") || build.build.contains("netbsd") { let mut cmd = Command::new("shasum"); cmd.arg("-a").arg("256"); cmd From ab89870a1b5e66ae36390ec59d7b68ffa706a49b Mon Sep 17 00:00:00 2001 From: "Jonathan A. Kollasch" Date: Thu, 31 Aug 2017 09:22:39 -0500 Subject: [PATCH 05/14] bootstrap: use tar -z on extract MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Some tar(1) programs—such as NetBSD's—do not automatically decompress. --- src/bootstrap/native.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bootstrap/native.rs b/src/bootstrap/native.rs index f357c5dc2d892..3267a3b88485c 100644 --- a/src/bootstrap/native.rs +++ b/src/bootstrap/native.rs @@ -386,7 +386,7 @@ impl Step for Openssl { let dst = build.openssl_install_dir(target).unwrap(); drop(fs::remove_dir_all(&obj)); drop(fs::remove_dir_all(&dst)); - build.run(Command::new("tar").arg("xf").arg(&tarball).current_dir(&out)); + build.run(Command::new("tar").arg("zxf").arg(&tarball).current_dir(&out)); let mut configure = Command::new(obj.join("Configure")); configure.arg(format!("--prefix={}", dst.display())); From 258ec30116b1a80f4a9fb4b14aa22dd88eb8bf31 Mon Sep 17 00:00:00 2001 From: Wonwoo Choi Date: Tue, 5 Sep 2017 18:25:42 +0900 Subject: [PATCH 06/14] Expect pipe symbol after closure parameter lists --- src/libsyntax/parse/parser.rs | 2 +- src/test/compile-fail/issue-44021.rs | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 src/test/compile-fail/issue-44021.rs diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 1f033b25fe4f6..a52d048830715 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -4699,7 +4699,7 @@ impl<'a> Parser<'a> { SeqSep::trailing_allowed(token::Comma), |p| p.parse_fn_block_arg() ); - self.bump(); + self.expect(&token::BinOp(token::Or))?; args } }; diff --git a/src/test/compile-fail/issue-44021.rs b/src/test/compile-fail/issue-44021.rs new file mode 100644 index 0000000000000..b6ec21b94c73f --- /dev/null +++ b/src/test/compile-fail/issue-44021.rs @@ -0,0 +1,16 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +struct MyStruct; +impl MyStruct { + fn f() {|x, y} //~ ERROR expected one of `:`, `@`, or `|`, found `}` +} + +fn main() {} From 05739498c236e8d26ad83bdcad0d9b8c09c6a7ac Mon Sep 17 00:00:00 2001 From: Nick Cameron Date: Tue, 5 Sep 2017 16:16:48 +1200 Subject: [PATCH 07/14] Fixup some nits from #44238 --- src/librustdoc/html/render.rs | 102 ++++++++-------------------------- 1 file changed, 22 insertions(+), 80 deletions(-) diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs index cc84e340c74f8..6dd046554e475 100644 --- a/src/librustdoc/html/render.rs +++ b/src/librustdoc/html/render.rs @@ -606,12 +606,20 @@ pub fn run(mut krate: clean::Crate, } // A short, single-line view of `s`. -fn concise_str(s: &str) -> String { +fn concise_str(mut s: &str) -> String { if s.contains('\n') { - return format!("{}...", s.lines().next().expect("Impossible! We just found a newline")); + s = s.lines().next().expect("Impossible! We just found a newline"); } if s.len() > 70 { - return format!("{} ... {}", &s[..50], &s[s.len()-20..]); + let mut lo = 50; + let mut hi = s.len() - 20; + while !s.is_char_boundary(lo) { + lo -= 1; + } + while !s.is_char_boundary(hi) { + hi += 1; + } + return format!("{} ... {}", &s[..lo], &s[hi..]); } s.to_owned() } @@ -1756,18 +1764,18 @@ fn render_markdown(w: &mut fmt::Formatter, // We only emit warnings if the user has opted-in to Pulldown rendering. let output = if render_type == RenderType::Pulldown { let pulldown_output = format!("{}", Markdown(md_text, RenderType::Pulldown)); - let differences = html_diff::get_differences(&pulldown_output, &hoedown_output); - let differences = differences.into_iter() - .filter(|s| { - match *s { - html_diff::Difference::NodeText { ref elem_text, - ref opposite_elem_text, - .. } - if match_non_whitespace(elem_text, opposite_elem_text) => false, - _ => true, + let mut differences = html_diff::get_differences(&pulldown_output, &hoedown_output); + differences.retain(|s| { + match *s { + html_diff::Difference::NodeText { ref elem_text, + ref opposite_elem_text, + .. } + if elem_text.split_whitespace().eq(opposite_elem_text.split_whitespace()) => { + false } - }) - .collect::>(); + _ => true, + } + }); if !differences.is_empty() { scx.markdown_warnings.borrow_mut().push((span, md_text.to_owned(), differences)); @@ -1781,40 +1789,6 @@ fn render_markdown(w: &mut fmt::Formatter, write!(w, "
{}{}
", prefix, output) } -// Returns true iff s1 and s2 match, ignoring whitespace. -fn match_non_whitespace(s1: &str, s2: &str) -> bool { - let s1 = s1.trim(); - let s2 = s2.trim(); - let mut cs1 = s1.chars(); - let mut cs2 = s2.chars(); - while let Some(c1) = cs1.next() { - if c1.is_whitespace() { - continue; - } - - loop { - if let Some(c2) = cs2.next() { - if !c2.is_whitespace() { - if c1 != c2 { - return false; - } - break; - } - } else { - return false; - } - } - } - - while let Some(c2) = cs2.next() { - if !c2.is_whitespace() { - return false; - } - } - - true -} - fn document_short(w: &mut fmt::Formatter, item: &clean::Item, link: AssocItemLink, cx: &Context, prefix: &str) -> fmt::Result { if let Some(s) = item.doc_value() { @@ -3729,35 +3703,3 @@ fn test_name_sorting() { sorted.sort_by_key(|&s| name_key(s)); assert_eq!(names, sorted); } - -#[cfg(test)] -#[test] -fn test_match_non_whitespace() { - assert!(match_non_whitespace("", "")); - assert!(match_non_whitespace(" ", "")); - assert!(match_non_whitespace("", " ")); - - assert!(match_non_whitespace("a", "a")); - assert!(match_non_whitespace(" a ", "a")); - assert!(match_non_whitespace("a", " a")); - assert!(match_non_whitespace("abc", "abc")); - assert!(match_non_whitespace("abc", " abc ")); - assert!(match_non_whitespace("abc ", "abc")); - assert!(match_non_whitespace("abc xyz", "abc xyz")); - assert!(match_non_whitespace("abc xyz", "abc\nxyz")); - assert!(match_non_whitespace("abc xyz", "abcxyz")); - assert!(match_non_whitespace("abcxyz", "abc xyz")); - assert!(match_non_whitespace("abc xyz ", " abc xyz\n")); - - assert!(!match_non_whitespace("a", "b")); - assert!(!match_non_whitespace(" a ", "c")); - assert!(!match_non_whitespace("a", " aa")); - assert!(!match_non_whitespace("abc", "ac")); - assert!(!match_non_whitespace("abc", " adc ")); - assert!(!match_non_whitespace("abc ", "abca")); - assert!(!match_non_whitespace("abc xyz", "abc xy")); - assert!(!match_non_whitespace("abc xyz", "bc\nxyz")); - assert!(!match_non_whitespace("abc xyz", "abc.xyz")); - assert!(!match_non_whitespace("abcxyz", "abc.xyz")); - assert!(!match_non_whitespace("abc xyz ", " abc xyz w")); -} From 502e707fa70c845e55f86bf9d840a814d04945a6 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Tue, 5 Sep 2017 20:54:01 +0200 Subject: [PATCH 08/14] Reduce false positives number in rustdoc html diff --- src/librustdoc/html/render.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs index cc84e340c74f8..7e0e1e5b41663 100644 --- a/src/librustdoc/html/render.rs +++ b/src/librustdoc/html/render.rs @@ -660,9 +660,13 @@ fn render_difference(diff: &html_diff::Difference) { elem.path, elem.element_name, elem_attributes, opposite_elem_attributes); } html_diff::Difference::NodeText { ref elem, ref elem_text, ref opposite_elem_text, .. } => { - let (s1, s2) = concise_compared_strs(elem_text, opposite_elem_text); - println!(" {} Text differs:\n expected: `{}`\n found: `{}`", - elem.path, s1, s2); + if elem_text.split("\n") + .zip(opposite_elem_text.split("\n")) + .any(|(a, b)| a.trim() != b.trim()) { + let (s1, s2) = concise_compared_strs(elem_text, opposite_elem_text); + println!(" {} Text differs:\n expected: `{}`\n found: `{}`", + elem.path, s1, s2); + } } html_diff::Difference::NotPresent { ref elem, ref opposite_elem } => { if let Some(ref elem) = *elem { From 5b76b8681c088d935b60da05e8ae81e2594f46f5 Mon Sep 17 00:00:00 2001 From: bgermann Date: Wed, 6 Sep 2017 21:31:19 +0200 Subject: [PATCH 09/14] Use memalign instead of posix_memalign for Solaris As pointed out in https://github.com/rust-lang/libc/commit/deb61c8, Solaris 10 does not support posix_memalign. Use memalign for all Solaris versions instead. With this change applied I am able to cross-build rustc for Solaris 10. --- src/liballoc_system/lib.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/liballoc_system/lib.rs b/src/liballoc_system/lib.rs index 1defe308713a7..599d79104c3b0 100644 --- a/src/liballoc_system/lib.rs +++ b/src/liballoc_system/lib.rs @@ -221,7 +221,7 @@ mod platform { } } - #[cfg(any(target_os = "android", target_os = "redox"))] + #[cfg(any(target_os = "android", target_os = "redox", target_os = "solaris"))] #[inline] unsafe fn aligned_malloc(layout: &Layout) -> *mut u8 { // On android we currently target API level 9 which unfortunately @@ -244,7 +244,7 @@ mod platform { libc::memalign(layout.align(), layout.size()) as *mut u8 } - #[cfg(not(any(target_os = "android", target_os = "redox")))] + #[cfg(not(any(target_os = "android", target_os = "redox", target_os = "solaris")))] #[inline] unsafe fn aligned_malloc(layout: &Layout) -> *mut u8 { let mut out = ptr::null_mut(); From f633284b3da04a6eb2f6525e51efd81de6320f2e Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Wed, 6 Sep 2017 22:13:59 -0700 Subject: [PATCH 10/14] std: Fix a segfault on OSX with backtraces Apparently `dladdr` can succeed but still give you NULL pointers! Closes #44379 --- src/libstd/sys/unix/backtrace/printing/dladdr.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/libstd/sys/unix/backtrace/printing/dladdr.rs b/src/libstd/sys/unix/backtrace/printing/dladdr.rs index 05a071a797838..2c0cda2c8f1cc 100644 --- a/src/libstd/sys/unix/backtrace/printing/dladdr.rs +++ b/src/libstd/sys/unix/backtrace/printing/dladdr.rs @@ -22,7 +22,8 @@ pub fn resolve_symname(frame: Frame, { unsafe { let mut info: Dl_info = intrinsics::init(); - let symname = if dladdr(frame.exact_position, &mut info) == 0 { + let symname = if dladdr(frame.exact_position, &mut info) == 0 || + info.dli_sname.is_null() { None } else { CStr::from_ptr(info.dli_sname).to_str().ok() From fc44447bb9f4f97399496998b0be325679aa57f1 Mon Sep 17 00:00:00 2001 From: est31 Date: Thu, 7 Sep 2017 09:07:44 +0200 Subject: [PATCH 11/14] Update the libcompiler_builins submodule Pulls in https://github.com/rust-lang-nursery/compiler-builtins/pull/187 for nicer build output :) --- src/libcompiler_builtins | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libcompiler_builtins b/src/libcompiler_builtins index 6b9281d2b2f0e..38ffaf97aa418 160000 --- a/src/libcompiler_builtins +++ b/src/libcompiler_builtins @@ -1 +1 @@ -Subproject commit 6b9281d2b2f0ebb94838814b1e8ace2de4b7035b +Subproject commit 38ffaf97aa418cc369ca0197a72a0b927cc0f622 From ddb072b8d77dbb4708ffa89b361375d761debc9f Mon Sep 17 00:00:00 2001 From: Joshua Liebow-Feeser Date: Thu, 7 Sep 2017 12:57:08 -0700 Subject: [PATCH 12/14] std::thread::LocalKey: Document limitation with initializers --- src/libstd/thread/local.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/libstd/thread/local.rs b/src/libstd/thread/local.rs index 4ee8132f55cee..a53c76a333a99 100644 --- a/src/libstd/thread/local.rs +++ b/src/libstd/thread/local.rs @@ -31,6 +31,10 @@ use mem; /// within a thread, and values that implement [`Drop`] get destructed when a /// thread exits. Some caveats apply, which are explained below. /// +/// A `LocalKey`'s initializer cannot recursively depend on itself, and using +/// a `LocalKey` in this way will cause the initializer to infinitely recurse +/// on the first call to `with`. +/// /// # Examples /// /// ``` From 3e8fadc2ac5d5e25aaf0449d50988c54be92dbe4 Mon Sep 17 00:00:00 2001 From: Tommy Ip Date: Sat, 9 Sep 2017 09:05:54 +0100 Subject: [PATCH 13/14] Add doc example to String::as_str Fixes #44428. --- src/liballoc/string.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/liballoc/string.rs b/src/liballoc/string.rs index ddb23b2ef37bf..1708f3e398756 100644 --- a/src/liballoc/string.rs +++ b/src/liballoc/string.rs @@ -743,6 +743,16 @@ impl String { } /// Extracts a string slice containing the entire string. + /// + /// # Examples + /// + /// Basic usage: + /// + /// ``` + /// let s = String::from("foo"); + /// + /// assert_eq!("foo", s.as_str()); + /// ``` #[inline] #[stable(feature = "string_as_str", since = "1.7.0")] pub fn as_str(&self) -> &str { From 967c4e63477a847a946186dc1b6e5fd601caf464 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20K=C3=A5re=20Alsaker?= Date: Sat, 9 Sep 2017 11:11:13 +0200 Subject: [PATCH 14/14] Fix bitrotted generator panic emission --- src/librustc_trans/mir/block.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/librustc_trans/mir/block.rs b/src/librustc_trans/mir/block.rs index 0f42a244a1ff9..3e802c8be5bf4 100644 --- a/src/librustc_trans/mir/block.rs +++ b/src/librustc_trans/mir/block.rs @@ -383,16 +383,16 @@ impl<'a, 'tcx> MirContext<'a, 'tcx> { }; let msg_str = Symbol::intern(str).as_str(); let msg_str = C_str_slice(bcx.ccx, msg_str); - let msg_file_line = C_struct(bcx.ccx, - &[msg_str, filename, line], + let msg_file_line_col = C_struct(bcx.ccx, + &[msg_str, filename, line, col], false); - let align = llalign_of_min(bcx.ccx, common::val_ty(msg_file_line)); - let msg_file_line = consts::addr_of(bcx.ccx, - msg_file_line, - align, - "panic_loc"); + let align = llalign_of_min(bcx.ccx, common::val_ty(msg_file_line_col)); + let msg_file_line_col = consts::addr_of(bcx.ccx, + msg_file_line_col, + align, + "panic_loc"); (lang_items::PanicFnLangItem, - vec![msg_file_line], + vec![msg_file_line_col], None) } };