Skip to content

Commit 229d0d3

Browse files
committed
Auto merge of #42856 - Mark-Simulacrum:rollup, r=Mark-Simulacrum
Rollup of 8 pull requests - Successful merges: #42777, #42783, #42787, #42821, #42822, #42825, #42829, #42833 - Failed merges:
2 parents bd32b1b + 9037ef2 commit 229d0d3

File tree

68 files changed

+668
-286
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+668
-286
lines changed

src/bootstrap/check.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ pub fn compiletest(build: &Build,
265265
let llvm_components = output(Command::new(&llvm_config).arg("--components"));
266266
let llvm_cxxflags = output(Command::new(&llvm_config).arg("--cxxflags"));
267267
cmd.arg("--cc").arg(build.cc(target))
268-
.arg("--cxx").arg(build.cxx(target))
268+
.arg("--cxx").arg(build.cxx(target).unwrap())
269269
.arg("--cflags").arg(build.cflags(target).join(" "))
270270
.arg("--llvm-components").arg(llvm_components.trim())
271271
.arg("--llvm-cxxflags").arg(llvm_cxxflags.trim());

src/bootstrap/compile.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ pub fn rustc(build: &Build, target: &str, compiler: &Compiler) {
291291
!target.contains("windows") &&
292292
!target.contains("apple") {
293293
cargo.env("LLVM_STATIC_STDCPP",
294-
compiler_file(build.cxx(target), "libstdc++.a"));
294+
compiler_file(build.cxx(target).unwrap(), "libstdc++.a"));
295295
}
296296
if build.config.llvm_link_shared {
297297
cargo.env("LLVM_LINK_SHARED", "1");

src/bootstrap/lib.rs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -452,6 +452,10 @@ impl Build {
452452
cargo.env(format!("CC_{}", target), self.cc(target))
453453
.env(format!("AR_{}", target), self.ar(target).unwrap()) // only msvc is None
454454
.env(format!("CFLAGS_{}", target), self.cflags(target).join(" "));
455+
456+
if let Ok(cxx) = self.cxx(target) {
457+
cargo.env(format!("CXX_{}", target), cxx);
458+
}
455459
}
456460

457461
if self.config.extended && compiler.is_final_stage(self) {
@@ -838,13 +842,13 @@ impl Build {
838842
self.cc[target].1.as_ref().map(|p| &**p)
839843
}
840844

841-
/// Returns the path to the C++ compiler for the target specified, may panic
842-
/// if no C++ compiler was configured for the target.
843-
fn cxx(&self, target: &str) -> &Path {
845+
/// Returns the path to the C++ compiler for the target specified.
846+
fn cxx(&self, target: &str) -> Result<&Path, String> {
844847
match self.cxx.get(target) {
845-
Some(p) => p.path(),
846-
None => panic!("\n\ntarget `{}` is not configured as a host,
847-
only as a target\n\n", target),
848+
Some(p) => Ok(p.path()),
849+
None => Err(format!(
850+
"target `{}` is not configured as a host, only as a target",
851+
target))
848852
}
849853
}
850854

src/bootstrap/native.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ pub fn llvm(build: &Build, target: &str) {
155155
}
156156

157157
let cc = build.cc(target);
158-
let cxx = build.cxx(target);
158+
let cxx = build.cxx(target).unwrap();
159159

160160
// Handle msvc + ninja + ccache specially (this is what the bots use)
161161
if target.contains("msvc") &&

src/bootstrap/sanity.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ pub fn check(build: &mut Build) {
139139
}
140140
}
141141
for host in build.config.host.iter() {
142-
need_cmd(build.cxx(host).as_ref());
142+
need_cmd(build.cxx(host).unwrap().as_ref());
143143
}
144144

145145
// The msvc hosts don't use jemalloc, turn it off globally to

src/liballoc/boxed.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,10 @@
4242
//! Recursive structures must be boxed, because if the definition of `Cons`
4343
//! looked like this:
4444
//!
45-
//! ```rust,ignore
45+
//! ```compile_fail,E0072
46+
//! # enum List<T> {
4647
//! Cons(T, List<T>),
48+
//! # }
4749
//! ```
4850
//!
4951
//! It wouldn't work. This is because the size of a `List` depends on how many

src/liballoc/fmt.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@
230230
//! There are a number of related macros in the `format!` family. The ones that
231231
//! are currently implemented are:
232232
//!
233-
//! ```ignore
233+
//! ```ignore (only-for-syntax-highlight)
234234
//! format! // described above
235235
//! write! // first argument is a &mut io::Write, the destination
236236
//! writeln! // same as write but appends a newline

src/liballoc/raw_vec.rs

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,11 @@ impl<T, A: Alloc> RawVec<T, A> {
244244
///
245245
/// # Examples
246246
///
247-
/// ```ignore
247+
/// ```
248+
/// # #![feature(alloc)]
249+
/// # extern crate alloc;
250+
/// # use std::ptr;
251+
/// # use alloc::raw_vec::RawVec;
248252
/// struct MyVec<T> {
249253
/// buf: RawVec<T>,
250254
/// len: usize,
@@ -261,6 +265,10 @@ impl<T, A: Alloc> RawVec<T, A> {
261265
/// self.len += 1;
262266
/// }
263267
/// }
268+
/// # fn main() {
269+
/// # let mut vec = MyVec { buf: RawVec::new(), len: 0 };
270+
/// # vec.push(1);
271+
/// # }
264272
/// ```
265273
#[inline(never)]
266274
#[cold]
@@ -440,13 +448,17 @@ impl<T, A: Alloc> RawVec<T, A> {
440448
///
441449
/// # Examples
442450
///
443-
/// ```ignore
451+
/// ```
452+
/// # #![feature(alloc)]
453+
/// # extern crate alloc;
454+
/// # use std::ptr;
455+
/// # use alloc::raw_vec::RawVec;
444456
/// struct MyVec<T> {
445457
/// buf: RawVec<T>,
446458
/// len: usize,
447459
/// }
448460
///
449-
/// impl<T> MyVec<T> {
461+
/// impl<T: Clone> MyVec<T> {
450462
/// pub fn push_all(&mut self, elems: &[T]) {
451463
/// self.buf.reserve(self.len, elems.len());
452464
/// // reserve would have aborted or panicked if the len exceeded
@@ -459,6 +471,10 @@ impl<T, A: Alloc> RawVec<T, A> {
459471
/// }
460472
/// }
461473
/// }
474+
/// # fn main() {
475+
/// # let mut vector = MyVec { buf: RawVec::new(), len: 0 };
476+
/// # vector.push_all(&[1, 3, 5, 7, 9]);
477+
/// # }
462478
/// ```
463479
pub fn reserve(&mut self, used_cap: usize, needed_extra_cap: usize) {
464480
unsafe {

src/liballoc/rc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ struct RcBox<T: ?Sized> {
273273
/// See the [module-level documentation](./index.html) for more details.
274274
///
275275
/// The inherent methods of `Rc` are all associated functions, which means
276-
/// that you have to call them as e.g. [`Rc::get_mut(&value)`][get_mut] instead of
276+
/// that you have to call them as e.g. [`Rc::get_mut(&mut value)`][get_mut] instead of
277277
/// `value.get_mut()`. This avoids conflicts with methods of the inner
278278
/// type `T`.
279279
///

src/liballoc/string.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ use boxed::Box;
124124
/// similar, but without the UTF-8 constraint. The second implication is that
125125
/// you cannot index into a `String`:
126126
///
127-
/// ```ignore
127+
/// ```compile_fail,E0277
128128
/// let s = "hello";
129129
///
130130
/// println!("The first letter of s is {}", s[0]); // ERROR!!!

0 commit comments

Comments
 (0)