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 6 pull requests #61868

Merged
merged 13 commits into from
Jun 15, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
8 changes: 4 additions & 4 deletions src/libcore/benches/ascii.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ benches! {
fn case11_mask_mult_bool_match_range(bytes: &mut [u8]) {
fn is_ascii_lowercase(b: u8) -> bool {
match b {
b'a'...b'z' => true,
b'a'..=b'z' => true,
_ => false
}
}
Expand All @@ -203,7 +203,7 @@ benches! {
fn case12_mask_shifted_bool_match_range(bytes: &mut [u8]) {
fn is_ascii_lowercase(b: u8) -> bool {
match b {
b'a'...b'z' => true,
b'a'..=b'z' => true,
_ => false
}
}
Expand All @@ -215,7 +215,7 @@ benches! {
fn case13_subtract_shifted_bool_match_range(bytes: &mut [u8]) {
fn is_ascii_lowercase(b: u8) -> bool {
match b {
b'a'...b'z' => true,
b'a'..=b'z' => true,
_ => false
}
}
Expand All @@ -227,7 +227,7 @@ benches! {
fn case14_subtract_multiplied_bool_match_range(bytes: &mut [u8]) {
fn is_ascii_lowercase(b: u8) -> bool {
match b {
b'a'...b'z' => true,
b'a'..=b'z' => true,
_ => false
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/libcore/char/convert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ impl From<char> for u32 {
}
}

/// Maps a byte in 0x00...0xFF to a `char` whose code point has the same value, in U+0000 to U+00FF.
/// Maps a byte in 0x00..=0xFF to a `char` whose code point has the same value, in U+0000..=U+00FF.
///
/// Unicode is designed such that this effectively decodes bytes
/// with the character encoding that IANA calls ISO-8859-1.
Expand Down
34 changes: 17 additions & 17 deletions src/libcore/char/methods.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1042,8 +1042,8 @@ impl char {

/// Checks if the value is an ASCII alphabetic character:
///
/// - U+0041 'A' ... U+005A 'Z', or
/// - U+0061 'a' ... U+007A 'z'.
/// - U+0041 'A' ..= U+005A 'Z', or
/// - U+0061 'a' ..= U+007A 'z'.
///
/// # Examples
///
Expand Down Expand Up @@ -1075,7 +1075,7 @@ impl char {
}

/// Checks if the value is an ASCII uppercase character:
/// U+0041 'A' ... U+005A 'Z'.
/// U+0041 'A' ..= U+005A 'Z'.
///
/// # Examples
///
Expand Down Expand Up @@ -1107,7 +1107,7 @@ impl char {
}

/// Checks if the value is an ASCII lowercase character:
/// U+0061 'a' ... U+007A 'z'.
/// U+0061 'a' ..= U+007A 'z'.
///
/// # Examples
///
Expand Down Expand Up @@ -1140,9 +1140,9 @@ impl char {

/// Checks if the value is an ASCII alphanumeric character:
///
/// - U+0041 'A' ... U+005A 'Z', or
/// - U+0061 'a' ... U+007A 'z', or
/// - U+0030 '0' ... U+0039 '9'.
/// - U+0041 'A' ..= U+005A 'Z', or
/// - U+0061 'a' ..= U+007A 'z', or
/// - U+0030 '0' ..= U+0039 '9'.
///
/// # Examples
///
Expand Down Expand Up @@ -1174,7 +1174,7 @@ impl char {
}

/// Checks if the value is an ASCII decimal digit:
/// U+0030 '0' ... U+0039 '9'.
/// U+0030 '0' ..= U+0039 '9'.
///
/// # Examples
///
Expand Down Expand Up @@ -1207,9 +1207,9 @@ impl char {

/// Checks if the value is an ASCII hexadecimal digit:
///
/// - U+0030 '0' ... U+0039 '9', or
/// - U+0041 'A' ... U+0046 'F', or
/// - U+0061 'a' ... U+0066 'f'.
/// - U+0030 '0' ..= U+0039 '9', or
/// - U+0041 'A' ..= U+0046 'F', or
/// - U+0061 'a' ..= U+0066 'f'.
///
/// # Examples
///
Expand Down Expand Up @@ -1242,10 +1242,10 @@ impl char {

/// Checks if the value is an ASCII punctuation character:
///
/// - U+0021 ... U+002F `! " # $ % & ' ( ) * + , - . /`, or
/// - U+003A ... U+0040 `: ; < = > ? @`, or
/// - U+005B ... U+0060 ``[ \ ] ^ _ ` ``, or
/// - U+007B ... U+007E `{ | } ~`
/// - U+0021 ..= U+002F `! " # $ % & ' ( ) * + , - . /`, or
/// - U+003A ..= U+0040 `: ; < = > ? @`, or
/// - U+005B ..= U+0060 ``[ \ ] ^ _ ` ``, or
/// - U+007B ..= U+007E `{ | } ~`
///
/// # Examples
///
Expand Down Expand Up @@ -1277,7 +1277,7 @@ impl char {
}

/// Checks if the value is an ASCII graphic character:
/// U+0021 '!' ... U+007E '~'.
/// U+0021 '!' ..= U+007E '~'.
///
/// # Examples
///
Expand Down Expand Up @@ -1358,7 +1358,7 @@ impl char {
}

/// Checks if the value is an ASCII control character:
/// U+0000 NUL ... U+001F UNIT SEPARATOR, or U+007F DELETE.
/// U+0000 NUL ..= U+001F UNIT SEPARATOR, or U+007F DELETE.
/// Note that most ASCII whitespace characters are control
/// characters, but SPACE is not.
///
Expand Down
34 changes: 17 additions & 17 deletions src/libcore/num/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4166,8 +4166,8 @@ impl u8 {

/// Checks if the value is an ASCII alphabetic character:
///
/// - U+0041 'A' ... U+005A 'Z', or
/// - U+0061 'a' ... U+007A 'z'.
/// - U+0041 'A' ..= U+005A 'Z', or
/// - U+0061 'a' ..= U+007A 'z'.
///
/// # Examples
///
Expand Down Expand Up @@ -4202,7 +4202,7 @@ impl u8 {
}

/// Checks if the value is an ASCII uppercase character:
/// U+0041 'A' ... U+005A 'Z'.
/// U+0041 'A' ..= U+005A 'Z'.
///
/// # Examples
///
Expand Down Expand Up @@ -4237,7 +4237,7 @@ impl u8 {
}

/// Checks if the value is an ASCII lowercase character:
/// U+0061 'a' ... U+007A 'z'.
/// U+0061 'a' ..= U+007A 'z'.
///
/// # Examples
///
Expand Down Expand Up @@ -4273,9 +4273,9 @@ impl u8 {

/// Checks if the value is an ASCII alphanumeric character:
///
/// - U+0041 'A' ... U+005A 'Z', or
/// - U+0061 'a' ... U+007A 'z', or
/// - U+0030 '0' ... U+0039 '9'.
/// - U+0041 'A' ..= U+005A 'Z', or
/// - U+0061 'a' ..= U+007A 'z', or
/// - U+0030 '0' ..= U+0039 '9'.
///
/// # Examples
///
Expand Down Expand Up @@ -4310,7 +4310,7 @@ impl u8 {
}

/// Checks if the value is an ASCII decimal digit:
/// U+0030 '0' ... U+0039 '9'.
/// U+0030 '0' ..= U+0039 '9'.
///
/// # Examples
///
Expand Down Expand Up @@ -4346,9 +4346,9 @@ impl u8 {

/// Checks if the value is an ASCII hexadecimal digit:
///
/// - U+0030 '0' ... U+0039 '9', or
/// - U+0041 'A' ... U+0046 'F', or
/// - U+0061 'a' ... U+0066 'f'.
/// - U+0030 '0' ..= U+0039 '9', or
/// - U+0041 'A' ..= U+0046 'F', or
/// - U+0061 'a' ..= U+0066 'f'.
///
/// # Examples
///
Expand Down Expand Up @@ -4384,10 +4384,10 @@ impl u8 {

/// Checks if the value is an ASCII punctuation character:
///
/// - U+0021 ... U+002F `! " # $ % & ' ( ) * + , - . /`, or
/// - U+003A ... U+0040 `: ; < = > ? @`, or
/// - U+005B ... U+0060 ``[ \ ] ^ _ ` ``, or
/// - U+007B ... U+007E `{ | } ~`
/// - U+0021 ..= U+002F `! " # $ % & ' ( ) * + , - . /`, or
/// - U+003A ..= U+0040 `: ; < = > ? @`, or
/// - U+005B ..= U+0060 ``[ \ ] ^ _ ` ``, or
/// - U+007B ..= U+007E `{ | } ~`
///
/// # Examples
///
Expand Down Expand Up @@ -4422,7 +4422,7 @@ impl u8 {
}

/// Checks if the value is an ASCII graphic character:
/// U+0021 '!' ... U+007E '~'.
/// U+0021 '!' ..= U+007E '~'.
///
/// # Examples
///
Expand Down Expand Up @@ -4509,7 +4509,7 @@ impl u8 {
}

/// Checks if the value is an ASCII control character:
/// U+0000 NUL ... U+001F UNIT SEPARATOR, or U+007F DELETE.
/// U+0000 NUL ..= U+001F UNIT SEPARATOR, or U+007F DELETE.
/// Note that most ASCII whitespace characters are control
/// characters, but SPACE is not.
///
Expand Down
38 changes: 35 additions & 3 deletions src/libcore/ptr/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -984,8 +984,17 @@ impl<T: ?Sized> *const T {
/// operation because the returned value could be pointing to invalid
/// memory.
///
/// When calling this method, you have to ensure that if the pointer is
/// non-NULL, then it is properly aligned, dereferencable (for the whole
/// size of `T`) and points to an initialized instance of `T`. This applies
/// even if the result of this method is unused!
/// (The part about being initialized is not yet fully decided, but until
/// it is, the only safe approach is to ensure that they are indeed initialized.)
///
/// Additionally, the lifetime `'a` returned is arbitrarily chosen and does
/// not necessarily reflect the actual lifetime of the data.
/// not necessarily reflect the actual lifetime of the data. It is up to the
/// caller to ensure that for the duration of this lifetime, the memory this
/// pointer points to does not get written to outside of `UnsafeCell<U>`.
///
/// # Examples
///
Expand Down Expand Up @@ -1610,8 +1619,17 @@ impl<T: ?Sized> *mut T {
/// operation because the returned value could be pointing to invalid
/// memory.
///
/// When calling this method, you have to ensure that if the pointer is
/// non-NULL, then it is properly aligned, dereferencable (for the whole
/// size of `T`) and points to an initialized instance of `T`. This applies
/// even if the result of this method is unused!
/// (The part about being initialized is not yet fully decided, but until
/// it is, the only safe approach is to ensure that they are indeed initialized.)
///
/// Additionally, the lifetime `'a` returned is arbitrarily chosen and does
/// not necessarily reflect the actual lifetime of the data.
/// not necessarily reflect the actual lifetime of the data. It is up to the
/// caller to ensure that for the duration of this lifetime, the memory this
/// pointer points to does not get written to outside of `UnsafeCell<U>`.
///
/// # Examples
///
Expand Down Expand Up @@ -1755,10 +1773,24 @@ impl<T: ?Sized> *mut T {
///
/// # Safety
///
/// As with `as_ref`, this is unsafe because it cannot verify the validity
/// As with [`as_ref`], this is unsafe because it cannot verify the validity
/// of the returned pointer, nor can it ensure that the lifetime `'a`
/// returned is indeed a valid lifetime for the contained data.
///
/// When calling this method, you have to ensure that if the pointer is
/// non-NULL, then it is properly aligned, dereferencable (for the whole
/// size of `T`) and points to an initialized instance of `T`. This applies
/// even if the result of this method is unused!
/// (The part about being initialized is not yet fully decided, but until
/// it is the only safe approach is to ensure that they are indeed initialized.)
///
/// Additionally, the lifetime `'a` returned is arbitrarily chosen and does
/// not necessarily reflect the actual lifetime of the data. It is up to the
/// caller to ensure that for the duration of this lifetime, the memory this
/// pointer points to does not get accessed through any other pointer.
///
/// [`as_ref`]: #method.as_ref
///
/// # Examples
///
/// Basic usage:
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/hir/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -994,7 +994,7 @@ pub enum PatKind {
/// A literal.
Lit(P<Expr>),

/// A range pattern (e.g., `1...2` or `1..2`).
/// A range pattern (e.g., `1..=2` or `1..2`).
Range(P<Expr>, P<Expr>, RangeEnd),

/// `[a, b, ..i, y, z]` is represented as:
Expand Down
11 changes: 11 additions & 0 deletions src/librustc/middle/resolve_lifetime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1586,6 +1586,17 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
continue;
}

if let Some(parent_def_id) = self.tcx.parent(def_id) {
if let Some(parent_hir_id) = self.tcx.hir()
.as_local_hir_id(parent_def_id) {
// lifetimes in `derive` expansions don't count (Issue #53738)
if self.tcx.hir().attrs_by_hir_id(parent_hir_id).iter()
.any(|attr| attr.check_name(sym::automatically_derived)) {
continue;
}
}
}

let mut err = self.tcx.struct_span_lint_hir(
lint::builtin::SINGLE_USE_LIFETIMES,
id,
Expand Down
4 changes: 2 additions & 2 deletions src/librustc_mir/hair/pattern/_match.rs
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ enum Constructor<'tcx> {
Variant(DefId),
/// Literal values.
ConstantValue(&'tcx ty::Const<'tcx>),
/// Ranges of literal values (`2...5` and `2..5`).
/// Ranges of literal values (`2..=5` and `2..5`).
ConstantRange(u128, u128, Ty<'tcx>, RangeEnd),
/// Array patterns of length n.
Slice(u64),
Expand Down Expand Up @@ -816,7 +816,7 @@ fn max_slice_length<'p, 'a: 'p, 'tcx: 'a, I>(
/// `IntRange`s always store a contiguous range. This means that values are
/// encoded such that `0` encodes the minimum value for the integer,
/// regardless of the signedness.
/// For example, the pattern `-128...127i8` is encoded as `0..=255`.
/// For example, the pattern `-128..=127i8` is encoded as `0..=255`.
/// This makes comparisons and arithmetic on interval endpoints much more
/// straightforward. See `signed_bias` for details.
///
Expand Down
4 changes: 2 additions & 2 deletions src/librustc_resolve/build_reduced_graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ impl<'a> Resolver<'a> {
}

// Empty groups `a::b::{}` are turned into synthetic `self` imports
// `a::b::c::{self as __dummy}`, so that their prefixes are correctly
// `a::b::c::{self as _}`, so that their prefixes are correctly
// resolved and checked for privacy/stability/etc.
if items.is_empty() && !empty_for_self(&prefix) {
let new_span = prefix[prefix.len() - 1].ident.span;
Expand All @@ -314,7 +314,7 @@ impl<'a> Resolver<'a> {
Ident::new(kw::SelfLower, new_span)
),
kind: ast::UseTreeKind::Simple(
Some(Ident::from_str_and_span("__dummy", new_span).gensym()),
Some(Ident::new(kw::Underscore, new_span)),
ast::DUMMY_NODE_ID,
ast::DUMMY_NODE_ID,
),
Expand Down
Loading