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 12 pull requests #47870

Merged
merged 38 commits into from
Jan 30, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
c2e2612
Punctuation and clarity fixes.
jimmantooth Jan 17, 2018
c4befe1
Run rustfmt and add comments
mark-i-m Jan 19, 2018
49431d4
Add a bunch of doc comments
mark-i-m Jan 19, 2018
ca0c080
Fix typos
mark-i-m Jan 21, 2018
831ff77
implement Send for process::Command on unix
little-dude Jan 25, 2018
9e6ed17
make Command.argv Send on unix platforms
little-dude Jan 26, 2018
0ac4659
Add line numbers and columns to error messages spanning multiple files
varkor Jan 26, 2018
077d343
add test checking that process::Command is Send
little-dude Jan 26, 2018
aa6cc6e
Fix test in macro_backtrace
varkor Jan 26, 2018
ac0c16d
Run rustfmt on /libsyntax/ext/tt/macro_parser.rs
mark-i-m Jan 20, 2018
0d7f193
Added a bunch of comments to macro_parser.rs
mark-i-m Jan 20, 2018
6d4ed65
Added lots of comments + minor reorganization
mark-i-m Jan 25, 2018
b01b481
Added/improved comments
mark-i-m Jan 25, 2018
02d1d92
Still more comments
mark-i-m Jan 25, 2018
e2d558a
A few more comments
mark-i-m Jan 25, 2018
a21b7b3
Improve formatting of else block
varkor Jan 27, 2018
2497d10
Whitelist aes x86 feature flag
gnzlbg Jan 28, 2018
b32dbbc
Whitelist v7 feature for ARM and AARCH64.
gnzlbg Jan 28, 2018
7b4cbbd
Document that `Index` ops can panic on `HashMap` & `BTreeMap`.
frewsxcv Jan 29, 2018
e09a8bd
Add per-stage RUSTFLAGS: RUSTFLAGS_STAGE_{0,1,2} and RUSTFLAGS_STAGE_…
Mark-Simulacrum Jan 29, 2018
8389b66
Increase test coverage of use_nested_groups
pietroalbini Jan 29, 2018
898fdcc
Make run-pass/env-home-dir.rs test more robust
malbarbo Jan 24, 2018
adeb0ae
move comment right onto the line in question
nikomatsakis Jan 29, 2018
ae98f4c
rustdoc: Fix link title rendering with hoedown
ollie27 Jan 29, 2018
2184400
Update comment
mark-i-m Jan 29, 2018
5762942
fix typos
mark-i-m Jan 29, 2018
19aac09
Rollup merge of #47515 - jimmantooth:patch-1, r=QuietMisdreavus
kennytm Jan 30, 2018
3e39180
Rollup merge of #47603 - mark-i-m:markim_comments_0000, r=jseyfried
kennytm Jan 30, 2018
fccc85a
Rollup merge of #47718 - malbarbo:env-home-dir, r=nikomatsakis
kennytm Jan 30, 2018
f06a391
Rollup merge of #47732 - mark-i-m:markim_comments_0001, r=jseyfried
kennytm Jan 30, 2018
4dbfc8d
Rollup merge of #47760 - little-dude:master, r=alexcrichton
kennytm Jan 30, 2018
44b9641
Rollup merge of #47780 - varkor:cross-file-errors-line-col, r=estebank
kennytm Jan 30, 2018
003254e
Rollup merge of #47822 - gnzlbg:patch-1, r=alexcrichton
kennytm Jan 30, 2018
16d3fdb
Rollup merge of #47826 - gnzlbg:patch-2, r=alexcrichton
kennytm Jan 30, 2018
e8868bd
Rollup merge of #47836 - Mark-Simulacrum:stage-flags, r=alexcrichton
kennytm Jan 30, 2018
95572df
Rollup merge of #47839 - frewsxcv:frewsxcv-map-index, r=QuietMisdreavus
kennytm Jan 30, 2018
b83fb0f
Rollup merge of #47853 - rust-lang:increase-nested-groups-test-covera…
kennytm Jan 30, 2018
393a199
Rollup merge of #47855 - ollie27:rustdoc_hoedown_link_title, r=QuietM…
kennytm Jan 30, 2018
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
12 changes: 12 additions & 0 deletions src/bootstrap/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,18 @@ impl<'a> Builder<'a> {
stage = compiler.stage;
}

let mut extra_args = env::var(&format!("RUSTFLAGS_STAGE_{}", stage)).unwrap_or_default();
if stage != 0 {
let s = env::var("RUSTFLAGS_STAGE_NOT_0").unwrap_or_default();
extra_args.push_str(" ");
extra_args.push_str(&s);
}

if !extra_args.is_empty() {
cargo.env("RUSTFLAGS",
format!("{} {}", env::var("RUSTFLAGS").unwrap_or_default(), extra_args));
}

// Customize the compiler we're running. Specify the compiler to cargo
// as our shim and then pass it some various options used to configure
// how the actual compiler itself is called.
Expand Down
6 changes: 3 additions & 3 deletions src/doc/unstable-book/src/language-features/generators.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,11 +139,11 @@ closure-like semantics. Namely:
types and such.

* Traits like `Send` and `Sync` are automatically implemented for a `Generator`
depending on the captured variables of the environment. Unlike closures though
depending on the captured variables of the environment. Unlike closures,
generators also depend on variables live across suspension points. This means
that although the ambient environment may be `Send` or `Sync`, the generator
itself may not be due to internal variables live across `yield` points being
not-`Send` or not-`Sync`. Note, though, that generators, like closures, do
not-`Send` or not-`Sync`. Note that generators, like closures, do
not implement traits like `Copy` or `Clone` automatically.

* Whenever a generator is dropped it will drop all captured environment
Expand All @@ -155,7 +155,7 @@ lifted at a future date, the design is ongoing!

### Generators as state machines

In the compiler generators are currently compiled as state machines. Each
In the compiler, generators are currently compiled as state machines. Each
`yield` expression will correspond to a different state that stores all live
variables over that suspension point. Resumption of a generator will dispatch on
the current state and then execute internally until a `yield` is reached, at
Expand Down
5 changes: 5 additions & 0 deletions src/liballoc/btree/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1748,6 +1748,11 @@ impl<'a, K: Ord, Q: ?Sized, V> Index<&'a Q> for BTreeMap<K, V>
{
type Output = V;

/// Returns a reference to the value corresponding to the supplied key.
///
/// # Panics
///
/// Panics if the key is not present in the `BTreeMap`.
#[inline]
fn index(&self, key: &Q) -> &V {
self.get(key).expect("no entry found for key")
Expand Down
15 changes: 14 additions & 1 deletion src/librustc_errors/emitter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1014,8 +1014,21 @@ impl EmitterWriter {

// Then, the secondary file indicator
buffer.prepend(buffer_msg_line_offset + 1, "::: ", Style::LineNumber);
let loc = if let Some(first_line) = annotated_file.lines.first() {
let col = if let Some(first_annotation) = first_line.annotations.first() {
format!(":{}", first_annotation.start_col + 1)
} else {
"".to_string()
};
format!("{}:{}{}",
annotated_file.file.name,
cm.doctest_offset_line(first_line.line_index),
col)
} else {
annotated_file.file.name.to_string()
};
buffer.append(buffer_msg_line_offset + 1,
&annotated_file.file.name.to_string(),
&loc,
Style::LineAndColumn);
for _ in 0..max_line_num_len {
buffer.prepend(buffer_msg_line_offset + 1, " ", Style::NoStyle);
Expand Down
3 changes: 2 additions & 1 deletion src/librustc_errors/snippet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ pub struct FileInfo {

/// The "primary file", if any, gets a `-->` marker instead of
/// `>>>`, and has a line-number/column printed and not just a
/// filename. It appears first in the listing. It is known to
/// filename (other files are not guaranteed to have line numbers
/// or columns). It appears first in the listing. It is known to
/// contain at least one primary span, though primary spans (which
/// are designated with `^^^`) may also occur in other files.
primary_span: Option<Span>,
Expand Down
6 changes: 3 additions & 3 deletions src/librustc_trans/llvm_util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,16 +79,16 @@ unsafe fn configure_llvm(sess: &Session) {
// detection code will walk past the end of the feature array,
// leading to crashes.

const ARM_WHITELIST: &'static [&'static str] = &["neon\0", "vfp2\0", "vfp3\0", "vfp4\0"];
const ARM_WHITELIST: &'static [&'static str] = &["neon\0", "v7\0", "vfp2\0", "vfp3\0", "vfp4\0"];

const AARCH64_WHITELIST: &'static [&'static str] = &["neon\0"];
const AARCH64_WHITELIST: &'static [&'static str] = &["neon\0", "v7\0"];

const X86_WHITELIST: &'static [&'static str] = &["avx\0", "avx2\0", "bmi\0", "bmi2\0", "sse\0",
"sse2\0", "sse3\0", "sse4.1\0", "sse4.2\0",
"ssse3\0", "tbm\0", "lzcnt\0", "popcnt\0",
"sse4a\0", "rdrnd\0", "rdseed\0", "fma\0",
"xsave\0", "xsaveopt\0", "xsavec\0",
"xsaves\0",
"xsaves\0", "aes\0",
"avx512bw\0", "avx512cd\0",
"avx512dq\0", "avx512er\0",
"avx512f\0", "avx512ifma\0",
Expand Down
2 changes: 1 addition & 1 deletion src/librustdoc/html/markdown.rs
Original file line number Diff line number Diff line change
Expand Up @@ -872,7 +872,7 @@ pub fn render(w: &mut fmt::Formatter,
let link_out = format!("<a href=\"{link}\"{title}>{content}</a>",
link = link_buf,
title = title.map_or(String::new(),
|t| format!(" title=\"{}\"", t)),
|t| format!(" title=\"{}\"", Escape(&t))),
content = content.unwrap_or(String::new()));

unsafe { hoedown_buffer_put(ob, link_out.as_ptr(), link_out.len()); }
Expand Down
9 changes: 7 additions & 2 deletions src/libstd/collections/hash/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1384,9 +1384,14 @@ impl<'a, K, Q: ?Sized, V, S> Index<&'a Q> for HashMap<K, V, S>
{
type Output = V;

/// Returns a reference to the value corresponding to the supplied key.
///
/// # Panics
///
/// Panics if the key is not present in the `HashMap`.
#[inline]
fn index(&self, index: &Q) -> &V {
self.get(index).expect("no entry found for key")
fn index(&self, key: &Q) -> &V {
self.get(key).expect("no entry found for key")
}
}

Expand Down
6 changes: 6 additions & 0 deletions src/libstd/process.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1843,4 +1843,10 @@ mod tests {
}
assert!(events > 0);
}

#[test]
fn test_command_implements_send() {
fn take_send_type<T: Send>(_: T) {}
take_send_type(Command::new(""))
}
}
16 changes: 11 additions & 5 deletions src/libstd/sys/unix/process/process_common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ pub struct Command {
// other keys.
program: CString,
args: Vec<CString>,
argv: Vec<*const c_char>,
argv: Argv,
env: CommandEnv<DefaultEnvKey>,

cwd: Option<CString>,
Expand All @@ -58,6 +58,12 @@ pub struct Command {
stderr: Option<Stdio>,
}

// Create a new type for argv, so that we can make it `Send`
struct Argv(Vec<*const c_char>);

// It is safe to make Argv Send, because it contains pointers to memory owned by `Command.args`
unsafe impl Send for Argv {}

// passed back to std::process with the pipes connected to the child, if any
// were requested
pub struct StdioPipes {
Expand Down Expand Up @@ -92,7 +98,7 @@ impl Command {
let mut saw_nul = false;
let program = os2c(program, &mut saw_nul);
Command {
argv: vec![program.as_ptr(), ptr::null()],
argv: Argv(vec![program.as_ptr(), ptr::null()]),
program,
args: Vec::new(),
env: Default::default(),
Expand All @@ -111,8 +117,8 @@ impl Command {
// Overwrite the trailing NULL pointer in `argv` and then add a new null
// pointer.
let arg = os2c(arg, &mut self.saw_nul);
self.argv[self.args.len() + 1] = arg.as_ptr();
self.argv.push(ptr::null());
self.argv.0[self.args.len() + 1] = arg.as_ptr();
self.argv.0.push(ptr::null());

// Also make sure we keep track of the owned value to schedule a
// destructor for this memory.
Expand All @@ -133,7 +139,7 @@ impl Command {
self.saw_nul
}
pub fn get_argv(&self) -> &Vec<*const c_char> {
&self.argv
&self.argv.0
}

#[allow(dead_code)]
Expand Down
Loading