Skip to content

Rollup of 11 pull requests #52616

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

Merged
merged 36 commits into from
Jul 22, 2018
Merged
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
7c31609
Deprecation of str::slice_uncheked(_mut)
newpavlov Jun 26, 2018
aaf2004
removed slice_uncheked from src/liballoc/tests/str.rs
newpavlov Jun 26, 2018
f1cc8b2
review fix
newpavlov Jun 26, 2018
c3e2ff8
Create Dockerfile based on dist-various-1.
sekineh Jun 24, 2018
44b7a80
Tweak to run test for thumbv7m target.
sekineh Jun 24, 2018
990a2ff
Remove the comment line that harmed.
sekineh Jun 24, 2018
808bcfb
deprecation message improvement
newpavlov Jul 12, 2018
bbc89b2
Fix rust issue #52163
sekineh Jul 17, 2018
e15c7bd
Add IMAGE `thumb-none` to .travis.yml
sekineh Jul 17, 2018
d8e64e1
Adjust TARGETS.
sekineh Jul 17, 2018
355b99f
Cleanup Dockerfile.
sekineh Jul 17, 2018
0b3b8bf
Use `dist-various-1` Dockerfile.
sekineh Jul 18, 2018
7630090
Re-include `thumbv6m-none-eabi` to `run-make` target
sekineh Jul 18, 2018
ce75632
Document that Unique::empty() and NonNull::dangling() aren't sentinel…
joshtriplett Jul 18, 2018
3074c42
Fix links in rustdoc book.
ehuss Jul 19, 2018
e1ef8ba
Reword when `_` couldn't be inferred
Jul 18, 2018
70e7e7d
Fix new test
Jul 20, 2018
a18be44
Avoid using `#[macro_export]` for documenting builtin macros
petrochenkov Jul 20, 2018
c581b96
Typo
felixrabe Jul 21, 2018
3f00b1c
Treat no_std(target) == None case correctly.
sekineh Jul 21, 2018
50720ba
Add missing backtick
csmoe Jul 21, 2018
ab0092e
Run the error index tool against the sysroot libdir
Mark-Simulacrum Jul 21, 2018
e6fc62a
Don't use SIMD in mem::swap for types smaller than the block size
scottmcm Jul 4, 2018
c9482f7
Only run the test on x86_64
scottmcm Jul 22, 2018
c645ecd
Added new lines to .gitignore.
davidtwco Jul 22, 2018
67cf3ba
Rollup merge of #51807 - newpavlov:deprecate_str_slice, r=alexcrichton
kennytm Jul 22, 2018
180ad53
Rollup merge of #52465 - sekineh:add-ci-thumb, r=alexcrichton
kennytm Jul 22, 2018
82cdbf1
Rollup merge of #52507 - estebank:infer-type, r=nikomatsakis
kennytm Jul 22, 2018
519651a
Rollup merge of #52508 - joshtriplett:dangling-not-sentinel, r=Mark-S…
kennytm Jul 22, 2018
0235707
Rollup merge of #52521 - ehuss:rustdoc-passes-doc, r=kennytm
kennytm Jul 22, 2018
8e6971d
Rollup merge of #52581 - petrochenkov:bmacrodoc, r=alexcrichton
kennytm Jul 22, 2018
1208944
Rollup merge of #52582 - felixrabe:patch-2, r=pietroalbini
kennytm Jul 22, 2018
aea141e
Rollup merge of #52587 - csmoe:doc, r=kennytm
kennytm Jul 22, 2018
de3cf0c
Rollup merge of #52594 - Mark-Simulacrum:error-index-stage0, r=alexcr…
kennytm Jul 22, 2018
7019cce
Rollup merge of #52615 - davidtwco:add-to-gitignore, r=nikomatsakis,M…
kennytm Jul 22, 2018
b954d4d
Rollup merge of #52051 - scottmcm:swap-directly, r=alexcrichton
kennytm Jul 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
7 changes: 5 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -86,15 +86,18 @@ __pycache__/
target/
/test/
/tmp/
tags
tags.*
TAGS
TAGS.emacs
TAGS.vi
TAGS.*
\#*
\#*\#
config.mk
config.stamp
keywords.md
lexer.ml
mir_dump
Session.vim
src/etc/dl
tmp.*.rs
version.md
4 changes: 3 additions & 1 deletion src/bootstrap/test.rs
Original file line number Diff line number Diff line change
@@ -966,7 +966,9 @@ impl Step for Compiletest {
builder.ensure(compile::Rustc { compiler, target });
}

builder.ensure(compile::Test { compiler, target });
if builder.no_std(target) != Some(true) {
builder.ensure(compile::Test { compiler, target });
}
builder.ensure(native::TestHelpers { target });
builder.ensure(RemoteCopyLibs { compiler, target });

4 changes: 2 additions & 2 deletions src/bootstrap/tool.rs
Original file line number Diff line number Diff line change
@@ -275,7 +275,7 @@ pub fn prepare_tool_cargo(

macro_rules! tool {
($($name:ident, $path:expr, $tool_name:expr, $mode:expr $(,llvm_tools = $llvm:expr)*;)+) => {
#[derive(Copy, Clone)]
#[derive(Copy, PartialEq, Eq, Clone)]
pub enum Tool {
$(
$name,
@@ -640,7 +640,7 @@ impl<'a> Builder<'a> {
fn prepare_tool_cmd(&self, compiler: Compiler, tool: Tool, cmd: &mut Command) {
let host = &compiler.host;
let mut lib_paths: Vec<PathBuf> = vec![
if compiler.stage == 0 {
if compiler.stage == 0 && tool != Tool::ErrorIndex {
self.build.rustc_snapshot_libdir()
} else {
PathBuf::from(&self.sysroot_libdir(compiler, compiler.host))
9 changes: 8 additions & 1 deletion src/ci/docker/dist-various-1/Dockerfile
Original file line number Diff line number Diff line change
@@ -80,6 +80,11 @@ RUN \
echo "# a" >> /usr/local/mips-linux-musl/bin/mips-openwrt-linux-musl-wrapper.sh && \
echo "# b" >> /usr/local/mipsel-linux-musl/bin/mipsel-openwrt-linux-musl-wrapper.sh

ENV RUN_MAKE_TARGETS=thumbv6m-none-eabi
ENV RUN_MAKE_TARGETS=$RUN_MAKE_TARGETS,thumbv7m-none-eabi
ENV RUN_MAKE_TARGETS=$RUN_MAKE_TARGETS,thumbv7em-none-eabi
ENV RUN_MAKE_TARGETS=$RUN_MAKE_TARGETS,thumbv7em-none-eabihf

ENV TARGETS=asmjs-unknown-emscripten
ENV TARGETS=$TARGETS,wasm32-unknown-emscripten
ENV TARGETS=$TARGETS,x86_64-rumprun-netbsd
@@ -120,7 +125,9 @@ ENV RUST_CONFIGURE_ARGS \
--enable-emscripten \
--disable-docs

ENV SCRIPT python2.7 ../x.py dist --target $TARGETS
ENV SCRIPT \
python2.7 ../x.py test --target $RUN_MAKE_TARGETS src/test/run-make && \
python2.7 ../x.py dist --target $TARGETS

# sccache
COPY scripts/sccache.sh /scripts/
4 changes: 2 additions & 2 deletions src/doc/rustdoc/src/passes.md
Original file line number Diff line number Diff line change
@@ -5,8 +5,8 @@ Rustdoc has a concept called "passes". These are transformations that

In addition to the passes below, check out the docs for these flags:

* [`--passes`](command-line-arguments.html#--passes-add-more-rustdoc-passes)
* [`--no-defaults`](command-line-arguments.html#--no-defaults-dont-run-default-passes)
* [`--passes`](command-line-arguments.html#a--passes-add-more-rustdoc-passes)
* [`--no-defaults`](command-line-arguments.html#a--no-defaults-dont-run-default-passes)

## Default passes

8 changes: 4 additions & 4 deletions src/liballoc/str.rs
Original file line number Diff line number Diff line change
@@ -268,11 +268,11 @@ impl str {
let mut result = String::new();
let mut last_end = 0;
for (start, part) in self.match_indices(from) {
result.push_str(unsafe { self.slice_unchecked(last_end, start) });
result.push_str(unsafe { self.get_unchecked(last_end..start) });
result.push_str(to);
last_end = start + part.len();
}
result.push_str(unsafe { self.slice_unchecked(last_end, self.len()) });
result.push_str(unsafe { self.get_unchecked(last_end..self.len()) });
result
}

@@ -309,11 +309,11 @@ impl str {
let mut result = String::with_capacity(32);
let mut last_end = 0;
for (start, part) in self.match_indices(pat).take(count) {
result.push_str(unsafe { self.slice_unchecked(last_end, start) });
result.push_str(unsafe { self.get_unchecked(last_end..start) });
result.push_str(to);
last_end = start + part.len();
}
result.push_str(unsafe { self.slice_unchecked(last_end, self.len()) });
result.push_str(unsafe { self.get_unchecked(last_end..self.len()) });
result
}

2 changes: 1 addition & 1 deletion src/liballoc/string.rs
Original file line number Diff line number Diff line change
@@ -1222,7 +1222,7 @@ impl String {

while idx < len {
let ch = unsafe {
self.slice_unchecked(idx, len).chars().next().unwrap()
self.get_unchecked(idx..len).chars().next().unwrap()
};
let ch_len = ch.len_utf8();

8 changes: 4 additions & 4 deletions src/liballoc/tests/str.rs
Original file line number Diff line number Diff line change
@@ -177,9 +177,9 @@ fn test_join_for_different_lengths_with_long_separator() {

#[test]
fn test_unsafe_slice() {
assert_eq!("ab", unsafe {"abc".slice_unchecked(0, 2)});
assert_eq!("bc", unsafe {"abc".slice_unchecked(1, 3)});
assert_eq!("", unsafe {"abc".slice_unchecked(1, 1)});
assert_eq!("ab", unsafe {"abc".get_unchecked(0..2)});
assert_eq!("bc", unsafe {"abc".get_unchecked(1..3)});
assert_eq!("", unsafe {"abc".get_unchecked(1..1)});
fn a_million_letter_a() -> String {
let mut i = 0;
let mut rs = String::new();
@@ -200,7 +200,7 @@ fn test_unsafe_slice() {
}
let letters = a_million_letter_a();
assert_eq!(half_a_million_letter_a(),
unsafe { letters.slice_unchecked(0, 500000)});
unsafe { letters.get_unchecked(0..500000)});
}

#[test]
49 changes: 17 additions & 32 deletions src/libcore/macros.rs
Original file line number Diff line number Diff line change
@@ -543,6 +543,7 @@ macro_rules! unimplemented {
/// into libsyntax itself.
///
/// For more information, see documentation for `std`'s macros.
#[cfg(dox)]
mod builtin {

/// Unconditionally causes compilation to fail with the given error message when encountered.
@@ -551,8 +552,7 @@ mod builtin {
///
/// [`std::compile_error!`]: ../std/macro.compile_error.html
#[stable(feature = "compile_error_macro", since = "1.20.0")]
#[macro_export]
#[cfg(dox)]
#[rustc_doc_only_macro]
macro_rules! compile_error {
($msg:expr) => ({ /* compiler built-in */ });
($msg:expr,) => ({ /* compiler built-in */ });
@@ -564,8 +564,7 @@ mod builtin {
///
/// [`std::format_args!`]: ../std/macro.format_args.html
#[stable(feature = "rust1", since = "1.0.0")]
#[macro_export]
#[cfg(dox)]
#[rustc_doc_only_macro]
macro_rules! format_args {
($fmt:expr) => ({ /* compiler built-in */ });
($fmt:expr, $($args:tt)*) => ({ /* compiler built-in */ });
@@ -577,8 +576,7 @@ mod builtin {
///
/// [`std::env!`]: ../std/macro.env.html
#[stable(feature = "rust1", since = "1.0.0")]
#[macro_export]
#[cfg(dox)]
#[rustc_doc_only_macro]
macro_rules! env {
($name:expr) => ({ /* compiler built-in */ });
($name:expr,) => ({ /* compiler built-in */ });
@@ -590,8 +588,7 @@ mod builtin {
///
/// [`std::option_env!`]: ../std/macro.option_env.html
#[stable(feature = "rust1", since = "1.0.0")]
#[macro_export]
#[cfg(dox)]
#[rustc_doc_only_macro]
macro_rules! option_env {
($name:expr) => ({ /* compiler built-in */ });
($name:expr,) => ({ /* compiler built-in */ });
@@ -603,8 +600,7 @@ mod builtin {
///
/// [`std::concat_idents!`]: ../std/macro.concat_idents.html
#[unstable(feature = "concat_idents_macro", issue = "29599")]
#[macro_export]
#[cfg(dox)]
#[rustc_doc_only_macro]
macro_rules! concat_idents {
($($e:ident),+) => ({ /* compiler built-in */ });
($($e:ident,)+) => ({ /* compiler built-in */ });
@@ -616,8 +612,7 @@ mod builtin {
///
/// [`std::concat!`]: ../std/macro.concat.html
#[stable(feature = "rust1", since = "1.0.0")]
#[macro_export]
#[cfg(dox)]
#[rustc_doc_only_macro]
macro_rules! concat {
($($e:expr),*) => ({ /* compiler built-in */ });
($($e:expr,)*) => ({ /* compiler built-in */ });
@@ -629,8 +624,7 @@ mod builtin {
///
/// [`std::line!`]: ../std/macro.line.html
#[stable(feature = "rust1", since = "1.0.0")]
#[macro_export]
#[cfg(dox)]
#[rustc_doc_only_macro]
macro_rules! line { () => ({ /* compiler built-in */ }) }

/// A macro which expands to the column number on which it was invoked.
@@ -639,8 +633,7 @@ mod builtin {
///
/// [`std::column!`]: ../std/macro.column.html
#[stable(feature = "rust1", since = "1.0.0")]
#[macro_export]
#[cfg(dox)]
#[rustc_doc_only_macro]
macro_rules! column { () => ({ /* compiler built-in */ }) }

/// A macro which expands to the file name from which it was invoked.
@@ -649,8 +642,7 @@ mod builtin {
///
/// [`std::file!`]: ../std/macro.file.html
#[stable(feature = "rust1", since = "1.0.0")]
#[macro_export]
#[cfg(dox)]
#[rustc_doc_only_macro]
macro_rules! file { () => ({ /* compiler built-in */ }) }

/// A macro which stringifies its arguments.
@@ -659,8 +651,7 @@ mod builtin {
///
/// [`std::stringify!`]: ../std/macro.stringify.html
#[stable(feature = "rust1", since = "1.0.0")]
#[macro_export]
#[cfg(dox)]
#[rustc_doc_only_macro]
macro_rules! stringify { ($($t:tt)*) => ({ /* compiler built-in */ }) }

/// Includes a utf8-encoded file as a string.
@@ -669,8 +660,7 @@ mod builtin {
///
/// [`std::include_str!`]: ../std/macro.include_str.html
#[stable(feature = "rust1", since = "1.0.0")]
#[macro_export]
#[cfg(dox)]
#[rustc_doc_only_macro]
macro_rules! include_str {
($file:expr) => ({ /* compiler built-in */ });
($file:expr,) => ({ /* compiler built-in */ });
@@ -682,8 +672,7 @@ mod builtin {
///
/// [`std::include_bytes!`]: ../std/macro.include_bytes.html
#[stable(feature = "rust1", since = "1.0.0")]
#[macro_export]
#[cfg(dox)]
#[rustc_doc_only_macro]
macro_rules! include_bytes {
($file:expr) => ({ /* compiler built-in */ });
($file:expr,) => ({ /* compiler built-in */ });
@@ -695,8 +684,7 @@ mod builtin {
///
/// [`std::module_path!`]: ../std/macro.module_path.html
#[stable(feature = "rust1", since = "1.0.0")]
#[macro_export]
#[cfg(dox)]
#[rustc_doc_only_macro]
macro_rules! module_path { () => ({ /* compiler built-in */ }) }

/// Boolean evaluation of configuration flags, at compile-time.
@@ -705,8 +693,7 @@ mod builtin {
///
/// [`std::cfg!`]: ../std/macro.cfg.html
#[stable(feature = "rust1", since = "1.0.0")]
#[macro_export]
#[cfg(dox)]
#[rustc_doc_only_macro]
macro_rules! cfg { ($($cfg:tt)*) => ({ /* compiler built-in */ }) }

/// Parse a file as an expression or an item according to the context.
@@ -715,8 +702,7 @@ mod builtin {
///
/// [`std::include!`]: ../std/macro.include.html
#[stable(feature = "rust1", since = "1.0.0")]
#[macro_export]
#[cfg(dox)]
#[rustc_doc_only_macro]
macro_rules! include {
($file:expr) => ({ /* compiler built-in */ });
($file:expr,) => ({ /* compiler built-in */ });
@@ -727,9 +713,8 @@ mod builtin {
/// For more information, see the documentation for [`std::assert!`].
///
/// [`std::assert!`]: ../std/macro.assert.html
#[macro_export]
#[rustc_doc_only_macro]
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg(dox)]
macro_rules! assert {
($cond:expr) => ({ /* compiler built-in */ });
($cond:expr,) => ({ /* compiler built-in */ });
2 changes: 1 addition & 1 deletion src/libcore/mem.rs
Original file line number Diff line number Diff line change
@@ -638,7 +638,7 @@ pub unsafe fn uninitialized<T>() -> T {
#[stable(feature = "rust1", since = "1.0.0")]
pub fn swap<T>(x: &mut T, y: &mut T) {
unsafe {
ptr::swap_nonoverlapping(x, y, 1);
ptr::swap_nonoverlapping_one(x, y);
}
}

23 changes: 23 additions & 0 deletions src/libcore/ptr.rs
Original file line number Diff line number Diff line change
@@ -187,6 +187,19 @@ pub unsafe fn swap_nonoverlapping<T>(x: *mut T, y: *mut T, count: usize) {
swap_nonoverlapping_bytes(x, y, len)
}

#[inline]
pub(crate) unsafe fn swap_nonoverlapping_one<T>(x: *mut T, y: *mut T) {
// For types smaller than the block optimization below,
// just swap directly to avoid pessimizing codegen.
if mem::size_of::<T>() < 32 {
let z = read(x);
copy_nonoverlapping(y, x, 1);
write(y, z);
} else {
swap_nonoverlapping(x, y, 1);
}
}

#[inline]
unsafe fn swap_nonoverlapping_bytes(x: *mut u8, y: *mut u8, len: usize) {
// The approach here is to utilize simd to swap x & y efficiently. Testing reveals
@@ -2703,6 +2716,11 @@ impl<T: Sized> Unique<T> {
///
/// This is useful for initializing types which lazily allocate, like
/// `Vec::new` does.
///
/// Note that the pointer value may potentially represent a valid pointer to
/// a `T`, which means this must not be used as a "not yet initialized"
/// sentinel value. Types that lazily allocate must track initialization by
/// some other means.
// FIXME: rename to dangling() to match NonNull?
pub const fn empty() -> Self {
unsafe {
@@ -2834,6 +2852,11 @@ impl<T: Sized> NonNull<T> {
///
/// This is useful for initializing types which lazily allocate, like
/// `Vec::new` does.
///
/// Note that the pointer value may potentially represent a valid pointer to
/// a `T`, which means this must not be used as a "not yet initialized"
/// sentinel value. Types that lazily allocate must track initialization by
/// some other means.
#[stable(feature = "nonnull", since = "1.25.0")]
pub fn dangling() -> Self {
unsafe {
Loading