Skip to content

Commit def3269

Browse files
committed
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)]

0 commit comments

Comments
 (0)