Auto merge of #46482 - frewsxcv:rollup, r=frewsxcv
Rollup of 8 pull requests - Successful merges: #45957, #46260, #46432, #46442, #46454, #46462, #46465, #46473 - Failed merges:
This commit is contained in:
commit
fdfbcf85d5
@ -177,7 +177,7 @@ quasiquote as an ordinary plugin library.
|
||||
Plugins can extend [Rust's lint
|
||||
infrastructure](../reference/attributes.html#lint-check-attributes) with
|
||||
additional checks for code style, safety, etc. Now let's write a plugin
|
||||
[`lint_plugin_test.rs`](https://github.com/rust-lang/rust/blob/master/src/test/run-pass-fulldeps/auxiliary/lint_plugin_test.rs)
|
||||
[`lint_plugin_test.rs`](https://github.com/rust-lang/rust/blob/master/src/test/ui-fulldeps/auxiliary/lint_plugin_test.rs)
|
||||
that warns about any item named `lintme`.
|
||||
|
||||
```rust,ignore
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/python2.7
|
||||
#!/usr/bin/env python2.7
|
||||
#
|
||||
# Copyright 2015 The Rust Project Developers. See the COPYRIGHT
|
||||
# file at the top-level directory of this distribution and at
|
||||
|
@ -612,9 +612,10 @@ macro_rules! compile_error { ($msg:expr) => ({ /* compiler built-in */ }) }
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[macro_export]
|
||||
#[cfg(dox)]
|
||||
macro_rules! format_args { ($fmt:expr, $($args:tt)*) => ({
|
||||
/* compiler built-in */
|
||||
}) }
|
||||
macro_rules! format_args {
|
||||
($fmt:expr) => ({ /* compiler built-in */ });
|
||||
($fmt:expr, $($args:tt)*) => ({ /* compiler built-in */ });
|
||||
}
|
||||
|
||||
/// Inspect an environment variable at compile time.
|
||||
///
|
||||
@ -624,7 +625,10 @@ macro_rules! format_args { ($fmt:expr, $($args:tt)*) => ({
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[macro_export]
|
||||
#[cfg(dox)]
|
||||
macro_rules! env { ($name:expr) => ({ /* compiler built-in */ }) }
|
||||
macro_rules! env {
|
||||
($name:expr) => ({ /* compiler built-in */ });
|
||||
($name:expr,) => ({ /* compiler built-in */ });
|
||||
}
|
||||
|
||||
/// Optionally inspect an environment variable at compile time.
|
||||
///
|
||||
@ -645,7 +649,8 @@ macro_rules! option_env { ($name:expr) => ({ /* compiler built-in */ }) }
|
||||
#[macro_export]
|
||||
#[cfg(dox)]
|
||||
macro_rules! concat_idents {
|
||||
($($e:ident),*) => ({ /* compiler built-in */ })
|
||||
($($e:ident),*) => ({ /* compiler built-in */ });
|
||||
($($e:ident,)*) => ({ /* compiler built-in */ });
|
||||
}
|
||||
|
||||
/// Concatenates literals into a static string slice.
|
||||
@ -656,7 +661,10 @@ macro_rules! concat_idents {
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[macro_export]
|
||||
#[cfg(dox)]
|
||||
macro_rules! concat { ($($e:expr),*) => ({ /* compiler built-in */ }) }
|
||||
macro_rules! concat {
|
||||
($($e:expr),*) => ({ /* compiler built-in */ });
|
||||
($($e:expr,)*) => ({ /* compiler built-in */ });
|
||||
}
|
||||
|
||||
/// A macro which expands to the line number on which it was invoked.
|
||||
///
|
||||
|
@ -380,7 +380,7 @@ pub fn to_le(self) -> Self {
|
||||
if cfg!(target_endian = "little") { self } else { self.swap_bytes() }
|
||||
}
|
||||
|
||||
/// Checked integer addition. Computes `self + other`, returning `None`
|
||||
/// Checked integer addition. Computes `self + rhs`, returning `None`
|
||||
/// if overflow occurred.
|
||||
///
|
||||
/// # Examples
|
||||
@ -393,12 +393,12 @@ pub fn to_le(self) -> Self {
|
||||
/// ```
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
pub fn checked_add(self, other: Self) -> Option<Self> {
|
||||
let (a, b) = self.overflowing_add(other);
|
||||
pub fn checked_add(self, rhs: Self) -> Option<Self> {
|
||||
let (a, b) = self.overflowing_add(rhs);
|
||||
if b {None} else {Some(a)}
|
||||
}
|
||||
|
||||
/// Checked integer subtraction. Computes `self - other`, returning
|
||||
/// Checked integer subtraction. Computes `self - rhs`, returning
|
||||
/// `None` if underflow occurred.
|
||||
///
|
||||
/// # Examples
|
||||
@ -411,12 +411,12 @@ pub fn checked_add(self, other: Self) -> Option<Self> {
|
||||
/// ```
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
pub fn checked_sub(self, other: Self) -> Option<Self> {
|
||||
let (a, b) = self.overflowing_sub(other);
|
||||
pub fn checked_sub(self, rhs: Self) -> Option<Self> {
|
||||
let (a, b) = self.overflowing_sub(rhs);
|
||||
if b {None} else {Some(a)}
|
||||
}
|
||||
|
||||
/// Checked integer multiplication. Computes `self * other`, returning
|
||||
/// Checked integer multiplication. Computes `self * rhs`, returning
|
||||
/// `None` if underflow or overflow occurred.
|
||||
///
|
||||
/// # Examples
|
||||
@ -429,13 +429,13 @@ pub fn checked_sub(self, other: Self) -> Option<Self> {
|
||||
/// ```
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
pub fn checked_mul(self, other: Self) -> Option<Self> {
|
||||
let (a, b) = self.overflowing_mul(other);
|
||||
pub fn checked_mul(self, rhs: Self) -> Option<Self> {
|
||||
let (a, b) = self.overflowing_mul(rhs);
|
||||
if b {None} else {Some(a)}
|
||||
}
|
||||
|
||||
/// Checked integer division. Computes `self / other`, returning `None`
|
||||
/// if `other == 0` or the operation results in underflow or overflow.
|
||||
/// Checked integer division. Computes `self / rhs`, returning `None`
|
||||
/// if `rhs == 0` or the operation results in underflow or overflow.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
@ -448,16 +448,16 @@ pub fn checked_mul(self, other: Self) -> Option<Self> {
|
||||
/// ```
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
pub fn checked_div(self, other: Self) -> Option<Self> {
|
||||
if other == 0 || (self == Self::min_value() && other == -1) {
|
||||
pub fn checked_div(self, rhs: Self) -> Option<Self> {
|
||||
if rhs == 0 || (self == Self::min_value() && rhs == -1) {
|
||||
None
|
||||
} else {
|
||||
Some(unsafe { intrinsics::unchecked_div(self, other) })
|
||||
Some(unsafe { intrinsics::unchecked_div(self, rhs) })
|
||||
}
|
||||
}
|
||||
|
||||
/// Checked integer remainder. Computes `self % other`, returning `None`
|
||||
/// if `other == 0` or the operation results in underflow or overflow.
|
||||
/// Checked integer remainder. Computes `self % rhs`, returning `None`
|
||||
/// if `rhs == 0` or the operation results in underflow or overflow.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
@ -472,11 +472,11 @@ pub fn checked_div(self, other: Self) -> Option<Self> {
|
||||
/// ```
|
||||
#[stable(feature = "wrapping", since = "1.7.0")]
|
||||
#[inline]
|
||||
pub fn checked_rem(self, other: Self) -> Option<Self> {
|
||||
if other == 0 || (self == Self::min_value() && other == -1) {
|
||||
pub fn checked_rem(self, rhs: Self) -> Option<Self> {
|
||||
if rhs == 0 || (self == Self::min_value() && rhs == -1) {
|
||||
None
|
||||
} else {
|
||||
Some(unsafe { intrinsics::unchecked_rem(self, other) })
|
||||
Some(unsafe { intrinsics::unchecked_rem(self, rhs) })
|
||||
}
|
||||
}
|
||||
|
||||
@ -559,7 +559,7 @@ pub fn checked_abs(self) -> Option<Self> {
|
||||
}
|
||||
}
|
||||
|
||||
/// Saturating integer addition. Computes `self + other`, saturating at
|
||||
/// Saturating integer addition. Computes `self + rhs`, saturating at
|
||||
/// the numeric bounds instead of overflowing.
|
||||
///
|
||||
/// # Examples
|
||||
@ -572,15 +572,15 @@ pub fn checked_abs(self) -> Option<Self> {
|
||||
/// ```
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
pub fn saturating_add(self, other: Self) -> Self {
|
||||
match self.checked_add(other) {
|
||||
pub fn saturating_add(self, rhs: Self) -> Self {
|
||||
match self.checked_add(rhs) {
|
||||
Some(x) => x,
|
||||
None if other >= 0 => Self::max_value(),
|
||||
None if rhs >= 0 => Self::max_value(),
|
||||
None => Self::min_value(),
|
||||
}
|
||||
}
|
||||
|
||||
/// Saturating integer subtraction. Computes `self - other`, saturating
|
||||
/// Saturating integer subtraction. Computes `self - rhs`, saturating
|
||||
/// at the numeric bounds instead of overflowing.
|
||||
///
|
||||
/// # Examples
|
||||
@ -593,15 +593,15 @@ pub fn saturating_add(self, other: Self) -> Self {
|
||||
/// ```
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
pub fn saturating_sub(self, other: Self) -> Self {
|
||||
match self.checked_sub(other) {
|
||||
pub fn saturating_sub(self, rhs: Self) -> Self {
|
||||
match self.checked_sub(rhs) {
|
||||
Some(x) => x,
|
||||
None if other >= 0 => Self::min_value(),
|
||||
None if rhs >= 0 => Self::min_value(),
|
||||
None => Self::max_value(),
|
||||
}
|
||||
}
|
||||
|
||||
/// Saturating integer multiplication. Computes `self * other`,
|
||||
/// Saturating integer multiplication. Computes `self * rhs`,
|
||||
/// saturating at the numeric bounds instead of overflowing.
|
||||
///
|
||||
/// # Examples
|
||||
@ -617,9 +617,9 @@ pub fn saturating_sub(self, other: Self) -> Self {
|
||||
/// ```
|
||||
#[stable(feature = "wrapping", since = "1.7.0")]
|
||||
#[inline]
|
||||
pub fn saturating_mul(self, other: Self) -> Self {
|
||||
self.checked_mul(other).unwrap_or_else(|| {
|
||||
if (self < 0 && other < 0) || (self > 0 && other > 0) {
|
||||
pub fn saturating_mul(self, rhs: Self) -> Self {
|
||||
self.checked_mul(rhs).unwrap_or_else(|| {
|
||||
if (self < 0 && rhs < 0) || (self > 0 && rhs > 0) {
|
||||
Self::max_value()
|
||||
} else {
|
||||
Self::min_value()
|
||||
@ -627,7 +627,7 @@ pub fn saturating_mul(self, other: Self) -> Self {
|
||||
})
|
||||
}
|
||||
|
||||
/// Wrapping (modular) addition. Computes `self + other`,
|
||||
/// Wrapping (modular) addition. Computes `self + rhs`,
|
||||
/// wrapping around at the boundary of the type.
|
||||
///
|
||||
/// # Examples
|
||||
@ -646,7 +646,7 @@ pub fn wrapping_add(self, rhs: Self) -> Self {
|
||||
}
|
||||
}
|
||||
|
||||
/// Wrapping (modular) subtraction. Computes `self - other`,
|
||||
/// Wrapping (modular) subtraction. Computes `self - rhs`,
|
||||
/// wrapping around at the boundary of the type.
|
||||
///
|
||||
/// # Examples
|
||||
@ -666,7 +666,7 @@ pub fn wrapping_sub(self, rhs: Self) -> Self {
|
||||
}
|
||||
|
||||
/// Wrapping (modular) multiplication. Computes `self *
|
||||
/// other`, wrapping around at the boundary of the type.
|
||||
/// rhs`, wrapping around at the boundary of the type.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
@ -684,7 +684,7 @@ pub fn wrapping_mul(self, rhs: Self) -> Self {
|
||||
}
|
||||
}
|
||||
|
||||
/// Wrapping (modular) division. Computes `self / other`,
|
||||
/// Wrapping (modular) division. Computes `self / rhs`,
|
||||
/// wrapping around at the boundary of the type.
|
||||
///
|
||||
/// The only case where such wrapping can occur is when one
|
||||
@ -712,7 +712,7 @@ pub fn wrapping_div(self, rhs: Self) -> Self {
|
||||
self.overflowing_div(rhs).0
|
||||
}
|
||||
|
||||
/// Wrapping (modular) remainder. Computes `self % other`,
|
||||
/// Wrapping (modular) remainder. Computes `self % rhs`,
|
||||
/// wrapping around at the boundary of the type.
|
||||
///
|
||||
/// Such wrap-around never actually occurs mathematically;
|
||||
@ -1573,7 +1573,7 @@ pub fn to_le(self) -> Self {
|
||||
if cfg!(target_endian = "little") { self } else { self.swap_bytes() }
|
||||
}
|
||||
|
||||
/// Checked integer addition. Computes `self + other`, returning `None`
|
||||
/// Checked integer addition. Computes `self + rhs`, returning `None`
|
||||
/// if overflow occurred.
|
||||
///
|
||||
/// # Examples
|
||||
@ -1586,12 +1586,12 @@ pub fn to_le(self) -> Self {
|
||||
/// ```
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
pub fn checked_add(self, other: Self) -> Option<Self> {
|
||||
let (a, b) = self.overflowing_add(other);
|
||||
pub fn checked_add(self, rhs: Self) -> Option<Self> {
|
||||
let (a, b) = self.overflowing_add(rhs);
|
||||
if b {None} else {Some(a)}
|
||||
}
|
||||
|
||||
/// Checked integer subtraction. Computes `self - other`, returning
|
||||
/// Checked integer subtraction. Computes `self - rhs`, returning
|
||||
/// `None` if underflow occurred.
|
||||
///
|
||||
/// # Examples
|
||||
@ -1604,12 +1604,12 @@ pub fn checked_add(self, other: Self) -> Option<Self> {
|
||||
/// ```
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
pub fn checked_sub(self, other: Self) -> Option<Self> {
|
||||
let (a, b) = self.overflowing_sub(other);
|
||||
pub fn checked_sub(self, rhs: Self) -> Option<Self> {
|
||||
let (a, b) = self.overflowing_sub(rhs);
|
||||
if b {None} else {Some(a)}
|
||||
}
|
||||
|
||||
/// Checked integer multiplication. Computes `self * other`, returning
|
||||
/// Checked integer multiplication. Computes `self * rhs`, returning
|
||||
/// `None` if underflow or overflow occurred.
|
||||
///
|
||||
/// # Examples
|
||||
@ -1622,13 +1622,13 @@ pub fn checked_sub(self, other: Self) -> Option<Self> {
|
||||
/// ```
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
pub fn checked_mul(self, other: Self) -> Option<Self> {
|
||||
let (a, b) = self.overflowing_mul(other);
|
||||
pub fn checked_mul(self, rhs: Self) -> Option<Self> {
|
||||
let (a, b) = self.overflowing_mul(rhs);
|
||||
if b {None} else {Some(a)}
|
||||
}
|
||||
|
||||
/// Checked integer division. Computes `self / other`, returning `None`
|
||||
/// if `other == 0` or the operation results in underflow or overflow.
|
||||
/// Checked integer division. Computes `self / rhs`, returning `None`
|
||||
/// if `rhs == 0` or the operation results in underflow or overflow.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
@ -1640,15 +1640,15 @@ pub fn checked_mul(self, other: Self) -> Option<Self> {
|
||||
/// ```
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
pub fn checked_div(self, other: Self) -> Option<Self> {
|
||||
match other {
|
||||
pub fn checked_div(self, rhs: Self) -> Option<Self> {
|
||||
match rhs {
|
||||
0 => None,
|
||||
other => Some(unsafe { intrinsics::unchecked_div(self, other) }),
|
||||
rhs => Some(unsafe { intrinsics::unchecked_div(self, rhs) }),
|
||||
}
|
||||
}
|
||||
|
||||
/// Checked integer remainder. Computes `self % other`, returning `None`
|
||||
/// if `other == 0` or the operation results in underflow or overflow.
|
||||
/// Checked integer remainder. Computes `self % rhs`, returning `None`
|
||||
/// if `rhs == 0` or the operation results in underflow or overflow.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
@ -1660,11 +1660,11 @@ pub fn checked_div(self, other: Self) -> Option<Self> {
|
||||
/// ```
|
||||
#[stable(feature = "wrapping", since = "1.7.0")]
|
||||
#[inline]
|
||||
pub fn checked_rem(self, other: Self) -> Option<Self> {
|
||||
if other == 0 {
|
||||
pub fn checked_rem(self, rhs: Self) -> Option<Self> {
|
||||
if rhs == 0 {
|
||||
None
|
||||
} else {
|
||||
Some(unsafe { intrinsics::unchecked_rem(self, other) })
|
||||
Some(unsafe { intrinsics::unchecked_rem(self, rhs) })
|
||||
}
|
||||
}
|
||||
|
||||
@ -1724,7 +1724,7 @@ pub fn checked_shr(self, rhs: u32) -> Option<Self> {
|
||||
if b {None} else {Some(a)}
|
||||
}
|
||||
|
||||
/// Saturating integer addition. Computes `self + other`, saturating at
|
||||
/// Saturating integer addition. Computes `self + rhs`, saturating at
|
||||
/// the numeric bounds instead of overflowing.
|
||||
///
|
||||
/// # Examples
|
||||
@ -1737,14 +1737,14 @@ pub fn checked_shr(self, rhs: u32) -> Option<Self> {
|
||||
/// ```
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
pub fn saturating_add(self, other: Self) -> Self {
|
||||
match self.checked_add(other) {
|
||||
pub fn saturating_add(self, rhs: Self) -> Self {
|
||||
match self.checked_add(rhs) {
|
||||
Some(x) => x,
|
||||
None => Self::max_value(),
|
||||
}
|
||||
}
|
||||
|
||||
/// Saturating integer subtraction. Computes `self - other`, saturating
|
||||
/// Saturating integer subtraction. Computes `self - rhs`, saturating
|
||||
/// at the numeric bounds instead of overflowing.
|
||||
///
|
||||
/// # Examples
|
||||
@ -1757,14 +1757,14 @@ pub fn saturating_add(self, other: Self) -> Self {
|
||||
/// ```
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
pub fn saturating_sub(self, other: Self) -> Self {
|
||||
match self.checked_sub(other) {
|
||||
pub fn saturating_sub(self, rhs: Self) -> Self {
|
||||
match self.checked_sub(rhs) {
|
||||
Some(x) => x,
|
||||
None => Self::min_value(),
|
||||
}
|
||||
}
|
||||
|
||||
/// Saturating integer multiplication. Computes `self * other`,
|
||||
/// Saturating integer multiplication. Computes `self * rhs`,
|
||||
/// saturating at the numeric bounds instead of overflowing.
|
||||
///
|
||||
/// # Examples
|
||||
@ -1779,11 +1779,11 @@ pub fn saturating_sub(self, other: Self) -> Self {
|
||||
/// ```
|
||||
#[stable(feature = "wrapping", since = "1.7.0")]
|
||||
#[inline]
|
||||
pub fn saturating_mul(self, other: Self) -> Self {
|
||||
self.checked_mul(other).unwrap_or(Self::max_value())
|
||||
pub fn saturating_mul(self, rhs: Self) -> Self {
|
||||
self.checked_mul(rhs).unwrap_or(Self::max_value())
|
||||
}
|
||||
|
||||
/// Wrapping (modular) addition. Computes `self + other`,
|
||||
/// Wrapping (modular) addition. Computes `self + rhs`,
|
||||
/// wrapping around at the boundary of the type.
|
||||
///
|
||||
/// # Examples
|
||||
@ -1802,7 +1802,7 @@ pub fn wrapping_add(self, rhs: Self) -> Self {
|
||||
}
|
||||
}
|
||||
|
||||
/// Wrapping (modular) subtraction. Computes `self - other`,
|
||||
/// Wrapping (modular) subtraction. Computes `self - rhs`,
|
||||
/// wrapping around at the boundary of the type.
|
||||
///
|
||||
/// # Examples
|
||||
@ -1822,7 +1822,7 @@ pub fn wrapping_sub(self, rhs: Self) -> Self {
|
||||
}
|
||||
|
||||
/// Wrapping (modular) multiplication. Computes `self *
|
||||
/// other`, wrapping around at the boundary of the type.
|
||||
/// rhs`, wrapping around at the boundary of the type.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
@ -1840,7 +1840,7 @@ pub fn wrapping_mul(self, rhs: Self) -> Self {
|
||||
}
|
||||
}
|
||||
|
||||
/// Wrapping (modular) division. Computes `self / other`.
|
||||
/// Wrapping (modular) division. Computes `self / rhs`.
|
||||
/// Wrapped division on unsigned types is just normal division.
|
||||
/// There's no way wrapping could ever happen.
|
||||
/// This function exists, so that all operations
|
||||
@ -1859,7 +1859,7 @@ pub fn wrapping_div(self, rhs: Self) -> Self {
|
||||
self / rhs
|
||||
}
|
||||
|
||||
/// Wrapping (modular) remainder. Computes `self % other`.
|
||||
/// Wrapping (modular) remainder. Computes `self % rhs`.
|
||||
/// Wrapped remainder calculation on unsigned types is
|
||||
/// just the regular remainder calculation.
|
||||
/// There's no way wrapping could ever happen.
|
||||
|
@ -1053,8 +1053,6 @@ fn parse_optimization_fuel(slot: &mut Option<(String, u64)>, v: Option<&str>) ->
|
||||
save_analysis: bool = (false, parse_bool, [UNTRACKED],
|
||||
"write syntax and type analysis (in JSON format) information, in \
|
||||
addition to normal output"),
|
||||
print_move_fragments: bool = (false, parse_bool, [UNTRACKED],
|
||||
"print out move-fragment data for every fn"),
|
||||
flowgraph_print_loans: bool = (false, parse_bool, [UNTRACKED],
|
||||
"include loan analysis data in --unpretty flowgraph output"),
|
||||
flowgraph_print_moves: bool = (false, parse_bool, [UNTRACKED],
|
||||
@ -2684,8 +2682,6 @@ fn test_debugging_options_tracking_hash() {
|
||||
assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
|
||||
opts.debugging_opts.save_analysis = true;
|
||||
assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
|
||||
opts.debugging_opts.print_move_fragments = true;
|
||||
assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
|
||||
opts.debugging_opts.flowgraph_print_loans = true;
|
||||
assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
|
||||
opts.debugging_opts.flowgraph_print_moves = true;
|
||||
|
@ -239,10 +239,13 @@ fn local_copy(mir: &Mir<'tcx>, def_use_analysis: &DefUseAnalysis, src_place: &Pl
|
||||
// USE(SRC);
|
||||
let src_def_count = src_use_info.def_count_not_including_drop();
|
||||
// allow function arguments to be propagated
|
||||
if src_def_count > 1 ||
|
||||
(src_def_count == 0 && mir.local_kind(src_local) != LocalKind::Arg) {
|
||||
debug!(" Can't copy-propagate local: {} defs of src",
|
||||
src_use_info.def_count_not_including_drop());
|
||||
let is_arg = mir.local_kind(src_local) == LocalKind::Arg;
|
||||
if (is_arg && src_def_count != 0) || (!is_arg && src_def_count != 1) {
|
||||
debug!(
|
||||
" Can't copy-propagate local: {} defs of src{}",
|
||||
src_def_count,
|
||||
if is_arg { " (argument)" } else { "" },
|
||||
);
|
||||
return None
|
||||
}
|
||||
|
||||
|
@ -179,6 +179,7 @@ nav.sub {
|
||||
top: 0;
|
||||
height: 100vh;
|
||||
overflow: auto;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.sidebar .current {
|
||||
|
@ -325,9 +325,10 @@ macro_rules! compile_error { ($msg:expr) => ({ /* compiler built-in */ }) }
|
||||
/// ```
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[macro_export]
|
||||
macro_rules! format_args { ($fmt:expr, $($args:tt)*) => ({
|
||||
/* compiler built-in */
|
||||
}) }
|
||||
macro_rules! format_args {
|
||||
($fmt:expr) => ({ /* compiler built-in */ });
|
||||
($fmt:expr, $($args:tt)*) => ({ /* compiler built-in */ });
|
||||
}
|
||||
|
||||
/// Inspect an environment variable at compile time.
|
||||
///
|
||||
@ -348,7 +349,10 @@ macro_rules! format_args { ($fmt:expr, $($args:tt)*) => ({
|
||||
/// ```
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[macro_export]
|
||||
macro_rules! env { ($name:expr) => ({ /* compiler built-in */ }) }
|
||||
macro_rules! env {
|
||||
($name:expr) => ({ /* compiler built-in */ });
|
||||
($name:expr,) => ({ /* compiler built-in */ });
|
||||
}
|
||||
|
||||
/// Optionally inspect an environment variable at compile time.
|
||||
///
|
||||
@ -400,7 +404,8 @@ macro_rules! option_env { ($name:expr) => ({ /* compiler built-in */ }) }
|
||||
#[unstable(feature = "concat_idents_macro", issue = "29599")]
|
||||
#[macro_export]
|
||||
macro_rules! concat_idents {
|
||||
($($e:ident),*) => ({ /* compiler built-in */ })
|
||||
($($e:ident),*) => ({ /* compiler built-in */ });
|
||||
($($e:ident,)*) => ({ /* compiler built-in */ });
|
||||
}
|
||||
|
||||
/// Concatenates literals into a static string slice.
|
||||
@ -420,7 +425,10 @@ macro_rules! concat_idents {
|
||||
/// ```
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[macro_export]
|
||||
macro_rules! concat { ($($e:expr),*) => ({ /* compiler built-in */ }) }
|
||||
macro_rules! concat {
|
||||
($($e:expr),*) => ({ /* compiler built-in */ });
|
||||
($($e:expr,)*) => ({ /* compiler built-in */ });
|
||||
}
|
||||
|
||||
/// A macro which expands to the line number on which it was invoked.
|
||||
///
|
||||
|
@ -1461,7 +1461,7 @@ pub struct DecodeUtf16<I>
|
||||
buf: Option<u16>,
|
||||
}
|
||||
|
||||
/// An iterator that decodes UTF-16 encoded code points from an iterator of `u16`s.
|
||||
/// An error that can be returned when decoding UTF-16 code points.
|
||||
#[stable(feature = "decode_utf16", since = "1.9.0")]
|
||||
#[derive(Debug, Clone, Eq, PartialEq)]
|
||||
pub struct DecodeUtf16Error {
|
||||
|
@ -30,42 +30,43 @@ fn baz(mut x: i32) {
|
||||
x = x;
|
||||
}
|
||||
|
||||
fn arg_src(mut x: i32) -> i32 {
|
||||
let y = x;
|
||||
x = 123; // Don't propagate this assignment to `y`
|
||||
y
|
||||
}
|
||||
|
||||
fn main() {
|
||||
// Make sure the function actually gets instantiated.
|
||||
foo(0);
|
||||
bar(0);
|
||||
baz(0);
|
||||
arg_src(0);
|
||||
}
|
||||
|
||||
// END RUST SOURCE
|
||||
// START rustc.foo.CopyPropagation.before.mir
|
||||
// bb0: {
|
||||
// StorageLive(_2);
|
||||
// StorageLive(_3);
|
||||
// ...
|
||||
// _3 = _1;
|
||||
// _2 = const dummy(move _3) -> bb1;
|
||||
// }
|
||||
// bb1: {
|
||||
// StorageDead(_3);
|
||||
// ...
|
||||
// _1 = move _2;
|
||||
// StorageDead(_2);
|
||||
// _0 = ();
|
||||
// return;
|
||||
// ...
|
||||
// }
|
||||
// END rustc.foo.CopyPropagation.before.mir
|
||||
// START rustc.foo.CopyPropagation.after.mir
|
||||
// bb0: {
|
||||
// StorageLive(_2);
|
||||
// nop;
|
||||
// nop;
|
||||
// _2 = const dummy(move _1) -> bb1;
|
||||
// ...
|
||||
// _3 = _1;
|
||||
// _2 = const dummy(move _3) -> bb1;
|
||||
// }
|
||||
// bb1: {
|
||||
// nop;
|
||||
// ...
|
||||
// _1 = move _2;
|
||||
// StorageDead(_2);
|
||||
// _0 = ();
|
||||
// return;
|
||||
// ...
|
||||
// }
|
||||
// END rustc.foo.CopyPropagation.after.mir
|
||||
// START rustc.bar.CopyPropagation.before.mir
|
||||
@ -83,15 +84,14 @@ fn main() {
|
||||
// END rustc.bar.CopyPropagation.before.mir
|
||||
// START rustc.bar.CopyPropagation.after.mir
|
||||
// bb0: {
|
||||
// nop;
|
||||
// nop;
|
||||
// _2 = const dummy(move _1) -> bb1;
|
||||
// ...
|
||||
// _3 = _1;
|
||||
// _2 = const dummy(move _3) -> bb1;
|
||||
// }
|
||||
// bb1: {
|
||||
// nop;
|
||||
// ...
|
||||
// _1 = const 5u8;
|
||||
// _0 = ();
|
||||
// return;
|
||||
// ...
|
||||
// }
|
||||
// END rustc.bar.CopyPropagation.after.mir
|
||||
// START rustc.baz.CopyPropagation.before.mir
|
||||
@ -106,11 +106,35 @@ fn main() {
|
||||
// END rustc.baz.CopyPropagation.before.mir
|
||||
// START rustc.baz.CopyPropagation.after.mir
|
||||
// bb0: {
|
||||
// nop;
|
||||
// nop;
|
||||
// nop;
|
||||
// nop;
|
||||
// _0 = ();
|
||||
// return;
|
||||
// ...
|
||||
// _2 = _1;
|
||||
// _1 = move _2;
|
||||
// ...
|
||||
// }
|
||||
// END rustc.baz.CopyPropagation.after.mir
|
||||
// START rustc.arg_src.CopyPropagation.before.mir
|
||||
// bb0: {
|
||||
// ...
|
||||
// _3 = _1;
|
||||
// _2 = move _3;
|
||||
// ...
|
||||
// _1 = const 123i32;
|
||||
// ...
|
||||
// _4 = _2;
|
||||
// _0 = move _4;
|
||||
// ...
|
||||
// return;
|
||||
// }
|
||||
// END rustc.arg_src.CopyPropagation.before.mir
|
||||
// START rustc.arg_src.CopyPropagation.after.mir
|
||||
// bb0: {
|
||||
// ...
|
||||
// _3 = _1;
|
||||
// ...
|
||||
// _1 = const 123i32;
|
||||
// ...
|
||||
// _0 = move _3;
|
||||
// ...
|
||||
// return;
|
||||
// }
|
||||
// END rustc.arg_src.CopyPropagation.after.mir
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# Copyright 2015 The Rust Project Developers. See the COPYRIGHT
|
||||
# file at the top-level directory of this distribution and at
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# Copyright 2015 The Rust Project Developers. See the COPYRIGHT
|
||||
# file at the top-level directory of this distribution and at
|
||||
|
Loading…
Reference in New Issue
Block a user