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 14 pull requests #44455

Closed
wants to merge 29 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
adfebed
Explicitly run perl for OpenSSL Configure
smaeul Aug 28, 2017
51a478c
rustc: Separately feature gate repr(i128)
alexcrichton Sep 2, 2017
7e0b79d
Use rvalue promotion to 'static instead of static items.
eddyb Sep 4, 2017
cf318c3
bootstrap: use shasum(1) on NetBSD build hosts
jakllsch Aug 31, 2017
ab89870
bootstrap: use tar -z on extract
jakllsch Aug 31, 2017
258ec30
Expect pipe symbol after closure parameter lists
tirr-c Sep 5, 2017
0573949
Fixup some nits from #44238
nrc Sep 5, 2017
502e707
Reduce false positives number in rustdoc html diff
GuillaumeGomez Sep 5, 2017
5b76b86
Use memalign instead of posix_memalign for Solaris
bgermann Sep 6, 2017
f633284
std: Fix a segfault on OSX with backtraces
alexcrichton Sep 7, 2017
0571523
Rotate Travis/AppVeyor S3 keys
alexcrichton Sep 7, 2017
fc44447
Update the libcompiler_builins submodule
est31 Sep 7, 2017
ddb072b
std::thread::LocalKey: Document limitation with initializers
joshlf Sep 7, 2017
3e8fadc
Add doc example to String::as_str
tommyip Sep 9, 2017
967c4e6
Fix bitrotted generator panic emission
Zoxc Sep 9, 2017
8acb84d
Rollup merge of #44131 - smaeul:openssl-perl, r=Mark-Simulacrum
frewsxcv Sep 9, 2017
987e255
Rollup merge of #44262 - alexcrichton:repr-128-gate, r=nikomatsakis
frewsxcv Sep 9, 2017
013c0fa
Rollup merge of #44312 - eddyb:static-by-any-other-name, r=alexcrichton
frewsxcv Sep 9, 2017
e99b71e
Rollup merge of #44320 - jakllsch:jakllsch-caf2c3d2-c939-4c4d-8c68-1a…
frewsxcv Sep 9, 2017
0dcfab9
Rollup merge of #44329 - nrc:pulldown-warn-fix, r=ollie27
frewsxcv Sep 9, 2017
ff5d80a
Rollup merge of #44332 - tirr-c:issue-44021, r=petrochenkov
frewsxcv Sep 9, 2017
588b398
Rollup merge of #44347 - GuillaumeGomez:rustdoc-false-positive, r=Qui…
frewsxcv Sep 9, 2017
94bd449
Rollup merge of #44372 - bgermann:master, r=alexcrichton
frewsxcv Sep 9, 2017
71dd068
Rollup merge of #44384 - alexcrichton:osx-segfault, r=estebank
frewsxcv Sep 9, 2017
f19ec2e
Rollup merge of #44385 - alexcrichton:new-sccache-keys, r=alexcrichton
frewsxcv Sep 9, 2017
c5c0950
Rollup merge of #44387 - est31:update_compiler_builtins, r=Mark-Simul…
frewsxcv Sep 9, 2017
598988c
Rollup merge of #44396 - joshlf:tls-comment, r=alexcrichton
frewsxcv Sep 9, 2017
7ea0adf
Rollup merge of #44449 - tommyip:doc_string_as_str, r=frewsxcv
frewsxcv Sep 9, 2017
7262b7b
Rollup merge of #44451 - Zoxc:gen-panic, r=eddyb
frewsxcv Sep 9, 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
16 changes: 8 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,9 @@ matrix:
env:
global:
- SCCACHE_BUCKET=rust-lang-ci-sccache
- AWS_ACCESS_KEY_ID=AKIAIMX7VLAS3PZAVLUQ
- AWS_ACCESS_KEY_ID=AKIAJF6INZZRJHKQ3KZA
# AWS_SECRET_ACCESS_KEY=...
- secure: "Pixhh0hXDqGCdOyLtGFjli3J2AtDWIpyb2btIrLe956nCBDRutRoMm6rv5DI9sFZN07Mms7VzNNvhc9wCW1y63JAm414d2Co7Ob8kWMZlz9l9t7ACHuktUiis8yr+S4Quq1Vqd6pqi7pf2J++UxC8R/uLeqVrubzr6+X7AbmEFE="
- secure: "iz4GukJUJ9XVTivaTLMXS/5hab7d7C4aQi60Ef+0sw3DnOmntZ+/1SFFC++owccV8h0Ccw21cmmt0IGFHdlhROwq85AgLl3bXMnN/c9MISbaQvCZqRd2qnDxcYf/MF7+s1hqE7f6IxXebSbNI0hEDYHeyPY4g6wTF+yRWsD1qtc6JNLlOV979wxoCeqHL0gwKhH/5RI9lcmM7yohxSTQDS4XcAWDZFsrynocF8eialig5KAu4lqFCJIMTFpZsSLCUvosMVAolvmaiokEsRWwrhTmd/t/8hbm3OmnueNKbKuNpSHN9vDjO0vrLXFz6T4UOIPQSGr88rSHLUeKmpgbHfSfE5DiEGAoQ5aMhgnX1xo83TuvgyGHP3ifwgzXmsis3+HMluGd+6ek4rzHdxNevYbibl6jpHAeldu3borfiYQr9EHCrahMBSa22Z9YTarYStk5uo3kwalTkwMevFP3MlOLB0Q9s0LMLAJIZJ8pLh+2gzmwt2FRCR8S7fgR+9+44PKmtftA4AE3meey/gl1bes5KPPUhomeheVRVplx8PhU6boaAOCCar07s1d17AqEtouHgC3jd5TxMAQFq/MSUbkfOlefwVuDsfZvaOk0LnZbjZuwAN6ba2y8bK3AwhUfOftEAp/9f3RZjz3hjb1QKoZyQVin/XRte2UzgPjLRew="

before_install:
# If we are building a pull request, do the build if $ALLOW_PR == 1
Expand Down Expand Up @@ -262,9 +262,9 @@ deploy:
upload_dir: rustc-builds
acl: public_read
region: us-east-1
access_key_id: AKIAIPQVNYF2T3DTYIWQ
access_key_id: AKIAJN7ZQ3AGSFJQSDFQ
secret_access_key:
secure: "FBqDqOTeIPMu6v/WYPf4CFSlh9rLRZGKVtpLa5KkyuOhXRTrnEzBduEtS8/FMIxdQImvurhSvxWvqRybMOi4qoVfjMqqpHAI7uBbidbrvAcJoHNsx6BgUNVCIoH6a0UsAjTUtm6/YPIpzbHoLZXPL0GrHPMk6Mu04qVSmcYNWn4="
secure: "VDTtsQfBrgMgQ4mwrZqVPlHqnJYnnCJpyaHMwJuuZCzD1nBamw78Sv7zk2PnoTb8aMsvgaRzYeskmaWTXsAnw9saizTKUs2AdAHaTgfPgGCL7040uymc9Zb8fCVaKWw/aBDfgOuLwCfttifOYnGc5IzdagtIb3nIvbvvd8kFVMxOSpQCJJP9k8AvAzvlTMfH1Ol5YwUdeHiw7ABZuzlfF3kJyHSLKu9Tmvlx0LepUKSyvnGM3va3OPiIXuERiXP4ltRpZmujNHMFt3o/sqr2aAYUGHWGJwqOHh/co6eNgNheVllhF2hS+S56O3F9mGSTJejBJzESRhTYGkQvLRgRzpuwVjjGyCleUXXt5MhCclagM7+1lkNmafDuSbYrJJyLwg/izglxwtbxCMF/U85egEsP5zjVVrCSGLhQYO4K3X12MyE+COR5TLNgMd8lWl2/wGoF1TWCqO6pG/BrfWuBPCYnBQ2pfAS/UbQhFB/c4+WzIl37jVtKFTgLWIcOW6iDuaRePS4r5gXBI7jCPp7CkrFPPzhmrxnV55v+kVu3ts9GEC8jJWK7bmReZ5OShneqzXtWVGVhtArwpYx5E/VJtA9izakkSIXo88LVJr/l1ALAJCqngILC2ccgDJ7HAE/8qxcya6lkqlEowCQaHBv8+YiNKckCnBgx7MVK4ky4/f0="
on:
branch: auto
condition: $DEPLOY = 1
Expand All @@ -276,9 +276,9 @@ deploy:
upload_dir: rustc-builds-try
acl: public_read
region: us-east-1
access_key_id: AKIAIPQVNYF2T3DTYIWQ
access_key_id: AKIAJN7ZQ3AGSFJQSDFQ
secret_access_key:
secure: "FBqDqOTeIPMu6v/WYPf4CFSlh9rLRZGKVtpLa5KkyuOhXRTrnEzBduEtS8/FMIxdQImvurhSvxWvqRybMOi4qoVfjMqqpHAI7uBbidbrvAcJoHNsx6BgUNVCIoH6a0UsAjTUtm6/YPIpzbHoLZXPL0GrHPMk6Mu04qVSmcYNWn4="
secure: "VDTtsQfBrgMgQ4mwrZqVPlHqnJYnnCJpyaHMwJuuZCzD1nBamw78Sv7zk2PnoTb8aMsvgaRzYeskmaWTXsAnw9saizTKUs2AdAHaTgfPgGCL7040uymc9Zb8fCVaKWw/aBDfgOuLwCfttifOYnGc5IzdagtIb3nIvbvvd8kFVMxOSpQCJJP9k8AvAzvlTMfH1Ol5YwUdeHiw7ABZuzlfF3kJyHSLKu9Tmvlx0LepUKSyvnGM3va3OPiIXuERiXP4ltRpZmujNHMFt3o/sqr2aAYUGHWGJwqOHh/co6eNgNheVllhF2hS+S56O3F9mGSTJejBJzESRhTYGkQvLRgRzpuwVjjGyCleUXXt5MhCclagM7+1lkNmafDuSbYrJJyLwg/izglxwtbxCMF/U85egEsP5zjVVrCSGLhQYO4K3X12MyE+COR5TLNgMd8lWl2/wGoF1TWCqO6pG/BrfWuBPCYnBQ2pfAS/UbQhFB/c4+WzIl37jVtKFTgLWIcOW6iDuaRePS4r5gXBI7jCPp7CkrFPPzhmrxnV55v+kVu3ts9GEC8jJWK7bmReZ5OShneqzXtWVGVhtArwpYx5E/VJtA9izakkSIXo88LVJr/l1ALAJCqngILC2ccgDJ7HAE/8qxcya6lkqlEowCQaHBv8+YiNKckCnBgx7MVK4ky4/f0="
on:
branch: try
condition: $DEPLOY = 1 && $ALLOW_TRY = 1
Expand All @@ -292,9 +292,9 @@ deploy:
upload_dir: rustc-builds-alt
acl: public_read
region: us-east-1
access_key_id: AKIAIPQVNYF2T3DTYIWQ
access_key_id: AKIAJN7ZQ3AGSFJQSDFQ
secret_access_key:
secure: "FBqDqOTeIPMu6v/WYPf4CFSlh9rLRZGKVtpLa5KkyuOhXRTrnEzBduEtS8/FMIxdQImvurhSvxWvqRybMOi4qoVfjMqqpHAI7uBbidbrvAcJoHNsx6BgUNVCIoH6a0UsAjTUtm6/YPIpzbHoLZXPL0GrHPMk6Mu04qVSmcYNWn4="
secure: "VDTtsQfBrgMgQ4mwrZqVPlHqnJYnnCJpyaHMwJuuZCzD1nBamw78Sv7zk2PnoTb8aMsvgaRzYeskmaWTXsAnw9saizTKUs2AdAHaTgfPgGCL7040uymc9Zb8fCVaKWw/aBDfgOuLwCfttifOYnGc5IzdagtIb3nIvbvvd8kFVMxOSpQCJJP9k8AvAzvlTMfH1Ol5YwUdeHiw7ABZuzlfF3kJyHSLKu9Tmvlx0LepUKSyvnGM3va3OPiIXuERiXP4ltRpZmujNHMFt3o/sqr2aAYUGHWGJwqOHh/co6eNgNheVllhF2hS+S56O3F9mGSTJejBJzESRhTYGkQvLRgRzpuwVjjGyCleUXXt5MhCclagM7+1lkNmafDuSbYrJJyLwg/izglxwtbxCMF/U85egEsP5zjVVrCSGLhQYO4K3X12MyE+COR5TLNgMd8lWl2/wGoF1TWCqO6pG/BrfWuBPCYnBQ2pfAS/UbQhFB/c4+WzIl37jVtKFTgLWIcOW6iDuaRePS4r5gXBI7jCPp7CkrFPPzhmrxnV55v+kVu3ts9GEC8jJWK7bmReZ5OShneqzXtWVGVhtArwpYx5E/VJtA9izakkSIXo88LVJr/l1ALAJCqngILC2ccgDJ7HAE/8qxcya6lkqlEowCQaHBv8+YiNKckCnBgx7MVK4ky4/f0="
on:
branch: auto
condition: $DEPLOY_ALT = 1
12 changes: 6 additions & 6 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
environment:
SCCACHE_BUCKET: rust-lang-ci-sccache
AWS_ACCESS_KEY_ID: AKIAIMX7VLAS3PZAVLUQ
AWS_ACCESS_KEY_ID: AKIAJF6INZZRJHKQ3KZA
AWS_SECRET_ACCESS_KEY:
secure: 1UkmbiDd15tWtYbMm5O2Uqm0b0Ur8v1MoSlydxl4ojcroPeerRMlUges0l57py8c
secure: 55JOuLG3N+q12QH88ZYLfSXV1ocEi6At1leBKHwRsESgQ4mWCNse49J/x+9WUJFP
SCCACHE_DIGEST: f808afabb4a4eb1d7112bcb3fa6be03b61e93412890c88e177c667eb37f46353d7ec294e559b16f9f4b5e894f2185fe7670a0df15fd064889ecbd80f0c34166c

# By default schannel checks revocation of certificates unlike some other SSL
Expand Down Expand Up @@ -185,9 +185,9 @@ before_deploy:
deploy:
- provider: S3
skip_cleanup: true
access_key_id: AKIAIPQVNYF2T3DTYIWQ
access_key_id: AKIAJN7ZQ3AGSFJQSDFQ
secret_access_key:
secure: +11jsUNFTQ9dq5Ad1i2+PeUJaXluFJ0zIJAXESE1dFT3Kdjku4/eDdgyjgsB6GnV
secure: rEWqEEumXgn/lvc+2vhUjUHXQYU2p7ayT0BVtzsb2oX1cUpmn5TiQOK+v2yQsQzm
bucket: rust-lang-ci
set_public: true
region: us-east-1
Expand All @@ -202,9 +202,9 @@ deploy:
# different upload directory and a slightly different trigger
- provider: S3
skip_cleanup: true
access_key_id: AKIAIPQVNYF2T3DTYIWQ
access_key_id: AKIAJN7ZQ3AGSFJQSDFQ
secret_access_key:
secure: +11jsUNFTQ9dq5Ad1i2+PeUJaXluFJ0zIJAXESE1dFT3Kdjku4/eDdgyjgsB6GnV
secure: rEWqEEumXgn/lvc+2vhUjUHXQYU2p7ayT0BVtzsb2oX1cUpmn5TiQOK+v2yQsQzm
bucket: rust-lang-ci
set_public: true
region: us-east-1
Expand Down
7 changes: 4 additions & 3 deletions src/bootstrap/native.rs
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,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
Expand All @@ -387,9 +387,10 @@ 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"));
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");
Expand Down
10 changes: 10 additions & 0 deletions src/liballoc/string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions src/liballoc_system/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion src/libcompiler_builtins
13 changes: 3 additions & 10 deletions src/libcore/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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!()))
});
}

Expand Down
1 change: 0 additions & 1 deletion src/librustc_mir/transform/elaborate_drops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ use syntax::ast;
use syntax_pos::Span;

use std::fmt;
use std::u32;

pub struct ElaborateDrops;

Expand Down
16 changes: 8 additions & 8 deletions src/librustc_trans/mir/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
};
Expand Down
7 changes: 5 additions & 2 deletions src/librustc_typeck/check/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1554,9 +1554,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");
}
}

Expand Down
112 changes: 29 additions & 83 deletions src/librustdoc/html/render.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
Expand Down Expand Up @@ -660,9 +668,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 {
Expand Down Expand Up @@ -1756,18 +1768,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::<Vec<_>>();
_ => true,
}
});

if !differences.is_empty() {
scx.markdown_warnings.borrow_mut().push((span, md_text.to_owned(), differences));
Expand All @@ -1781,40 +1793,6 @@ fn render_markdown(w: &mut fmt::Formatter,
write!(w, "<div class='docblock'>{}{}</div>", 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() {
Expand Down Expand Up @@ -3791,35 +3769,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"));
}
2 changes: 1 addition & 1 deletion src/libstd/ffi/c_str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()) }
}
}
Expand Down
18 changes: 3 additions & 15 deletions src/libstd/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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!()))
});
}

Expand Down
Loading