Skip to content

Commit 7ce1b3b

Browse files
committed
Auto merge of #81545 - JohnTitor:rollup-zlt3tn6, r=JohnTitor
Rollup of 16 pull requests Successful merges: - #79023 (Add `core::stream::Stream`) - #80562 (Consider Scalar to be a bool only if its unsigned) - #80886 (Stabilize raw ref macros) - #80959 (Stabilize `unsigned_abs`) - #81291 (Support FRU pattern with `[feature(capture_disjoint_fields)]`) - #81409 (Slight simplification of chars().count()) - #81468 (cfg(version): treat nightlies as complete) - #81473 (Warn write-only fields) - #81495 (rustdoc: Remove unnecessary optional) - #81499 (Updated Vec::splice documentation) - #81501 (update rustfmt to v1.4.34) - #81505 (`fn cold_path` doesn't need to be pub) - #81512 (Add missing variants in match binding) - #81515 (Fix typo in pat.rs) - #81519 (Don't print error output from rustup when detecting default build triple) - #81520 (Don't clone LLVM submodule when download-ci-llvm is set) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents ebaea9e + 31e7634 commit 7ce1b3b

File tree

52 files changed

+598
-95
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+598
-95
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4442,7 +4442,7 @@ dependencies = [
44424442

44434443
[[package]]
44444444
name = "rustfmt-nightly"
4445-
version = "1.4.32"
4445+
version = "1.4.34"
44464446
dependencies = [
44474447
"annotate-snippets 0.6.1",
44484448
"anyhow",

compiler/rustc_arena/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ use std::slice;
3232

3333
#[inline(never)]
3434
#[cold]
35-
pub fn cold_path<F: FnOnce() -> R, R>(f: F) -> R {
35+
fn cold_path<F: FnOnce() -> R, R>(f: F) -> R {
3636
f()
3737
}
3838

compiler/rustc_attr/src/builtin.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -586,12 +586,14 @@ pub fn eval_condition(
586586
return false;
587587
}
588588
};
589-
let channel = env!("CFG_RELEASE_CHANNEL");
590-
let nightly = channel == "nightly" || channel == "dev";
591589
let rustc_version = parse_version(env!("CFG_RELEASE"), true).unwrap();
592590

593-
// See https://github.com/rust-lang/rust/issues/64796#issuecomment-625474439 for details
594-
if nightly { rustc_version > min_version } else { rustc_version >= min_version }
591+
// See https://github.com/rust-lang/rust/issues/64796#issuecomment-640851454 for details
592+
if sess.assume_incomplete_release {
593+
rustc_version > min_version
594+
} else {
595+
rustc_version >= min_version
596+
}
595597
}
596598
ast::MetaItemKind::List(ref mis) => {
597599
for mi in mis.iter() {

compiler/rustc_interface/src/tests.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -540,6 +540,7 @@ fn test_debugging_options_tracking_hash() {
540540
// This list is in alphabetical order.
541541
tracked!(allow_features, Some(vec![String::from("lang_items")]));
542542
tracked!(always_encode_mir, true);
543+
tracked!(assume_incomplete_release, true);
543544
tracked!(asm_comments, true);
544545
tracked!(binary_dep_depinfo, true);
545546
tracked!(chalk, true);

compiler/rustc_middle/src/mir/interpret/mod.rs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -588,12 +588,3 @@ pub fn read_target_uint(endianness: Endian, mut source: &[u8]) -> Result<u128, i
588588
debug_assert!(source.len() == 0); // We should have consumed the source buffer.
589589
uint
590590
}
591-
592-
/// Computes the unsigned absolute value without wrapping or panicking.
593-
#[inline]
594-
pub fn uabs(value: i64) -> u64 {
595-
// The only tricky part here is if value == i64::MIN. In that case,
596-
// wrapping_abs() returns i64::MIN == -2^63. Casting this value to a u64
597-
// gives 2^63, the correct value.
598-
value.wrapping_abs() as u64
599-
}

compiler/rustc_middle/src/mir/interpret/pointer.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use super::{uabs, AllocId, InterpResult};
1+
use super::{AllocId, InterpResult};
22

33
use rustc_macros::HashStable;
44
use rustc_target::abi::{HasDataLayout, Size};
@@ -57,7 +57,7 @@ pub trait PointerArithmetic: HasDataLayout {
5757
#[inline]
5858
fn overflowing_signed_offset(&self, val: u64, i: i64) -> (u64, bool) {
5959
// We need to make sure that i fits in a machine isize.
60-
let n = uabs(i);
60+
let n = i.unsigned_abs();
6161
if i >= 0 {
6262
let (val, over) = self.overflowing_offset(val, n);
6363
(val, over || i > self.machine_isize_max())

compiler/rustc_mir/src/interpret/intrinsics.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use std::convert::TryFrom;
77
use rustc_hir::def_id::DefId;
88
use rustc_middle::mir::{
99
self,
10-
interpret::{uabs, ConstValue, GlobalId, InterpResult, Scalar},
10+
interpret::{ConstValue, GlobalId, InterpResult, Scalar},
1111
BinOp,
1212
};
1313
use rustc_middle::ty;
@@ -542,7 +542,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
542542
// memory between these pointers must be accessible. Note that we do not require the
543543
// pointers to be properly aligned (unlike a read/write operation).
544544
let min_ptr = if offset_bytes >= 0 { ptr } else { offset_ptr };
545-
let size: u64 = uabs(offset_bytes);
545+
let size = offset_bytes.unsigned_abs();
546546
// This call handles checking for integer/NULL pointers.
547547
self.memory.check_ptr_access_align(
548548
min_ptr,

compiler/rustc_mir_build/src/build/expr/as_place.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ impl<'tcx> PlaceBuilder<'tcx> {
303303
self.base
304304
}
305305

306-
fn field(self, f: Field, ty: Ty<'tcx>) -> Self {
306+
crate fn field(self, f: Field, ty: Ty<'tcx>) -> Self {
307307
self.project(PlaceElem::Field(f, ty))
308308
}
309309

compiler/rustc_mir_build/src/build/expr/into.rs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
296296
let field_names = this.hir.all_fields(adt_def, variant_index);
297297

298298
let fields: Vec<_> = if let Some(FruInfo { base, field_types }) = base {
299-
let base = unpack!(block = this.as_place(block, base));
299+
let place_builder = unpack!(block = this.as_place_builder(block, base));
300300

301301
// MIR does not natively support FRU, so for each
302302
// base-supplied field, generate an operand that
@@ -306,9 +306,14 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
306306
.zip(field_types.into_iter())
307307
.map(|(n, ty)| match fields_map.get(&n) {
308308
Some(v) => v.clone(),
309-
None => this.consume_by_copy_or_move(
310-
this.hir.tcx().mk_place_field(base, n, ty),
311-
),
309+
None => {
310+
let place_builder = place_builder.clone();
311+
this.consume_by_copy_or_move(
312+
place_builder
313+
.field(n, ty)
314+
.into_place(this.hir.tcx(), this.hir.typeck_results()),
315+
)
316+
},
312317
})
313318
.collect()
314319
} else {

compiler/rustc_parse/src/parser/pat.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ impl<'a> Parser<'a> {
240240
Err(err)
241241
}
242242

243-
/// Parse and throw away a parentesized comma separated
243+
/// Parse and throw away a parenthesized comma separated
244244
/// sequence of patterns until `)` is reached.
245245
fn skip_pat_list(&mut self) -> PResult<'a, ()> {
246246
while !self.check(&token::CloseDelim(token::Paren)) {

0 commit comments

Comments
 (0)