Skip to content

Commit def3269

Browse files
committedJan 30, 2018
Auto merge of #47870 - kennytm:rollup, r=kennytm
Rollup of 12 pull requests - Successful merges: #47515, #47603, #47718, #47732, #47760, #47780, #47822, #47826, #47836, #47839, #47853, #47855 - Failed merges:
2 parents fe7e1a4 + 393a199 commit def3269

File tree

22 files changed

+706
-188
lines changed

22 files changed

+706
-188
lines changed
 

‎src/bootstrap/builder.rs

+12
Original file line numberDiff line numberDiff line change
@@ -469,6 +469,18 @@ impl<'a> Builder<'a> {
469469
stage = compiler.stage;
470470
}
471471

472+
let mut extra_args = env::var(&format!("RUSTFLAGS_STAGE_{}", stage)).unwrap_or_default();
473+
if stage != 0 {
474+
let s = env::var("RUSTFLAGS_STAGE_NOT_0").unwrap_or_default();
475+
extra_args.push_str(" ");
476+
extra_args.push_str(&s);
477+
}
478+
479+
if !extra_args.is_empty() {
480+
cargo.env("RUSTFLAGS",
481+
format!("{} {}", env::var("RUSTFLAGS").unwrap_or_default(), extra_args));
482+
}
483+
472484
// Customize the compiler we're running. Specify the compiler to cargo
473485
// as our shim and then pass it some various options used to configure
474486
// how the actual compiler itself is called.

‎src/doc/unstable-book/src/language-features/generators.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -139,11 +139,11 @@ closure-like semantics. Namely:
139139
types and such.
140140

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

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

156156
### Generators as state machines
157157

158-
In the compiler generators are currently compiled as state machines. Each
158+
In the compiler, generators are currently compiled as state machines. Each
159159
`yield` expression will correspond to a different state that stores all live
160160
variables over that suspension point. Resumption of a generator will dispatch on
161161
the current state and then execute internally until a `yield` is reached, at

‎src/liballoc/btree/map.rs

+5
Original file line numberDiff line numberDiff line change
@@ -1748,6 +1748,11 @@ impl<'a, K: Ord, Q: ?Sized, V> Index<&'a Q> for BTreeMap<K, V>
17481748
{
17491749
type Output = V;
17501750

1751+
/// Returns a reference to the value corresponding to the supplied key.
1752+
///
1753+
/// # Panics
1754+
///
1755+
/// Panics if the key is not present in the `BTreeMap`.
17511756
#[inline]
17521757
fn index(&self, key: &Q) -> &V {
17531758
self.get(key).expect("no entry found for key")

‎src/librustc_errors/emitter.rs

+14-1
Original file line numberDiff line numberDiff line change
@@ -1014,8 +1014,21 @@ impl EmitterWriter {
10141014

10151015
// Then, the secondary file indicator
10161016
buffer.prepend(buffer_msg_line_offset + 1, "::: ", Style::LineNumber);
1017+
let loc = if let Some(first_line) = annotated_file.lines.first() {
1018+
let col = if let Some(first_annotation) = first_line.annotations.first() {
1019+
format!(":{}", first_annotation.start_col + 1)
1020+
} else {
1021+
"".to_string()
1022+
};
1023+
format!("{}:{}{}",
1024+
annotated_file.file.name,
1025+
cm.doctest_offset_line(first_line.line_index),
1026+
col)
1027+
} else {
1028+
annotated_file.file.name.to_string()
1029+
};
10171030
buffer.append(buffer_msg_line_offset + 1,
1018-
&annotated_file.file.name.to_string(),
1031+
&loc,
10191032
Style::LineAndColumn);
10201033
for _ in 0..max_line_num_len {
10211034
buffer.prepend(buffer_msg_line_offset + 1, " ", Style::NoStyle);

‎src/librustc_errors/snippet.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ pub struct FileInfo {
2727

2828
/// The "primary file", if any, gets a `-->` marker instead of
2929
/// `>>>`, and has a line-number/column printed and not just a
30-
/// filename. It appears first in the listing. It is known to
30+
/// filename (other files are not guaranteed to have line numbers
31+
/// or columns). It appears first in the listing. It is known to
3132
/// contain at least one primary span, though primary spans (which
3233
/// are designated with `^^^`) may also occur in other files.
3334
primary_span: Option<Span>,

‎src/librustc_trans/llvm_util.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -79,16 +79,16 @@ unsafe fn configure_llvm(sess: &Session) {
7979
// detection code will walk past the end of the feature array,
8080
// leading to crashes.
8181

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

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

8686
const X86_WHITELIST: &'static [&'static str] = &["avx\0", "avx2\0", "bmi\0", "bmi2\0", "sse\0",
8787
"sse2\0", "sse3\0", "sse4.1\0", "sse4.2\0",
8888
"ssse3\0", "tbm\0", "lzcnt\0", "popcnt\0",
8989
"sse4a\0", "rdrnd\0", "rdseed\0", "fma\0",
9090
"xsave\0", "xsaveopt\0", "xsavec\0",
91-
"xsaves\0",
91+
"xsaves\0", "aes\0",
9292
"avx512bw\0", "avx512cd\0",
9393
"avx512dq\0", "avx512er\0",
9494
"avx512f\0", "avx512ifma\0",

‎src/librustdoc/html/markdown.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -872,7 +872,7 @@ pub fn render(w: &mut fmt::Formatter,
872872
let link_out = format!("<a href=\"{link}\"{title}>{content}</a>",
873873
link = link_buf,
874874
title = title.map_or(String::new(),
875-
|t| format!(" title=\"{}\"", t)),
875+
|t| format!(" title=\"{}\"", Escape(&t))),
876876
content = content.unwrap_or(String::new()));
877877

878878
unsafe { hoedown_buffer_put(ob, link_out.as_ptr(), link_out.len()); }

‎src/libstd/collections/hash/map.rs

+7-2
Original file line numberDiff line numberDiff line change
@@ -1384,9 +1384,14 @@ impl<'a, K, Q: ?Sized, V, S> Index<&'a Q> for HashMap<K, V, S>
13841384
{
13851385
type Output = V;
13861386

1387+
/// Returns a reference to the value corresponding to the supplied key.
1388+
///
1389+
/// # Panics
1390+
///
1391+
/// Panics if the key is not present in the `HashMap`.
13871392
#[inline]
1388-
fn index(&self, index: &Q) -> &V {
1389-
self.get(index).expect("no entry found for key")
1393+
fn index(&self, key: &Q) -> &V {
1394+
self.get(key).expect("no entry found for key")
13901395
}
13911396
}
13921397

‎src/libstd/process.rs

+6
Original file line numberDiff line numberDiff line change
@@ -1843,4 +1843,10 @@ mod tests {
18431843
}
18441844
assert!(events > 0);
18451845
}
1846+
1847+
#[test]
1848+
fn test_command_implements_send() {
1849+
fn take_send_type<T: Send>(_: T) {}
1850+
take_send_type(Command::new(""))
1851+
}
18461852
}

‎src/libstd/sys/unix/process/process_common.rs

+11-5
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ pub struct Command {
4545
// other keys.
4646
program: CString,
4747
args: Vec<CString>,
48-
argv: Vec<*const c_char>,
48+
argv: Argv,
4949
env: CommandEnv<DefaultEnvKey>,
5050

5151
cwd: Option<CString>,
@@ -58,6 +58,12 @@ pub struct Command {
5858
stderr: Option<Stdio>,
5959
}
6060

61+
// Create a new type for argv, so that we can make it `Send`
62+
struct Argv(Vec<*const c_char>);
63+
64+
// It is safe to make Argv Send, because it contains pointers to memory owned by `Command.args`
65+
unsafe impl Send for Argv {}
66+
6167
// passed back to std::process with the pipes connected to the child, if any
6268
// were requested
6369
pub struct StdioPipes {
@@ -92,7 +98,7 @@ impl Command {
9298
let mut saw_nul = false;
9399
let program = os2c(program, &mut saw_nul);
94100
Command {
95-
argv: vec![program.as_ptr(), ptr::null()],
101+
argv: Argv(vec![program.as_ptr(), ptr::null()]),
96102
program,
97103
args: Vec::new(),
98104
env: Default::default(),
@@ -111,8 +117,8 @@ impl Command {
111117
// Overwrite the trailing NULL pointer in `argv` and then add a new null
112118
// pointer.
113119
let arg = os2c(arg, &mut self.saw_nul);
114-
self.argv[self.args.len() + 1] = arg.as_ptr();
115-
self.argv.push(ptr::null());
120+
self.argv.0[self.args.len() + 1] = arg.as_ptr();
121+
self.argv.0.push(ptr::null());
116122

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

139145
#[allow(dead_code)]

‎src/libsyntax/ext/tt/macro_parser.rs

+351-126
Large diffs are not rendered by default.

‎src/libsyntax/ext/tt/quoted.rs

+173-39
Large diffs are not rendered by default.

‎src/test/run-pass/env-home-dir.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,10 @@ fn main() {
2727
if cfg!(target_os = "android") {
2828
assert!(home_dir().is_none());
2929
} else {
30-
assert!(home_dir().is_some());
30+
// When HOME is not set, some platforms return `None`,
31+
// but others return `Some` with a default.
32+
// Just check that it is not "/home/MountainView".
33+
assert_ne!(home_dir(), Some(PathBuf::from("/home/MountainView")));
3134
}
3235
}
3336

‎src/test/run-pass/use-nested-groups.rs

+7
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,19 @@ mod a {
2424
}
2525
}
2626

27+
// Test every possible part of the syntax
2728
use a::{B, d::{self, *, g::H}};
2829

30+
// Test a more common use case
31+
use std::sync::{Arc, atomic::{AtomicBool, Ordering}};
32+
2933
fn main() {
3034
let _: B;
3135
let _: E;
3236
let _: F;
3337
let _: H;
3438
let _: d::g::I;
39+
40+
let _: Arc<AtomicBool>;
41+
let _: Ordering;
3542
}

‎src/test/rustdoc/link-title-escape.rs

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
// compile-flags: -Z unstable-options --disable-commonmark
12+
13+
#![crate_name = "foo"]
14+
15+
//! hello [foo]
16+
//!
17+
//! [foo]: url 'title & <stuff> & "things"'
18+
19+
// @has 'foo/index.html' 'title &amp; &lt;stuff&gt; &amp; &quot;things&quot;'

‎src/test/ui/cross-file-errors/main.rs

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
#[macro_use]
12+
mod underscore;
13+
14+
fn main() {
15+
underscore!();
16+
}
+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
error: expected expression, found `_`
2+
--> $DIR/underscore.rs:18:9
3+
|
4+
18 | _
5+
| ^
6+
|
7+
::: $DIR/main.rs:15:5
8+
|
9+
15 | underscore!();
10+
| -------------- in this macro invocation
11+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
// We want this file only so we can test cross-file error
12+
// messages, but we don't want it in an external crate.
13+
// ignore-test
14+
#![crate_type = "lib"]
15+
16+
macro_rules! underscore {
17+
() => (
18+
_
19+
)
20+
}

‎src/test/ui/macro_backtrace/main.stderr

+5-5
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found
2222
27 | ping!();
2323
| -------- in this macro invocation
2424
|
25-
::: <ping macros>
25+
::: <ping macros>:1:1
2626
|
2727
1 | ( ) => { pong ! ( ) ; }
2828
| -------------------------
@@ -42,31 +42,31 @@ error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found
4242
28 | deep!();
4343
| -------- in this macro invocation (#1)
4444
|
45-
::: <deep macros>
45+
::: <deep macros>:1:1
4646
|
4747
1 | ( ) => { foo ! ( ) ; }
4848
| ------------------------
4949
| | |
5050
| | in this macro invocation (#2)
5151
| in this expansion of `deep!` (#1)
5252
|
53-
::: <foo macros>
53+
::: <foo macros>:1:1
5454
|
5555
1 | ( ) => { bar ! ( ) ; }
5656
| ------------------------
5757
| | |
5858
| | in this macro invocation (#3)
5959
| in this expansion of `foo!` (#2)
6060
|
61-
::: <bar macros>
61+
::: <bar macros>:1:1
6262
|
6363
1 | ( ) => { ping ! ( ) ; }
6464
| -------------------------
6565
| | |
6666
| | in this macro invocation (#4)
6767
| in this expansion of `bar!` (#3)
6868
|
69-
::: <ping macros>
69+
::: <ping macros>:1:1
7070
|
7171
1 | ( ) => { pong ! ( ) ; }
7272
| -------------------------
+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
#![feature(use_nested_groups)]
12+
13+
mod a {
14+
pub mod b1 {
15+
pub enum C2 {}
16+
}
17+
18+
pub enum B2 {}
19+
}
20+
21+
use a::{b1::{C1, C2}, B2};
22+
//~^ ERROR unresolved import `a::b1::C1`
23+
24+
fn main() {
25+
let _: C2;
26+
let _: B2;
27+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
error[E0432]: unresolved import `a::b1::C1`
2+
--> $DIR/use-nested-groups-error.rs:21:14
3+
|
4+
21 | use a::{b1::{C1, C2}, B2};
5+
| ^^ no `C1` in `a::b1`. Did you mean to use `C2`?
6+
7+
error: aborting due to previous error
8+

‎src/tools/compiletest/src/runtest.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1402,7 +1402,7 @@ impl<'test> TestCx<'test> {
14021402
}
14031403

14041404
/// For each `aux-build: foo/bar` annotation, we check to find the
1405-
/// file in a `aux` directory relative to the test itself.
1405+
/// file in a `auxiliary` directory relative to the test itself.
14061406
fn compute_aux_test_paths(&self, rel_ab: &str) -> TestPaths {
14071407
let test_ab = self.testpaths
14081408
.file

0 commit comments

Comments
 (0)
Please sign in to comment.