Skip to content

Commit

Permalink
Auto merge of rust-lang#48445 - Mark-Simulacrum:stable-next, r=alexcr…
Browse files Browse the repository at this point in the history
…ichton

[stable] 1.24.1 stable release

The includes the following commits:
 - 6a600f8: Fixes rust-lang#48251, unwinding through FFI no longer aborts
 - cuviper@b445a52: Fixes rust-lang#48308, fixing the error index generator
 - f8e00d0: Fixes rust-lang#48318 by emitting UTF-16 output on MSVC targets.
 - 2a0af8c448: Bumps the version number to 1.24.1.
 - 93220f0f45: Release notes
 - 6031718d8836f95bbfeddfaa63f1ee1d66e53f26: Cargo TLS warnings on Windows.
  • Loading branch information
bors committed Feb 27, 2018
2 parents 4d90ac3 + 9853d20 commit d3ae9a9
Show file tree
Hide file tree
Showing 13 changed files with 86 additions and 22 deletions.
13 changes: 13 additions & 0 deletions RELEASES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
Version 1.24.1 (2018-03-01)
==========================

- [Do not abort when unwinding through FFI][48251]
- [Emit UTF-16 files for linker arguments on Windows][48318]
- [Make the error index generator work again][48308]
- [Cargo will warn on Windows 7 if an update is needed][cargo/5069].

[48251]: https://github.com/rust-lang/rust/issues/48251
[48308]: https://github.com/rust-lang/rust/issues/48308
[48318]: https://github.com/rust-lang/rust/issues/48318
[cargo/5069]: https://github.com/rust-lang/cargo/pull/5069

Version 1.24.0 (2018-02-15)
==========================

Expand Down
4 changes: 2 additions & 2 deletions src/bootstrap/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -484,8 +484,8 @@ impl<'a> Builder<'a> {
} else {
PathBuf::from("/path/to/nowhere/rustdoc/not/required")
})
.env("TEST_MIRI", self.config.test_miri.to_string());

.env("TEST_MIRI", self.config.test_miri.to_string())
.env("RUSTC_ERROR_METADATA_DST", self.extended_error_dir());
if let Some(n) = self.config.rust_codegen_units {
cargo.env("RUSTC_CODEGEN_UNITS", n.to_string());
}
Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/channel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ use Build;
use config::Config;

// The version number
pub const CFG_RELEASE_NUM: &str = "1.24.0";
pub const CFG_RELEASE_NUM: &str = "1.24.1";

pub struct GitInfo {
inner: Option<Info>,
Expand Down
3 changes: 2 additions & 1 deletion src/bootstrap/check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -980,7 +980,8 @@ impl Step for ErrorIndex {
build.run(builder.tool_cmd(Tool::ErrorIndex)
.arg("markdown")
.arg(&output)
.env("CFG_BUILD", &build.build));
.env("CFG_BUILD", &build.build)
.env("RUSTC_ERROR_METADATA_DST", build.extended_error_dir()));

markdown_test(builder, compiler, &output);
}
Expand Down
3 changes: 2 additions & 1 deletion src/bootstrap/doc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,8 @@ impl Step for ErrorIndex {
index.arg(out.join("error-index.html"));

// FIXME: shouldn't have to pass this env var
index.env("CFG_BUILD", &build.build);
index.env("CFG_BUILD", &build.build)
.env("RUSTC_ERROR_METADATA_DST", build.extended_error_dir());

build.run(&mut index);
}
Expand Down
5 changes: 5 additions & 0 deletions src/bootstrap/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -721,6 +721,11 @@ impl Build {
self.config.python.as_ref().unwrap()
}

/// Temporary directory that extended error information is emitted to.
fn extended_error_dir(&self) -> PathBuf {
self.out.join("tmp/extended-error-metadata")
}

/// Tests whether the `compiler` compiling for `target` should be forced to
/// use a stage1 compiler instead.
///
Expand Down
4 changes: 3 additions & 1 deletion src/librustc_mir/build/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,9 @@ fn should_abort_on_panic<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'tcx>,
// unwind anyway. Don't stop them.
if tcx.has_attr(tcx.hir.local_def_id(fn_id), "unwind") { return false; }

return true;
// FIXME(rust-lang/rust#48251) -- Had to disable abort-on-panic
// for backwards compatibility reasons.
false
}

///////////////////////////////////////////////////////////////////////////
Expand Down
14 changes: 13 additions & 1 deletion src/librustc_trans/back/link.rs
Original file line number Diff line number Diff line change
Expand Up @@ -776,7 +776,19 @@ fn exec_linker(sess: &Session, cmd: &mut Command, tmpdir: &Path)
args.push_str("\n");
}
let file = tmpdir.join("linker-arguments");
fs::write(&file, args.as_bytes())?;
let bytes = if sess.target.target.options.is_like_msvc {
let mut out = vec![];
// start the stream with a UTF-16 BOM
for c in vec![0xFEFF].into_iter().chain(args.encode_utf16()) {
// encode in little endian
out.push(c as u8);
out.push((c >> 8) as u8);
}
out
} else {
args.into_bytes()
};
fs::write(&file, &bytes)?;
cmd2.arg(format!("@{}", file.display()));
return cmd2.output();

Expand Down
11 changes: 6 additions & 5 deletions src/libsyntax/diagnostics/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,17 @@
//! currently always a crate name.
use std::collections::BTreeMap;
use std::path::PathBuf;
use std::env;
use std::fs::{remove_file, create_dir_all, File};
use std::io::Write;
use std::path::PathBuf;
use std::error::Error;
use rustc_serialize::json::as_json;

use syntax_pos::{Span, FileName};
use ext::base::ExtCtxt;
use diagnostics::plugin::{ErrorMap, ErrorInfo};

// Default metadata directory to use for extended error JSON.
const ERROR_METADATA_PREFIX: &'static str = "tmp/extended-errors";

/// JSON encodable/decodable version of `ErrorInfo`.
#[derive(PartialEq, RustcDecodable, RustcEncodable)]
pub struct ErrorMetadata {
Expand Down Expand Up @@ -59,7 +57,10 @@ impl ErrorLocation {
///
/// See `output_metadata`.
pub fn get_metadata_dir(prefix: &str) -> PathBuf {
PathBuf::from(ERROR_METADATA_PREFIX).join(prefix)
env::var_os("RUSTC_ERROR_METADATA_DST")
.map(PathBuf::from)
.expect("env var `RUSTC_ERROR_METADATA_DST` isn't set")
.join(prefix)
}

/// Map `name` to a path in the given directory: <directory>/<name>.json
Expand Down
25 changes: 20 additions & 5 deletions src/test/run-make/long-linker-command-lines-cmd-exe/foo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,11 @@ fn main() {
let ok = tmpdir.join("ok");
let not_ok = tmpdir.join("not_ok");
if env::var("YOU_ARE_A_LINKER").is_ok() {
match env::args().find(|a| a.contains("@")) {
Some(file) => { fs::copy(&file[1..], &ok).unwrap(); }
match env::args_os().find(|a| a.to_string_lossy().contains("@")) {
Some(file) => {
let file = file.to_str().unwrap();
fs::copy(&file[1..], &ok).unwrap();
}
None => { File::create(&not_ok).unwrap(); }
}
return
Expand Down Expand Up @@ -84,11 +87,23 @@ fn main() {
continue
}

let mut contents = String::new();
File::open(&ok).unwrap().read_to_string(&mut contents).unwrap();
let mut contents = Vec::new();
File::open(&ok).unwrap().read_to_end(&mut contents).unwrap();

for j in 0..i {
assert!(contents.contains(&format!("{}{}", lib_name, j)));
let exp = format!("{}{}", lib_name, j);
let exp = if cfg!(target_env = "msvc") {
let mut out = Vec::with_capacity(exp.len() * 2);
for c in exp.encode_utf16() {
// encode in little endian
out.push(c as u8);
out.push((c >> 8) as u8);
}
out
} else {
exp.into_bytes()
};
assert!(contents.windows(exp.len()).any(|w| w == &exp[..]));
}

break
Expand Down
21 changes: 17 additions & 4 deletions src/test/run-make/long-linker-command-lines/foo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ fn main() {
let tmpdir = PathBuf::from(env::var_os("TMPDIR").unwrap());
let ok = tmpdir.join("ok");
if env::var("YOU_ARE_A_LINKER").is_ok() {
if let Some(file) = env::args().find(|a| a.contains("@")) {
if let Some(file) = env::args_os().find(|a| a.to_string_lossy().contains("@")) {
let file = file.to_str().expect("non-utf8 file argument");
fs::copy(&file[1..], &ok).unwrap();
}
return
Expand Down Expand Up @@ -76,11 +77,23 @@ fn main() {
continue
}

let mut contents = String::new();
File::open(&ok).unwrap().read_to_string(&mut contents).unwrap();
let mut contents = Vec::new();
File::open(&ok).unwrap().read_to_end(&mut contents).unwrap();

for j in 0..i {
assert!(contents.contains(&format!("{}{}", lib_name, j)));
let exp = format!("{}{}", lib_name, j);
let exp = if cfg!(target_env = "msvc") {
let mut out = Vec::with_capacity(exp.len() * 2);
for c in exp.encode_utf16() {
// encode in little endian
out.push(c as u8);
out.push((c >> 8) as u8);
}
out
} else {
exp.into_bytes()
};
assert!(contents.windows(exp.len()).any(|w| w == &exp[..]));
}

break
Expand Down
1 change: 1 addition & 0 deletions src/test/run-pass/abort-on-c-abi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
// we never unwind through them.

// ignore-emscripten no processes
// ignore-test FIXME rust-lang/rust#48251 -- temporarily disabled

use std::{env, panic};
use std::io::prelude::*;
Expand Down
2 changes: 1 addition & 1 deletion src/tools/cargo

0 comments on commit d3ae9a9

Please sign in to comment.