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 8 pull requests #42856

Merged
merged 20 commits into from
Jun 23, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
9f91a4d
Redox: Use create() instead of open() when setting env variable
ids1024 Jun 20, 2017
43b9cb3
add extended information for E0562; impl Trait can only be a return type
zackmdavis Jun 20, 2017
12b11d8
Print -Zincremental-info to stderr instead of stdout.
michaelwoerister Jun 22, 2017
fc58145
Fix ref as mutable ref in std::rc::Rc doc
letheed Jun 22, 2017
14df549
Ensure Guard types impl Display & Debug
ChrisMacNaughton Jun 22, 2017
526afcb
Set CXX_<target> in bootstrap
ids1024 Jun 22, 2017
f98ffb5
Make Build.cxx() return a Result instead of panicking
ids1024 Jun 22, 2017
0883ce1
change span label for E0435 (fix #41871)
durka Jun 22, 2017
369d4f1
remove duplicate E0435 test
durka Jun 22, 2017
4711982
Removed as many "```ignore" as possible.
kennytm Jun 20, 2017
2c89165
Modify --explain to handle hidden code (`# ...`) and indented code bl…
kennytm Jun 20, 2017
9addd3b
Added a tidy check to disallow "```ignore" and "```rust,ignore".
kennytm Jun 20, 2017
377ff89
Rollup merge of #42777 - kennytm:kill-ignore-doctest, r=estebank
Mark-Simulacrum Jun 23, 2017
d22eb08
Rollup merge of #42783 - ids1024:redox-env, r=sfackler
Mark-Simulacrum Jun 23, 2017
ddc2333
Rollup merge of #42787 - zackmdavis:explain_E0562, r=GuillaumeGomez
Mark-Simulacrum Jun 23, 2017
f3aebb0
Rollup merge of #42821 - michaelwoerister:incr-debug-output-on-stderr…
Mark-Simulacrum Jun 23, 2017
bb2db94
Rollup merge of #42822 - ChrisMacNaughton:guard-traits, r=alexcrichton
Mark-Simulacrum Jun 23, 2017
97b7783
Rollup merge of #42825 - letheed:patch-1, r=alexcrichton
Mark-Simulacrum Jun 23, 2017
747643f
Rollup merge of #42829 - ids1024:cxx, r=alexcrichton
Mark-Simulacrum Jun 23, 2017
9037ef2
Rollup merge of #42833 - durka:non-constant-used-with-constant, r=Mar…
Mark-Simulacrum Jun 23, 2017
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
2 changes: 1 addition & 1 deletion src/bootstrap/check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ pub fn compiletest(build: &Build,
let llvm_components = output(Command::new(&llvm_config).arg("--components"));
let llvm_cxxflags = output(Command::new(&llvm_config).arg("--cxxflags"));
cmd.arg("--cc").arg(build.cc(target))
.arg("--cxx").arg(build.cxx(target))
.arg("--cxx").arg(build.cxx(target).unwrap())
.arg("--cflags").arg(build.cflags(target).join(" "))
.arg("--llvm-components").arg(llvm_components.trim())
.arg("--llvm-cxxflags").arg(llvm_cxxflags.trim());
Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ pub fn rustc(build: &Build, target: &str, compiler: &Compiler) {
!target.contains("windows") &&
!target.contains("apple") {
cargo.env("LLVM_STATIC_STDCPP",
compiler_file(build.cxx(target), "libstdc++.a"));
compiler_file(build.cxx(target).unwrap(), "libstdc++.a"));
}
if build.config.llvm_link_shared {
cargo.env("LLVM_LINK_SHARED", "1");
Expand Down
16 changes: 10 additions & 6 deletions src/bootstrap/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,10 @@ impl Build {
cargo.env(format!("CC_{}", target), self.cc(target))
.env(format!("AR_{}", target), self.ar(target).unwrap()) // only msvc is None
.env(format!("CFLAGS_{}", target), self.cflags(target).join(" "));

if let Ok(cxx) = self.cxx(target) {
cargo.env(format!("CXX_{}", target), cxx);
}
}

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

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

Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/native.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ pub fn llvm(build: &Build, target: &str) {
}

let cc = build.cc(target);
let cxx = build.cxx(target);
let cxx = build.cxx(target).unwrap();

// Handle msvc + ninja + ccache specially (this is what the bots use)
if target.contains("msvc") &&
Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/sanity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ pub fn check(build: &mut Build) {
}
}
for host in build.config.host.iter() {
need_cmd(build.cxx(host).as_ref());
need_cmd(build.cxx(host).unwrap().as_ref());
}

// The msvc hosts don't use jemalloc, turn it off globally to
Expand Down
4 changes: 3 additions & 1 deletion src/liballoc/boxed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,10 @@
//! Recursive structures must be boxed, because if the definition of `Cons`
//! looked like this:
//!
//! ```rust,ignore
//! ```compile_fail,E0072
//! # enum List<T> {
//! Cons(T, List<T>),
//! # }
//! ```
//!
//! It wouldn't work. This is because the size of a `List` depends on how many
Expand Down
2 changes: 1 addition & 1 deletion src/liballoc/fmt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@
//! There are a number of related macros in the `format!` family. The ones that
//! are currently implemented are:
//!
//! ```ignore
//! ```ignore (only-for-syntax-highlight)
//! format! // described above
//! write! // first argument is a &mut io::Write, the destination
//! writeln! // same as write but appends a newline
Expand Down
22 changes: 19 additions & 3 deletions src/liballoc/raw_vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,11 @@ impl<T, A: Alloc> RawVec<T, A> {
///
/// # Examples
///
/// ```ignore
/// ```
/// # #![feature(alloc)]
/// # extern crate alloc;
/// # use std::ptr;
/// # use alloc::raw_vec::RawVec;
/// struct MyVec<T> {
/// buf: RawVec<T>,
/// len: usize,
Expand All @@ -261,6 +265,10 @@ impl<T, A: Alloc> RawVec<T, A> {
/// self.len += 1;
/// }
/// }
/// # fn main() {
/// # let mut vec = MyVec { buf: RawVec::new(), len: 0 };
/// # vec.push(1);
/// # }
/// ```
#[inline(never)]
#[cold]
Expand Down Expand Up @@ -440,13 +448,17 @@ impl<T, A: Alloc> RawVec<T, A> {
///
/// # Examples
///
/// ```ignore
/// ```
/// # #![feature(alloc)]
/// # extern crate alloc;
/// # use std::ptr;
/// # use alloc::raw_vec::RawVec;
/// struct MyVec<T> {
/// buf: RawVec<T>,
/// len: usize,
/// }
///
/// impl<T> MyVec<T> {
/// impl<T: Clone> MyVec<T> {
/// pub fn push_all(&mut self, elems: &[T]) {
/// self.buf.reserve(self.len, elems.len());
/// // reserve would have aborted or panicked if the len exceeded
Expand All @@ -459,6 +471,10 @@ impl<T, A: Alloc> RawVec<T, A> {
/// }
/// }
/// }
/// # fn main() {
/// # let mut vector = MyVec { buf: RawVec::new(), len: 0 };
/// # vector.push_all(&[1, 3, 5, 7, 9]);
/// # }
/// ```
pub fn reserve(&mut self, used_cap: usize, needed_extra_cap: usize) {
unsafe {
Expand Down
2 changes: 1 addition & 1 deletion src/liballoc/rc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ struct RcBox<T: ?Sized> {
/// See the [module-level documentation](./index.html) for more details.
///
/// The inherent methods of `Rc` are all associated functions, which means
/// that you have to call them as e.g. [`Rc::get_mut(&value)`][get_mut] instead of
/// that you have to call them as e.g. [`Rc::get_mut(&mut value)`][get_mut] instead of
/// `value.get_mut()`. This avoids conflicts with methods of the inner
/// type `T`.
///
Expand Down
2 changes: 1 addition & 1 deletion src/liballoc/string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ use boxed::Box;
/// similar, but without the UTF-8 constraint. The second implication is that
/// you cannot index into a `String`:
///
/// ```ignore
/// ```compile_fail,E0277
/// let s = "hello";
///
/// println!("The first letter of s is {}", s[0]); // ERROR!!!
Expand Down
2 changes: 1 addition & 1 deletion src/liballoc/vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ use Bound::{Excluded, Included, Unbounded};
/// However be careful: if you try to access an index which isn't in the `Vec`,
/// your software will panic! You cannot do this:
///
/// ```ignore
/// ```should_panic
/// let v = vec![0, 2, 4, 6];
/// println!("{}", v[6]); // it will panic!
/// ```
Expand Down
14 changes: 14 additions & 0 deletions src/libcore/cell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -942,6 +942,13 @@ impl<'b, T: ?Sized> Ref<'b, T> {
#[unstable(feature = "coerce_unsized", issue = "27732")]
impl<'b, T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<Ref<'b, U>> for Ref<'b, T> {}

#[stable(feature = "std_guard_impls", since = "1.20")]
impl<'a, T: ?Sized + fmt::Display> fmt::Display for Ref<'a, T> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
self.value.fmt(f)
}
}

impl<'b, T: ?Sized> RefMut<'b, T> {
/// Make a new `RefMut` for a component of the borrowed data, e.g. an enum
/// variant.
Expand Down Expand Up @@ -1034,6 +1041,13 @@ impl<'b, T: ?Sized> DerefMut for RefMut<'b, T> {
#[unstable(feature = "coerce_unsized", issue = "27732")]
impl<'b, T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<RefMut<'b, U>> for RefMut<'b, T> {}

#[stable(feature = "std_guard_impls", since = "1.20")]
impl<'a, T: ?Sized + fmt::Display> fmt::Display for RefMut<'a, T> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
self.value.fmt(f)
}
}

/// The core primitive for interior mutability in Rust.
///
/// `UnsafeCell<T>` is a type that wraps some `T` and indicates unsafe interior operations on the
Expand Down
2 changes: 1 addition & 1 deletion src/libcore/iter/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@
//! There's one more subtle bit here: the standard library contains an
//! interesting implementation of [`IntoIterator`]:
//!
//! ```ignore
//! ```ignore (only-for-syntax-highlight)
//! impl<I: Iterator> IntoIterator for I
//! ```
//!
Expand Down
2 changes: 1 addition & 1 deletion src/libcore/marker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ macro_rules! impls{
/// example, here is a struct `Slice` that has two pointers of type `*const T`,
/// presumably pointing into an array somewhere:
///
/// ```ignore
/// ```compile_fail,E0392
/// struct Slice<'a, T> {
/// start: *const T,
/// end: *const T,
Expand Down
15 changes: 11 additions & 4 deletions src/libcore/mem.rs
Original file line number Diff line number Diff line change
Expand Up @@ -328,11 +328,18 @@ pub fn align_of_val<T: ?Sized>(val: &T) -> usize {
///
/// Here's an example of how a collection might make use of needs_drop:
///
/// ```ignore
/// ```
/// #![feature(needs_drop)]
/// use std::{mem, ptr};
///
/// pub struct MyCollection<T> { /* ... */ }
/// pub struct MyCollection<T> {
/// # data: [T; 1],
/// /* ... */
/// }
/// # impl<T> MyCollection<T> {
/// # fn iter_mut(&mut self) -> &mut [T] { &mut self.data }
/// # fn free_buffer(&mut self) {}
/// # }
///
/// impl<T> Drop for MyCollection<T> {
/// fn drop(&mut self) {
Expand Down Expand Up @@ -575,7 +582,7 @@ pub fn swap<T>(x: &mut T, y: &mut T) {
/// `replace` allows consumption of a struct field by replacing it with another value.
/// Without `replace` you can run into issues like these:
///
/// ```ignore
/// ```compile_fail,E0507
/// struct Buffer<T> { buf: Vec<T> }
///
/// impl<T> Buffer<T> {
Expand Down Expand Up @@ -645,7 +652,7 @@ pub fn replace<T>(dest: &mut T, mut src: T) -> T {
///
/// Borrows are based on lexical scope, so this produces an error:
///
/// ```ignore
/// ```compile_fail,E0502
/// let mut v = vec![1, 2, 3];
/// let x = &v[0];
///
Expand Down
18 changes: 16 additions & 2 deletions src/libcore/ops/place.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,13 @@ pub trait Place<Data: ?Sized> {
///
/// `PLACE <- EXPR` effectively desugars into:
///
/// ```rust,ignore
/// ```
/// # #![feature(placement_new_protocol, box_heap)]
/// # use std::ops::{Placer, Place, InPlace};
/// # #[allow(non_snake_case)]
/// # fn main() {
/// # let PLACE = std::boxed::HEAP;
/// # let EXPR = 1;
/// let p = PLACE;
/// let mut place = Placer::make_place(p);
/// let raw_place = Place::pointer(&mut place);
Expand All @@ -47,6 +53,7 @@ pub trait Place<Data: ?Sized> {
/// std::ptr::write(raw_place, value);
/// InPlace::finalize(place)
/// }
/// # ; }
/// ```
///
/// The type of `PLACE <- EXPR` is derived from the type of `PLACE`;
Expand Down Expand Up @@ -89,14 +96,21 @@ pub trait InPlace<Data: ?Sized>: Place<Data> {
///
/// `box EXPR` effectively desugars into:
///
/// ```rust,ignore
/// ```
/// # #![feature(placement_new_protocol)]
/// # use std::ops::{BoxPlace, Place, Boxed};
/// # #[allow(non_snake_case)]
/// # fn main() {
/// # let EXPR = 1;
/// let mut place = BoxPlace::make_place();
/// let raw_place = Place::pointer(&mut place);
/// let value = EXPR;
/// # let _: Box<_> =
/// unsafe {
/// ::std::ptr::write(raw_place, value);
/// Boxed::finalize(place)
/// }
/// # ; }
/// ```
///
/// The type of `box EXPR` is supplied from its surrounding
Expand Down
7 changes: 4 additions & 3 deletions src/libcore/ops/range.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ use fmt;
/// It does not have an `IntoIterator` implementation, so you can't use it in a
/// `for` loop directly. This won't compile:
///
/// ```ignore
/// ```compile_fail,E0277
/// for i in .. {
/// // ...
/// }
Expand Down Expand Up @@ -184,7 +184,7 @@ impl<Idx: PartialOrd<Idx>> RangeFrom<Idx> {
/// It does not have an `IntoIterator` implementation, so you can't use it in a
/// `for` loop directly. This won't compile:
///
/// ```ignore
/// ```compile_fail,E0277
/// for i in ..5 {
/// // ...
/// }
Expand Down Expand Up @@ -313,7 +313,8 @@ impl<Idx: PartialOrd<Idx>> RangeInclusive<Idx> {
/// It does not have an `IntoIterator` implementation, so you can't use it in a
/// `for` loop directly. This won't compile:
///
/// ```ignore
/// ```compile_fail,E0277
/// #![feature(inclusive_range_syntax)]
/// for i in ...5 {
/// // ...
/// }
Expand Down
6 changes: 4 additions & 2 deletions src/libcore/panicking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@
//! useful an upstream crate must define panicking for libcore to use. The current
//! interface for panicking is:
//!
//! ```ignore
//! fn panic_impl(fmt: fmt::Arguments, &(&'static str, u32)) -> !;
//! ```
//! # use std::fmt;
//! fn panic_impl(fmt: fmt::Arguments, file_line: &(&'static str, u32)) -> !
//! # { loop {} }
//! ```
//!
//! This definition allows for panicking with any general message, but it does not
Expand Down
12 changes: 6 additions & 6 deletions src/libcore/ptr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -408,11 +408,11 @@ impl<T: ?Sized> *const T {
///
/// Basic usage:
///
/// ```ignore
/// let val: *const u8 = &10u8 as *const u8;
/// ```
/// let ptr: *const u8 = &10u8 as *const u8;
///
/// unsafe {
/// if let Some(val_back) = val.as_ref() {
/// if let Some(val_back) = ptr.as_ref() {
/// println!("We got back the value: {}!", val_back);
/// }
/// }
Expand Down Expand Up @@ -570,11 +570,11 @@ impl<T: ?Sized> *mut T {
///
/// Basic usage:
///
/// ```ignore
/// let val: *mut u8 = &mut 10u8 as *mut u8;
/// ```
/// let ptr: *mut u8 = &mut 10u8 as *mut u8;
///
/// unsafe {
/// if let Some(val_back) = val.as_ref() {
/// if let Some(val_back) = ptr.as_ref() {
/// println!("We got back the value: {}!", val_back);
/// }
/// }
Expand Down
2 changes: 1 addition & 1 deletion src/libgraphviz/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@
//!
//! Output from first example (in `example1.dot`):
//!
//! ```ignore
//! ```dot
//! digraph example1 {
//! N0[label="N0"];
//! N1[label="N1"];
Expand Down
Loading