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 9 pull requests #61789

Merged
merged 20 commits into from
Jun 13, 2019
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
be6fc6a
Stabilize copy_within
kennytm May 31, 2019
aac9bc5
copy_within: replace element access by pointer arithmetic to avoid UB
kennytm Jun 2, 2019
427f1a4
Update src/libcore/tests/slice.rs
kennytm Jun 3, 2019
1fa50b3
Stabilize Option::xor
tesuji May 27, 2019
493d1b4
Include frame pointer for bare metal RISC-V targets
fintelia Jun 8, 2019
4f3cd3c
Fix x.py install
tmandry Jun 11, 2019
e7b5586
rustbuild: fix libtest_stamp
Keruspe Jun 5, 2019
2cd516c
ci: fix ci stats upload condition
pietroalbini Jun 12, 2019
b8f1491
Fix typos
JohnTitor Jun 12, 2019
eb09daa
Hygienize macros in the standard library
petrochenkov Jun 7, 2019
7c8644d
Add an alias for x86_64-sun-solaris target tuple
tesuji Jun 12, 2019
b35aeae
Rollup merge of #60376 - lzutao:stabilize-option_xor, r=SimonSapin
Centril Jun 12, 2019
a1ff450
Rollup merge of #61398 - kennytm:stabilize-copy-within, r=SimonSapin
Centril Jun 12, 2019
96b5830
Rollup merge of #61629 - petrochenkov:stdmac, r=alexcrichton
Centril Jun 12, 2019
0d8d08d
Rollup merge of #61675 - fintelia:riscv-frame-pointer, r=nagisa
Centril Jun 12, 2019
4cbae09
Rollup merge of #61750 - tmandry:fix-install, r=Mark-Simulacrum
Centril Jun 12, 2019
b03ffbc
Rollup merge of #61761 - lzutao:target-tuple-solaris, r=varkor
Centril Jun 12, 2019
555b2d9
Rollup merge of #61762 - Keruspe:rustbuild-libtest-fix, r=Mark-Simula…
Centril Jun 12, 2019
3272e6e
Rollup merge of #61763 - pietroalbini:azure-fix-condition, r=alexcric…
Centril Jun 12, 2019
af281d2
Rollup merge of #61776 - JohnTitor:fix-typo-in-error-codes, r=Centril
Centril Jun 12, 2019
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 .azure-pipelines/steps/run.yml
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,6 @@ steps:
- bash: aws s3 cp --acl public-read cpu-usage.csv s3://$DEPLOY_BUCKET/rustc-builds/$BUILD_SOURCEVERSION/cpu-$SYSTEM_JOBNAME.csv
env:
AWS_SECRET_ACCESS_KEY: $(AWS_SECRET_ACCESS_KEY)
condition: contains(variables, 'AWS_SECRET_ACCESS_KEY')
condition: variables['AWS_SECRET_ACCESS_KEY']
continueOnError: true
displayName: Upload CPU usage statistics
2 changes: 1 addition & 1 deletion src/bootstrap/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -787,7 +787,7 @@ impl<'a> Builder<'a> {

let libtest_stamp = match cmd {
"check" | "clippy" | "fix" => check::libtest_stamp(self, cmp, target),
_ => compile::libstd_stamp(self, cmp, target),
_ => compile::libtest_stamp(self, cmp, target),
};

let librustc_stamp = match cmd {
Expand Down
5 changes: 4 additions & 1 deletion src/bootstrap/install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,10 @@ install!((self, builder, _config),
};
Analysis, "analysis", Self::should_build(_config), only_hosts: false, {
builder.ensure(dist::Analysis {
compiler: self.compiler,
// Find the actual compiler (handling the full bootstrap option) which
// produced the save-analysis data because that data isn't copied
// through the sysroot uplifting.
compiler: builder.compiler_for(builder.top_stage, builder.config.build, self.target),
target: self.target
});
install_analysis(builder, self.compiler.stage, self.target);
Expand Down
2 changes: 1 addition & 1 deletion src/liballoc/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ macro_rules! vec {
($($x:expr),*) => (
<[_]>::into_vec(box [$($x),*])
);
($($x:expr,)*) => (vec![$($x),*])
($($x:expr,)*) => ($crate::vec![$($x),*])
}

// HACK(japaric): with cfg(test) the inherent `[T]::into_vec` method, which is
Expand Down
22 changes: 11 additions & 11 deletions src/libcore/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
#[stable(feature = "core", since = "1.6.0")]
macro_rules! panic {
() => (
panic!("explicit panic")
$crate::panic!("explicit panic")
);
($msg:expr) => ({
$crate::panicking::panic(&($msg, file!(), line!(), __rust_unstable_column!()))
});
($msg:expr,) => (
panic!($msg)
$crate::panic!($msg)
);
($fmt:expr, $($arg:tt)+) => ({
$crate::panicking::panic_fmt(format_args!($fmt, $($arg)*),
Expand Down Expand Up @@ -58,7 +58,7 @@ macro_rules! assert_eq {
}
});
($left:expr, $right:expr,) => ({
assert_eq!($left, $right)
$crate::assert_eq!($left, $right)
});
($left:expr, $right:expr, $($arg:tt)+) => ({
match (&($left), &($right)) {
Expand Down Expand Up @@ -115,7 +115,7 @@ macro_rules! assert_ne {
}
});
($left:expr, $right:expr,) => {
assert_ne!($left, $right)
$crate::assert_ne!($left, $right)
};
($left:expr, $right:expr, $($arg:tt)+) => ({
match (&($left), &($right)) {
Expand Down Expand Up @@ -208,7 +208,7 @@ macro_rules! debug_assert {
#[macro_export]
#[stable(feature = "rust1", since = "1.0.0")]
macro_rules! debug_assert_eq {
($($arg:tt)*) => (if cfg!(debug_assertions) { assert_eq!($($arg)*); })
($($arg:tt)*) => (if cfg!(debug_assertions) { $crate::assert_eq!($($arg)*); })
}

/// Asserts that two expressions are not equal to each other.
Expand All @@ -235,7 +235,7 @@ macro_rules! debug_assert_eq {
#[macro_export]
#[stable(feature = "assert_ne", since = "1.13.0")]
macro_rules! debug_assert_ne {
($($arg:tt)*) => (if cfg!(debug_assertions) { assert_ne!($($arg)*); })
($($arg:tt)*) => (if cfg!(debug_assertions) { $crate::assert_ne!($($arg)*); })
}

/// Unwraps a result or propagates its error.
Expand Down Expand Up @@ -310,7 +310,7 @@ macro_rules! r#try {
return $crate::result::Result::Err($crate::convert::From::from(err))
}
});
($expr:expr,) => (r#try!($expr));
($expr:expr,) => ($crate::r#try!($expr));
}

/// Writes formatted data into a buffer.
Expand Down Expand Up @@ -425,10 +425,10 @@ macro_rules! write {
#[allow_internal_unstable(format_args_nl)]
macro_rules! writeln {
($dst:expr) => (
write!($dst, "\n")
$crate::write!($dst, "\n")
);
($dst:expr,) => (
writeln!($dst)
$crate::writeln!($dst)
);
($dst:expr, $($arg:tt)*) => (
$dst.write_fmt(format_args_nl!($($arg)*))
Expand Down Expand Up @@ -494,10 +494,10 @@ macro_rules! unreachable {
panic!("internal error: entered unreachable code")
});
($msg:expr) => ({
unreachable!("{}", $msg)
$crate::unreachable!("{}", $msg)
});
($msg:expr,) => ({
unreachable!($msg)
$crate::unreachable!($msg)
});
($fmt:expr, $($arg:tt)*) => ({
panic!(concat!("internal error: entered unreachable code: ", $fmt), $($arg)*)
Expand Down
4 changes: 1 addition & 3 deletions src/libcore/option.rs
Original file line number Diff line number Diff line change
Expand Up @@ -725,8 +725,6 @@ impl<T> Option<T> {
/// # Examples
///
/// ```
/// #![feature(option_xor)]
///
/// let x = Some(2);
/// let y: Option<u32> = None;
/// assert_eq!(x.xor(y), Some(2));
Expand All @@ -744,7 +742,7 @@ impl<T> Option<T> {
/// assert_eq!(x.xor(y), None);
/// ```
#[inline]
#[unstable(feature = "option_xor", issue = "50512")]
#[stable(feature = "option_xor", since = "1.37.0")]
pub fn xor(self, optb: Option<T>) -> Option<T> {
match (self, optb) {
(Some(a), None) => Some(a),
Expand Down
7 changes: 3 additions & 4 deletions src/libcore/slice/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2146,14 +2146,13 @@ impl<T> [T] {
/// 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")]
#[stable(feature = "copy_within", since = "1.37.0")]
pub fn copy_within<R: ops::RangeBounds<usize>>(&mut self, src: R, dest: usize)
where
T: Copy,
Expand All @@ -2178,8 +2177,8 @@ impl<T> [T] {
assert!(dest <= self.len() - count, "dest is out of bounds");
unsafe {
ptr::copy(
self.get_unchecked(src_start),
self.get_unchecked_mut(dest),
self.as_ptr().add(src_start),
self.as_mut_ptr().add(dest),
count,
);
}
Expand Down
1 change: 0 additions & 1 deletion src/libcore/tests/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
#![feature(inner_deref)]
#![feature(slice_internals)]
#![feature(slice_partition_dedup)]
#![feature(copy_within)]
#![feature(int_error_matching)]
#![feature(const_fn)]
#![warn(rust_2018_idioms)]
Expand Down
14 changes: 14 additions & 0 deletions src/libcore/tests/slice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1512,6 +1512,13 @@ fn test_copy_within() {
let mut bytes = *b"Hello, World!";
bytes.copy_within(.., 0);
assert_eq!(&bytes, b"Hello, World!");

// Ensure that copying at the end of slice won't cause UB.
let mut bytes = *b"Hello, World!";
bytes.copy_within(13..13, 5);
assert_eq!(&bytes, b"Hello, World!");
bytes.copy_within(5..5, 13);
assert_eq!(&bytes, b"Hello, World!");
}

#[test]
Expand All @@ -1536,6 +1543,13 @@ fn test_copy_within_panics_src_inverted() {
// 2 is greater than 1, so this range is invalid.
bytes.copy_within(2..1, 0);
}
#[test]
#[should_panic(expected = "attempted to index slice up to maximum usize")]
fn test_copy_within_panics_src_out_of_bounds() {
let mut bytes = *b"Hello, World!";
// an inclusive range ending at usize::max_value() would make src_end overflow
bytes.copy_within(usize::max_value()..=usize::max_value(), 0);
}

#[test]
fn test_is_sorted() {
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/error_codes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1883,7 +1883,7 @@ This pattern should be rewritten. There are a few possible ways to do this:
# }
```

The same applies to transmutes to `*mut fn()`, which were observedin practice.
The same applies to transmutes to `*mut fn()`, which were observed in practice.
Note though that use of this type is generally incorrect.
The intention is typically to describe a function pointer, but just `fn()`
alone suffices for that. `*mut fn()` is a pointer to a fn pointer.
Expand Down
18 changes: 10 additions & 8 deletions src/librustc_target/spec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -268,16 +268,16 @@ pub type LinkArgs = BTreeMap<LinkerFlavor, Vec<String>>;
pub type TargetResult = Result<Target, String>;

macro_rules! supported_targets {
( $(($triple:expr, $module:ident),)+ ) => (
$(mod $module;)*
( $(($( $triple:literal, )+ $module:ident ),)+ ) => {
$(mod $module;)+

/// List of supported targets
const TARGETS: &[&str] = &[$($triple),*];
const TARGETS: &[&str] = &[$($($triple),+),+];

fn load_specific(target: &str) -> Result<Target, LoadTargetError> {
match target {
$(
$triple => {
$($triple)|+ => {
let mut t = $module::target()
.map_err(LoadTargetError::Other)?;
t.options.is_builtin = true;
Expand Down Expand Up @@ -307,7 +307,7 @@ macro_rules! supported_targets {
mod test_json_encode_decode {
use serialize::json::ToJson;
use super::Target;
$(use super::$module;)*
$(use super::$module;)+

$(
#[test]
Expand All @@ -322,9 +322,9 @@ macro_rules! supported_targets {
assert_eq!(original, parsed);
});
}
)*
)+
}
)
};
}

supported_targets! {
Expand Down Expand Up @@ -426,7 +426,9 @@ supported_targets! {
("armv7r-none-eabi", armv7r_none_eabi),
("armv7r-none-eabihf", armv7r_none_eabihf),

("x86_64-sun-solaris", x86_64_sun_solaris),
// `x86_64-pc-solaris` is an alias for `x86_64_sun_solaris` for backwards compatibility reasons.
// (See <https://github.com/rust-lang/rust/issues/40531>.)
("x86_64-sun-solaris", "x86_64-pc-solaris", x86_64_sun_solaris),
("sparcv9-sun-solaris", sparcv9_sun_solaris),

("x86_64-pc-windows-gnu", x86_64_pc_windows_gnu),
Expand Down
1 change: 1 addition & 0 deletions src/librustc_target/spec/riscv32imac_unknown_none_elf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ pub fn target() -> TargetResult {
relocation_model: "static".to_string(),
emit_debug_gdb_scripts: false,
abi_blacklist: super::riscv_base::abi_blacklist(),
eliminate_frame_pointer: false,
.. Default::default()
},
})
Expand Down
1 change: 1 addition & 0 deletions src/librustc_target/spec/riscv32imc_unknown_none_elf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ pub fn target() -> TargetResult {
relocation_model: "static".to_string(),
emit_debug_gdb_scripts: false,
abi_blacklist: super::riscv_base::abi_blacklist(),
eliminate_frame_pointer: false,
.. Default::default()
},
})
Expand Down
1 change: 1 addition & 0 deletions src/librustc_target/spec/riscv64gc_unknown_none_elf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ pub fn target() -> TargetResult {
relocation_model: "static".to_string(),
emit_debug_gdb_scripts: false,
abi_blacklist: super::riscv_base::abi_blacklist(),
eliminate_frame_pointer: false,
.. Default::default()
},
})
Expand Down
1 change: 1 addition & 0 deletions src/librustc_target/spec/riscv64imac_unknown_none_elf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ pub fn target() -> TargetResult {
relocation_model: "static".to_string(),
emit_debug_gdb_scripts: false,
abi_blacklist: super::riscv_base::abi_blacklist(),
eliminate_frame_pointer: false,
.. Default::default()
},
})
Expand Down
16 changes: 8 additions & 8 deletions src/libstd/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,13 @@
#[allow_internal_unstable(__rust_unstable_column, libstd_sys_internals)]
macro_rules! panic {
() => ({
panic!("explicit panic")
$crate::panic!("explicit panic")
});
($msg:expr) => ({
$crate::rt::begin_panic($msg, &(file!(), line!(), __rust_unstable_column!()))
});
($msg:expr,) => ({
panic!($msg)
$crate::panic!($msg)
});
($fmt:expr, $($arg:tt)+) => ({
$crate::rt::begin_panic_fmt(&format_args!($fmt, $($arg)+),
Expand Down Expand Up @@ -145,7 +145,7 @@ macro_rules! print {
#[stable(feature = "rust1", since = "1.0.0")]
#[allow_internal_unstable(print_internals, format_args_nl)]
macro_rules! println {
() => (print!("\n"));
() => ($crate::print!("\n"));
($($arg:tt)*) => ({
$crate::io::_print(format_args_nl!($($arg)*));
})
Expand Down Expand Up @@ -204,7 +204,7 @@ macro_rules! eprint {
#[stable(feature = "eprint", since = "1.19.0")]
#[allow_internal_unstable(print_internals, format_args_nl)]
macro_rules! eprintln {
() => (eprint!("\n"));
() => ($crate::eprint!("\n"));
($($arg:tt)*) => ({
$crate::io::_eprint(format_args_nl!($($arg)*));
})
Expand Down Expand Up @@ -337,23 +337,23 @@ macro_rules! eprintln {
#[stable(feature = "dbg_macro", since = "1.32.0")]
macro_rules! dbg {
() => {
eprintln!("[{}:{}]", file!(), line!());
$crate::eprintln!("[{}:{}]", file!(), line!());
};
($val:expr) => {
// Use of `match` here is intentional because it affects the lifetimes
// of temporaries - https://stackoverflow.com/a/48732525/1063961
match $val {
tmp => {
eprintln!("[{}:{}] {} = {:#?}",
$crate::eprintln!("[{}:{}] {} = {:#?}",
file!(), line!(), stringify!($val), &tmp);
tmp
}
}
};
// Trailing comma with single argument is ignored
($val:expr,) => { dbg!($val) };
($val:expr,) => { $crate::dbg!($val) };
($($val:expr),+ $(,)?) => {
($(dbg!($val)),+,)
($($crate::dbg!($val)),+,)
};
}

Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/explain.stdout
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ This pattern should be rewritten. There are a few possible ways to do this:
let f: extern "C" fn(*mut i32) = transmute(foo as usize); // works too
```

The same applies to transmutes to `*mut fn()`, which were observedin practice.
The same applies to transmutes to `*mut fn()`, which were observed in practice.
Note though that use of this type is generally incorrect.
The intention is typically to describe a function pointer, but just `fn()`
alone suffices for that. `*mut fn()` is a pointer to a fn pointer.
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/hygiene/no_implicit_prelude.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ mod bar {
}
fn f() {
::foo::m!();
println!(); //~ ERROR cannot find macro `print!` in this scope
assert_eq!(0, 0); //~ ERROR cannot find macro `panic!` in this scope
}
}

Expand Down
6 changes: 3 additions & 3 deletions src/test/ui/hygiene/no_implicit_prelude.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ LL | fn f() { ::bar::m!(); }
LL | Vec::new();
| ^^^ use of undeclared type or module `Vec`

error: cannot find macro `print!` in this scope
error: cannot find macro `panic!` in this scope
--> $DIR/no_implicit_prelude.rs:16:9
|
LL | println!();
| ^^^^^^^^^^^
LL | assert_eq!(0, 0);
| ^^^^^^^^^^^^^^^^^
|
= help: have you added the `#[macro_use]` on the module/import?
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
Expand Down
Loading