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 16 pull requests #54457

Merged
merged 37 commits into from
Sep 22, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
8282896
remove (more) CAS API from Atomic* types where not natively supported
japaric Sep 16, 2018
cb594cf
Treat `dyn` as a keyword in the 2018 edition
varkor Sep 15, 2018
2a45057
rustbuild: drop color handling
Keruspe Sep 18, 2018
c996c4d
Add support for running doc test in specific edition
Munksgaard Sep 18, 2018
99f05e8
Improve handling of type bounds in `bit_set.rs`.
nnethercote Sep 18, 2018
9332167
add -Zui-testing to rustdoc
QuietMisdreavus Sep 19, 2018
adc2c04
Make 'proc_macro::MultiSpan' public.
SergioBenitez Sep 20, 2018
b3ffd33
define copy_within on slices
oconnor663 Aug 23, 2018
d0e59f5
add tests for copy_within
oconnor663 Sep 19, 2018
ac8d8d7
Add test for doctest edition support
Munksgaard Sep 18, 2018
b01e0e4
Add a documentation banner for edition specific code
Munksgaard Sep 19, 2018
06b1975
Add documentation about the edition flag
Munksgaard Sep 19, 2018
36d562f
Use no_default_libraries for all NetBSD flavors
bgermann Sep 20, 2018
d341b17
Add test for deref recursion limit printing twice
memoryruins Sep 21, 2018
9784d35
parser: Tweak function parameter parsing to avoid rollback on succesf…
petrochenkov Sep 21, 2018
70da203
Remove incidental notes
memoryruins Sep 21, 2018
7f9a259
add applicability to span suggestion call
jcpst Sep 21, 2018
06d577d
Detect `for _ in in bar {}` typo
estebank Sep 19, 2018
b2f25e3
Compress `Liveness` data some more.
nnethercote Sep 21, 2018
48f4605
Simplify slice's first(_mut) and last(_mut) with get
ljedrz Sep 21, 2018
ad9bf17
Update .mailmap
pvdrz Sep 21, 2018
e6ee4e0
Rollup merge of #53652 - oconnor663:copy_in_place, r=alexcrichton
pietroalbini Sep 22, 2018
822c511
Rollup merge of #54261 - varkor:dyn-keyword-2018, r=petrochenkov
pietroalbini Sep 22, 2018
e3cc48a
Rollup merge of #54280 - japaric:no-cas-for-thumbv6, r=alexcrichton
pietroalbini Sep 22, 2018
e59df62
Rollup merge of #54323 - Keruspe:rustc-color, r=Mark-Simulacrum
pietroalbini Sep 22, 2018
23636e3
Rollup merge of #54350 - Munksgaard:support-edition-in-doc-test, r=st…
pietroalbini Sep 22, 2018
167a045
Rollup merge of #54370 - nnethercote:better-domain_size, r=nikomatsakis
pietroalbini Sep 22, 2018
7248b79
Rollup merge of #54371 - QuietMisdreavus:rustdoc-ui-testing, r=Guilla…
pietroalbini Sep 22, 2018
5d8a27e
Rollup merge of #54374 - SergioBenitez:pub-multispan, r=alexcrichton
pietroalbini Sep 22, 2018
8455a7f
Rollup merge of #54402 - bgermann:master, r=alexcrichton
pietroalbini Sep 22, 2018
1eee532
Rollup merge of #54409 - estebank:remove-in, r=pnkfelix
pietroalbini Sep 22, 2018
394d687
Rollup merge of #54412 - jcpst:replace_span_suggestion, r=estebank
pietroalbini Sep 22, 2018
0bf52b3
Rollup merge of #54413 - memoryruins:deref-error-twice, r=estebank
pietroalbini Sep 22, 2018
7c34cf7
Rollup merge of #54415 - petrochenkov:norollback, r=estebank
pietroalbini Sep 22, 2018
317b212
Rollup merge of #54420 - nnethercote:PackedRWU-Vec, r=nikomatsakis
pietroalbini Sep 22, 2018
452d9d0
Rollup merge of #54422 - ljedrz:simplify_first_last, r=Mark-Simulacrum
pietroalbini Sep 22, 2018
48ec53c
Rollup merge of #54446 - christianpoveda:patch-1, r=cramertj
pietroalbini Sep 22, 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
1 change: 1 addition & 0 deletions .mailmap
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ Chris C Cerami <[email protected]> Chris C Cerami <chrisccer
Chris Pressey <[email protected]>
Chris Thorn <[email protected]> Chris Thorn <[email protected]>
Chris Vittal <[email protected]> Christopher Vittal <[email protected]>
Christian Poveda <[email protected]> <[email protected]> <[email protected]>
Clark Gaebel <[email protected]> <[email protected]>
Clinton Ryan <[email protected]>
Corey Richardson <[email protected]> Elaine "See More" Nemo <[email protected]>
Expand Down
9 changes: 0 additions & 9 deletions src/bootstrap/bin/rustc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -291,15 +291,6 @@ fn main() {
cmd.arg("-Z").arg("verify-llvm-ir");
}

let color = match env::var("RUSTC_COLOR") {
Ok(s) => usize::from_str(&s).expect("RUSTC_COLOR should be an integer"),
Err(_) => 0,
};

if color != 0 {
cmd.arg("--color=always");
}

if env::var_os("RUSTC_DENY_WARNINGS").is_some() && env::var_os("RUSTC_EXTERNAL_TOOL").is_none()
{
cmd.arg("-Dwarnings");
Expand Down
34 changes: 1 addition & 33 deletions src/bootstrap/compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ use build_helper::{output, mtime, up_to_date};
use filetime::FileTime;
use serde_json;

use util::{exe, libdir, is_dylib, CiEnv};
use util::{exe, libdir, is_dylib};
use {Compiler, Mode, GitRepo};
use native;

Expand Down Expand Up @@ -1034,29 +1034,6 @@ pub fn add_to_sysroot(builder: &Builder, sysroot_dst: &Path, stamp: &Path) {
}
}

// Avoiding a dependency on winapi to keep compile times down
#[cfg(unix)]
fn stderr_isatty() -> bool {
use libc;
unsafe { libc::isatty(libc::STDERR_FILENO) != 0 }
}
#[cfg(windows)]
fn stderr_isatty() -> bool {
type DWORD = u32;
type BOOL = i32;
type HANDLE = *mut u8;
const STD_ERROR_HANDLE: DWORD = -12i32 as DWORD;
extern "system" {
fn GetStdHandle(which: DWORD) -> HANDLE;
fn GetConsoleMode(hConsoleHandle: HANDLE, lpMode: *mut DWORD) -> BOOL;
}
unsafe {
let handle = GetStdHandle(STD_ERROR_HANDLE);
let mut out = 0;
GetConsoleMode(handle, &mut out) != 0
}
}

pub fn run_cargo(builder: &Builder,
cargo: &mut Command,
tail_args: Vec<String>,
Expand Down Expand Up @@ -1218,15 +1195,6 @@ pub fn stream_cargo(
cargo.arg("--message-format").arg("json")
.stdout(Stdio::piped());

if stderr_isatty() && builder.ci_env == CiEnv::None &&
// if the terminal is reported as dumb, then we don't want to enable color for rustc
env::var_os("TERM").map(|t| t != *"dumb").unwrap_or(true) {
// since we pass message-format=json to cargo, we need to tell the rustc
// wrapper to give us colored output if necessary. This is because we
// only want Cargo's JSON output, not rustcs.
cargo.env("RUSTC_COLOR", "1");
}

for arg in tail_args {
cargo.arg(arg);
}
Expand Down
16 changes: 16 additions & 0 deletions src/doc/rustdoc/src/documentation-tests.md
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,22 @@ compiles, then the test will fail. However please note that code failing
with the current Rust release may work in a future release, as new features
are added.

```text
/// Only runs on the 2018 edition.
///
/// ```edition2018
/// let result: Result<i32, ParseIntError> = try {
/// "1".parse::<i32>()?
/// + "2".parse::<i32>()?
/// + "3".parse::<i32>()?
/// };
/// ```
```

`edition2018` tells `rustdoc` that the code sample should be compiled the 2018
edition of Rust. Similarly, you can specify `edition2015` to compile the code
with the 2015 edition.

## Syntax reference

The *exact* syntax for code blocks, including the edge cases, can be found
Expand Down
4 changes: 1 addition & 3 deletions src/doc/unstable-book/src/language-features/try-blocks.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ The tracking issue for this feature is: [#31436]
The `try_blocks` feature adds support for `try` blocks. A `try`
block creates a new scope one can use the `?` operator in.

```rust,ignore
// This code needs the 2018 edition

```rust,edition2018
#![feature(try_blocks)]

use std::num::ParseIntError;
Expand Down
69 changes: 63 additions & 6 deletions src/libcore/slice/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ impl<T> [T] {
#[stable(feature = "rust1", since = "1.0.0")]
#[inline]
pub fn first(&self) -> Option<&T> {
if self.is_empty() { None } else { Some(&self[0]) }
self.get(0)
}

/// Returns a mutable pointer to the first element of the slice, or `None` if it is empty.
Expand All @@ -137,7 +137,7 @@ impl<T> [T] {
#[stable(feature = "rust1", since = "1.0.0")]
#[inline]
pub fn first_mut(&mut self) -> Option<&mut T> {
if self.is_empty() { None } else { Some(&mut self[0]) }
self.get_mut(0)
}

/// Returns the first and all the rest of the elements of the slice, or `None` if it is empty.
Expand Down Expand Up @@ -239,7 +239,8 @@ impl<T> [T] {
#[stable(feature = "rust1", since = "1.0.0")]
#[inline]
pub fn last(&self) -> Option<&T> {
if self.is_empty() { None } else { Some(&self[self.len() - 1]) }
let last_idx = self.len().checked_sub(1)?;
self.get(last_idx)
}

/// Returns a mutable pointer to the last item in the slice.
Expand All @@ -257,9 +258,8 @@ impl<T> [T] {
#[stable(feature = "rust1", since = "1.0.0")]
#[inline]
pub fn last_mut(&mut self) -> Option<&mut T> {
let len = self.len();
if len == 0 { return None; }
Some(&mut self[len - 1])
let last_idx = self.len().checked_sub(1)?;
self.get_mut(last_idx)
}

/// Returns a reference to an element or subslice depending on the type of
Expand Down Expand Up @@ -1618,6 +1618,63 @@ impl<T> [T] {
}
}

/// Copies elements from one part of the slice to another part of itself,
/// using a memmove.
///
/// `src` is the range within `self` to copy from. `dest` is the starting
/// index of the range within `self` to copy to, which will have the same
/// length as `src`. The two ranges may overlap. The ends of the two ranges
/// must be less than or equal to `self.len()`.
///
/// # Panics
///
/// This function will panic if either range exceeds the end of the slice,
/// or if the end of `src` is before the start.
///
/// # Examples
///
/// Copying four bytes within a slice:
///
/// ```
/// # #![feature(copy_within)]
/// let mut bytes = *b"Hello, World!";
///
/// bytes.copy_within(1..5, 8);
///
/// assert_eq!(&bytes, b"Hello, Wello!");
/// ```
#[unstable(feature = "copy_within", issue = "54236")]
pub fn copy_within<R: ops::RangeBounds<usize>>(&mut self, src: R, dest: usize)
where
T: Copy,
{
let src_start = match src.start_bound() {
ops::Bound::Included(&n) => n,
ops::Bound::Excluded(&n) => n
.checked_add(1)
.unwrap_or_else(|| slice_index_overflow_fail()),
ops::Bound::Unbounded => 0,
};
let src_end = match src.end_bound() {
ops::Bound::Included(&n) => n
.checked_add(1)
.unwrap_or_else(|| slice_index_overflow_fail()),
ops::Bound::Excluded(&n) => n,
ops::Bound::Unbounded => self.len(),
};
assert!(src_start <= src_end, "src end is before src start");
assert!(src_end <= self.len(), "src is out of bounds");
let count = src_end - src_start;
assert!(dest <= self.len() - count, "dest is out of bounds");
unsafe {
ptr::copy(
self.get_unchecked(src_start),
self.get_unchecked_mut(dest),
count,
);
}
}

/// Swaps all elements in `self` with those in `other`.
///
/// The length of `other` must be the same as `self`.
Expand Down
Loading