Skip to content

Commit bb16e72

Browse files
committedJun 15, 2019
Auto merge of #61868 - Centril:rollup-gglsecp, r=Centril
Rollup of 6 pull requests Successful merges: - #61785 (note some safety concerns of raw-ptr-to-ref casts) - #61805 (typeck: Fix ICE for blocks in repeat expr count.) - #61813 (Remove some unnecessary symbol interner ops) - #61824 (in which we decline to lint single-use lifetimes in `derive`d impls) - #61844 (Change `...` to `..=` where applicable) - #61854 (Minor cosmetic improvements to accompany PR 61825) Failed merges: r? @ghost
2 parents 9f06855 + ab2d2f9 commit bb16e72

File tree

23 files changed

+198
-130
lines changed

23 files changed

+198
-130
lines changed
 

‎src/libcore/benches/ascii.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ benches! {
191191
fn case11_mask_mult_bool_match_range(bytes: &mut [u8]) {
192192
fn is_ascii_lowercase(b: u8) -> bool {
193193
match b {
194-
b'a'...b'z' => true,
194+
b'a'..=b'z' => true,
195195
_ => false
196196
}
197197
}
@@ -203,7 +203,7 @@ benches! {
203203
fn case12_mask_shifted_bool_match_range(bytes: &mut [u8]) {
204204
fn is_ascii_lowercase(b: u8) -> bool {
205205
match b {
206-
b'a'...b'z' => true,
206+
b'a'..=b'z' => true,
207207
_ => false
208208
}
209209
}
@@ -215,7 +215,7 @@ benches! {
215215
fn case13_subtract_shifted_bool_match_range(bytes: &mut [u8]) {
216216
fn is_ascii_lowercase(b: u8) -> bool {
217217
match b {
218-
b'a'...b'z' => true,
218+
b'a'..=b'z' => true,
219219
_ => false
220220
}
221221
}
@@ -227,7 +227,7 @@ benches! {
227227
fn case14_subtract_multiplied_bool_match_range(bytes: &mut [u8]) {
228228
fn is_ascii_lowercase(b: u8) -> bool {
229229
match b {
230-
b'a'...b'z' => true,
230+
b'a'..=b'z' => true,
231231
_ => false
232232
}
233233
}

‎src/libcore/char/convert.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ impl From<char> for u32 {
123123
}
124124
}
125125

126-
/// Maps a byte in 0x00...0xFF to a `char` whose code point has the same value, in U+0000 to U+00FF.
126+
/// Maps a byte in 0x00..=0xFF to a `char` whose code point has the same value, in U+0000..=U+00FF.
127127
///
128128
/// Unicode is designed such that this effectively decodes bytes
129129
/// with the character encoding that IANA calls ISO-8859-1.

‎src/libcore/char/methods.rs

+17-17
Original file line numberDiff line numberDiff line change
@@ -1042,8 +1042,8 @@ impl char {
10421042

10431043
/// Checks if the value is an ASCII alphabetic character:
10441044
///
1045-
/// - U+0041 'A' ... U+005A 'Z', or
1046-
/// - U+0061 'a' ... U+007A 'z'.
1045+
/// - U+0041 'A' ..= U+005A 'Z', or
1046+
/// - U+0061 'a' ..= U+007A 'z'.
10471047
///
10481048
/// # Examples
10491049
///
@@ -1075,7 +1075,7 @@ impl char {
10751075
}
10761076

10771077
/// Checks if the value is an ASCII uppercase character:
1078-
/// U+0041 'A' ... U+005A 'Z'.
1078+
/// U+0041 'A' ..= U+005A 'Z'.
10791079
///
10801080
/// # Examples
10811081
///
@@ -1107,7 +1107,7 @@ impl char {
11071107
}
11081108

11091109
/// Checks if the value is an ASCII lowercase character:
1110-
/// U+0061 'a' ... U+007A 'z'.
1110+
/// U+0061 'a' ..= U+007A 'z'.
11111111
///
11121112
/// # Examples
11131113
///
@@ -1140,9 +1140,9 @@ impl char {
11401140

11411141
/// Checks if the value is an ASCII alphanumeric character:
11421142
///
1143-
/// - U+0041 'A' ... U+005A 'Z', or
1144-
/// - U+0061 'a' ... U+007A 'z', or
1145-
/// - U+0030 '0' ... U+0039 '9'.
1143+
/// - U+0041 'A' ..= U+005A 'Z', or
1144+
/// - U+0061 'a' ..= U+007A 'z', or
1145+
/// - U+0030 '0' ..= U+0039 '9'.
11461146
///
11471147
/// # Examples
11481148
///
@@ -1174,7 +1174,7 @@ impl char {
11741174
}
11751175

11761176
/// Checks if the value is an ASCII decimal digit:
1177-
/// U+0030 '0' ... U+0039 '9'.
1177+
/// U+0030 '0' ..= U+0039 '9'.
11781178
///
11791179
/// # Examples
11801180
///
@@ -1207,9 +1207,9 @@ impl char {
12071207

12081208
/// Checks if the value is an ASCII hexadecimal digit:
12091209
///
1210-
/// - U+0030 '0' ... U+0039 '9', or
1211-
/// - U+0041 'A' ... U+0046 'F', or
1212-
/// - U+0061 'a' ... U+0066 'f'.
1210+
/// - U+0030 '0' ..= U+0039 '9', or
1211+
/// - U+0041 'A' ..= U+0046 'F', or
1212+
/// - U+0061 'a' ..= U+0066 'f'.
12131213
///
12141214
/// # Examples
12151215
///
@@ -1242,10 +1242,10 @@ impl char {
12421242

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

12791279
/// Checks if the value is an ASCII graphic character:
1280-
/// U+0021 '!' ... U+007E '~'.
1280+
/// U+0021 '!' ..= U+007E '~'.
12811281
///
12821282
/// # Examples
12831283
///
@@ -1358,7 +1358,7 @@ impl char {
13581358
}
13591359

13601360
/// Checks if the value is an ASCII control character:
1361-
/// U+0000 NUL ... U+001F UNIT SEPARATOR, or U+007F DELETE.
1361+
/// U+0000 NUL ..= U+001F UNIT SEPARATOR, or U+007F DELETE.
13621362
/// Note that most ASCII whitespace characters are control
13631363
/// characters, but SPACE is not.
13641364
///

‎src/libcore/num/mod.rs

+17-17
Original file line numberDiff line numberDiff line change
@@ -4166,8 +4166,8 @@ impl u8 {
41664166

41674167
/// Checks if the value is an ASCII alphabetic character:
41684168
///
4169-
/// - U+0041 'A' ... U+005A 'Z', or
4170-
/// - U+0061 'a' ... U+007A 'z'.
4169+
/// - U+0041 'A' ..= U+005A 'Z', or
4170+
/// - U+0061 'a' ..= U+007A 'z'.
41714171
///
41724172
/// # Examples
41734173
///
@@ -4202,7 +4202,7 @@ impl u8 {
42024202
}
42034203

42044204
/// Checks if the value is an ASCII uppercase character:
4205-
/// U+0041 'A' ... U+005A 'Z'.
4205+
/// U+0041 'A' ..= U+005A 'Z'.
42064206
///
42074207
/// # Examples
42084208
///
@@ -4237,7 +4237,7 @@ impl u8 {
42374237
}
42384238

42394239
/// Checks if the value is an ASCII lowercase character:
4240-
/// U+0061 'a' ... U+007A 'z'.
4240+
/// U+0061 'a' ..= U+007A 'z'.
42414241
///
42424242
/// # Examples
42434243
///
@@ -4273,9 +4273,9 @@ impl u8 {
42734273

42744274
/// Checks if the value is an ASCII alphanumeric character:
42754275
///
4276-
/// - U+0041 'A' ... U+005A 'Z', or
4277-
/// - U+0061 'a' ... U+007A 'z', or
4278-
/// - U+0030 '0' ... U+0039 '9'.
4276+
/// - U+0041 'A' ..= U+005A 'Z', or
4277+
/// - U+0061 'a' ..= U+007A 'z', or
4278+
/// - U+0030 '0' ..= U+0039 '9'.
42794279
///
42804280
/// # Examples
42814281
///
@@ -4310,7 +4310,7 @@ impl u8 {
43104310
}
43114311

43124312
/// Checks if the value is an ASCII decimal digit:
4313-
/// U+0030 '0' ... U+0039 '9'.
4313+
/// U+0030 '0' ..= U+0039 '9'.
43144314
///
43154315
/// # Examples
43164316
///
@@ -4346,9 +4346,9 @@ impl u8 {
43464346

43474347
/// Checks if the value is an ASCII hexadecimal digit:
43484348
///
4349-
/// - U+0030 '0' ... U+0039 '9', or
4350-
/// - U+0041 'A' ... U+0046 'F', or
4351-
/// - U+0061 'a' ... U+0066 'f'.
4349+
/// - U+0030 '0' ..= U+0039 '9', or
4350+
/// - U+0041 'A' ..= U+0046 'F', or
4351+
/// - U+0061 'a' ..= U+0066 'f'.
43524352
///
43534353
/// # Examples
43544354
///
@@ -4384,10 +4384,10 @@ impl u8 {
43844384

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

44244424
/// Checks if the value is an ASCII graphic character:
4425-
/// U+0021 '!' ... U+007E '~'.
4425+
/// U+0021 '!' ..= U+007E '~'.
44264426
///
44274427
/// # Examples
44284428
///
@@ -4509,7 +4509,7 @@ impl u8 {
45094509
}
45104510

45114511
/// Checks if the value is an ASCII control character:
4512-
/// U+0000 NUL ... U+001F UNIT SEPARATOR, or U+007F DELETE.
4512+
/// U+0000 NUL ..= U+001F UNIT SEPARATOR, or U+007F DELETE.
45134513
/// Note that most ASCII whitespace characters are control
45144514
/// characters, but SPACE is not.
45154515
///

‎src/libcore/ptr/mod.rs

+35-3
Original file line numberDiff line numberDiff line change
@@ -984,8 +984,17 @@ impl<T: ?Sized> *const T {
984984
/// operation because the returned value could be pointing to invalid
985985
/// memory.
986986
///
987+
/// When calling this method, you have to ensure that if the pointer is
988+
/// non-NULL, then it is properly aligned, dereferencable (for the whole
989+
/// size of `T`) and points to an initialized instance of `T`. This applies
990+
/// even if the result of this method is unused!
991+
/// (The part about being initialized is not yet fully decided, but until
992+
/// it is, the only safe approach is to ensure that they are indeed initialized.)
993+
///
987994
/// Additionally, the lifetime `'a` returned is arbitrarily chosen and does
988-
/// not necessarily reflect the actual lifetime of the data.
995+
/// not necessarily reflect the actual lifetime of the data. It is up to the
996+
/// caller to ensure that for the duration of this lifetime, the memory this
997+
/// pointer points to does not get written to outside of `UnsafeCell<U>`.
989998
///
990999
/// # Examples
9911000
///
@@ -1610,8 +1619,17 @@ impl<T: ?Sized> *mut T {
16101619
/// operation because the returned value could be pointing to invalid
16111620
/// memory.
16121621
///
1622+
/// When calling this method, you have to ensure that if the pointer is
1623+
/// non-NULL, then it is properly aligned, dereferencable (for the whole
1624+
/// size of `T`) and points to an initialized instance of `T`. This applies
1625+
/// even if the result of this method is unused!
1626+
/// (The part about being initialized is not yet fully decided, but until
1627+
/// it is, the only safe approach is to ensure that they are indeed initialized.)
1628+
///
16131629
/// Additionally, the lifetime `'a` returned is arbitrarily chosen and does
1614-
/// not necessarily reflect the actual lifetime of the data.
1630+
/// not necessarily reflect the actual lifetime of the data. It is up to the
1631+
/// caller to ensure that for the duration of this lifetime, the memory this
1632+
/// pointer points to does not get written to outside of `UnsafeCell<U>`.
16151633
///
16161634
/// # Examples
16171635
///
@@ -1755,10 +1773,24 @@ impl<T: ?Sized> *mut T {
17551773
///
17561774
/// # Safety
17571775
///
1758-
/// As with `as_ref`, this is unsafe because it cannot verify the validity
1776+
/// As with [`as_ref`], this is unsafe because it cannot verify the validity
17591777
/// of the returned pointer, nor can it ensure that the lifetime `'a`
17601778
/// returned is indeed a valid lifetime for the contained data.
17611779
///
1780+
/// When calling this method, you have to ensure that if the pointer is
1781+
/// non-NULL, then it is properly aligned, dereferencable (for the whole
1782+
/// size of `T`) and points to an initialized instance of `T`. This applies
1783+
/// even if the result of this method is unused!
1784+
/// (The part about being initialized is not yet fully decided, but until
1785+
/// it is the only safe approach is to ensure that they are indeed initialized.)
1786+
///
1787+
/// Additionally, the lifetime `'a` returned is arbitrarily chosen and does
1788+
/// not necessarily reflect the actual lifetime of the data. It is up to the
1789+
/// caller to ensure that for the duration of this lifetime, the memory this
1790+
/// pointer points to does not get accessed through any other pointer.
1791+
///
1792+
/// [`as_ref`]: #method.as_ref
1793+
///
17621794
/// # Examples
17631795
///
17641796
/// Basic usage:

‎src/librustc/hir/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -994,7 +994,7 @@ pub enum PatKind {
994994
/// A literal.
995995
Lit(P<Expr>),
996996

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

10001000
/// `[a, b, ..i, y, z]` is represented as:

‎src/librustc/middle/resolve_lifetime.rs

+11
Original file line numberDiff line numberDiff line change
@@ -1586,6 +1586,17 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
15861586
continue;
15871587
}
15881588

1589+
if let Some(parent_def_id) = self.tcx.parent(def_id) {
1590+
if let Some(parent_hir_id) = self.tcx.hir()
1591+
.as_local_hir_id(parent_def_id) {
1592+
// lifetimes in `derive` expansions don't count (Issue #53738)
1593+
if self.tcx.hir().attrs_by_hir_id(parent_hir_id).iter()
1594+
.any(|attr| attr.check_name(sym::automatically_derived)) {
1595+
continue;
1596+
}
1597+
}
1598+
}
1599+
15891600
let mut err = self.tcx.struct_span_lint_hir(
15901601
lint::builtin::SINGLE_USE_LIFETIMES,
15911602
id,

‎src/librustc_mir/hair/pattern/_match.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,7 @@ enum Constructor<'tcx> {
428428
Variant(DefId),
429429
/// Literal values.
430430
ConstantValue(&'tcx ty::Const<'tcx>),
431-
/// Ranges of literal values (`2...5` and `2..5`).
431+
/// Ranges of literal values (`2..=5` and `2..5`).
432432
ConstantRange(u128, u128, Ty<'tcx>, RangeEnd),
433433
/// Array patterns of length n.
434434
Slice(u64),
@@ -816,7 +816,7 @@ fn max_slice_length<'p, 'a: 'p, 'tcx: 'a, I>(
816816
/// `IntRange`s always store a contiguous range. This means that values are
817817
/// encoded such that `0` encodes the minimum value for the integer,
818818
/// regardless of the signedness.
819-
/// For example, the pattern `-128...127i8` is encoded as `0..=255`.
819+
/// For example, the pattern `-128..=127i8` is encoded as `0..=255`.
820820
/// This makes comparisons and arithmetic on interval endpoints much more
821821
/// straightforward. See `signed_bias` for details.
822822
///

‎src/librustc_resolve/build_reduced_graph.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ impl<'a> Resolver<'a> {
305305
}
306306

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

0 commit comments

Comments
 (0)
Please sign in to comment.