Skip to content

Commit ee48a3f

Browse files
committed
Auto merge of #3171 - saethlin:rustup, r=saethlin
Rustup For rust-lang/miri#3103
2 parents 3d65927 + a5a039b commit ee48a3f

File tree

161 files changed

+1351
-1207
lines changed

Some content is hidden

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

161 files changed

+1351
-1207
lines changed

compiler/rustc_abi/src/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#![cfg_attr(feature = "nightly", feature(step_trait))]
22
#![cfg_attr(feature = "nightly", allow(internal_features))]
3-
#![cfg_attr(all(not(bootstrap), feature = "nightly"), doc(rust_logo))]
4-
#![cfg_attr(all(not(bootstrap), feature = "nightly"), feature(rustdoc_internals))]
3+
#![cfg_attr(feature = "nightly", doc(rust_logo))]
4+
#![cfg_attr(feature = "nightly", feature(rustdoc_internals))]
55

66
use std::fmt;
77
use std::num::{NonZeroUsize, ParseIntError};

compiler/rustc_arena/src/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/",
1212
test(no_crate_inject, attr(deny(warnings)))
1313
)]
14-
#![cfg_attr(not(bootstrap), doc(rust_logo))]
15-
#![cfg_attr(not(bootstrap), feature(rustdoc_internals))]
14+
#![doc(rust_logo)]
15+
#![feature(rustdoc_internals)]
1616
#![feature(core_intrinsics)]
1717
#![feature(dropck_eyepatch)]
1818
#![feature(new_uninit)]

compiler/rustc_ast/src/lib.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/",
99
test(attr(deny(warnings)))
1010
)]
11-
#![cfg_attr(not(bootstrap), doc(rust_logo))]
12-
#![cfg_attr(not(bootstrap), allow(internal_features))]
13-
#![cfg_attr(not(bootstrap), feature(rustdoc_internals))]
11+
#![doc(rust_logo)]
12+
#![allow(internal_features)]
13+
#![feature(rustdoc_internals)]
1414
#![feature(associated_type_bounds)]
1515
#![feature(box_patterns)]
1616
#![feature(const_trait_impl)]

compiler/rustc_ast_lowering/src/lib.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@
3030
//! get confused if the spans from leaf AST nodes occur in multiple places
3131
//! in the HIR, especially for multiple identifiers.
3232
33-
#![cfg_attr(not(bootstrap), allow(internal_features))]
34-
#![cfg_attr(not(bootstrap), feature(rustdoc_internals))]
35-
#![cfg_attr(not(bootstrap), doc(rust_logo))]
33+
#![allow(internal_features)]
34+
#![feature(rustdoc_internals)]
35+
#![doc(rust_logo)]
3636
#![feature(box_patterns)]
3737
#![feature(let_chains)]
3838
#![feature(never_type)]

compiler/rustc_ast_passes/src/ast_validation.rs

+8-10
Original file line numberDiff line numberDiff line change
@@ -1213,8 +1213,12 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
12131213
DisallowTildeConstContext::Fn(FnKind::Fn(_, ident, ..)) => {
12141214
errors::TildeConstReason::Function { ident: ident.span }
12151215
}
1216-
&DisallowTildeConstContext::Trait(span) => errors::TildeConstReason::Trait { span },
1217-
&DisallowTildeConstContext::Impl(span) => errors::TildeConstReason::Impl { span },
1216+
&DisallowTildeConstContext::Trait(span) => {
1217+
errors::TildeConstReason::Trait { span }
1218+
}
1219+
&DisallowTildeConstContext::Impl(span) => {
1220+
errors::TildeConstReason::Impl { span }
1221+
}
12181222
DisallowTildeConstContext::TraitObject => {
12191223
errors::TildeConstReason::TraitObject
12201224
}
@@ -1446,9 +1450,7 @@ fn deny_equality_constraints(
14461450
id: rustc_ast::node_id::DUMMY_NODE_ID,
14471451
ident: *ident,
14481452
gen_args,
1449-
kind: AssocConstraintKind::Equality {
1450-
term: predicate.rhs_ty.clone().into(),
1451-
},
1453+
kind: AssocConstraintKind::Equality { term: predicate.rhs_ty.clone().into() },
14521454
span: ident.span,
14531455
});
14541456
// Add `<Bar = RhsTy>` to `Foo`.
@@ -1461,11 +1463,7 @@ fn deny_equality_constraints(
14611463
},
14621464
empty_args => {
14631465
*empty_args = Some(
1464-
AngleBracketedArgs {
1465-
span: ident.span,
1466-
args: thin_vec![arg],
1467-
}
1468-
.into(),
1466+
AngleBracketedArgs { span: ident.span, args: thin_vec![arg] }.into(),
14691467
);
14701468
}
14711469
}

compiler/rustc_ast_passes/src/lib.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
//!
55
//! The crate also contains other misc AST visitors, e.g. `node_count` and `show_span`.
66
7-
#![cfg_attr(not(bootstrap), allow(internal_features))]
8-
#![cfg_attr(not(bootstrap), doc(rust_logo))]
9-
#![cfg_attr(not(bootstrap), feature(rustdoc_internals))]
7+
#![allow(internal_features)]
8+
#![doc(rust_logo)]
9+
#![feature(rustdoc_internals)]
1010
#![feature(box_patterns)]
1111
#![feature(if_let_guard)]
1212
#![feature(iter_is_partitioned)]

compiler/rustc_ast_pretty/src/lib.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#![cfg_attr(not(bootstrap), allow(internal_features))]
2-
#![cfg_attr(not(bootstrap), feature(rustdoc_internals))]
3-
#![cfg_attr(not(bootstrap), doc(rust_logo))]
1+
#![allow(internal_features)]
2+
#![feature(rustdoc_internals)]
3+
#![doc(rust_logo)]
44
#![deny(rustc::untranslatable_diagnostic)]
55
#![deny(rustc::diagnostic_outside_of_impl)]
66
#![feature(associated_type_bounds)]

compiler/rustc_attr/src/lib.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
//! The goal is to move the definition of `MetaItem` and things that don't need to be in `syntax`
55
//! to this crate.
66
7-
#![cfg_attr(not(bootstrap), allow(internal_features))]
8-
#![cfg_attr(not(bootstrap), feature(rustdoc_internals))]
9-
#![cfg_attr(not(bootstrap), doc(rust_logo))]
7+
#![allow(internal_features)]
8+
#![feature(rustdoc_internals)]
9+
#![doc(rust_logo)]
1010
#![feature(let_chains)]
1111
#![deny(rustc::untranslatable_diagnostic)]
1212
#![deny(rustc::diagnostic_outside_of_impl)]

compiler/rustc_baked_icu_data/src/lib.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@
2020
//! --cldr-tag latest --icuexport-tag latest -o src/data
2121
//! ```
2222
23-
#![cfg_attr(not(bootstrap), allow(internal_features))]
24-
#![cfg_attr(not(bootstrap), feature(rustdoc_internals))]
25-
#![cfg_attr(not(bootstrap), doc(rust_logo))]
23+
#![allow(internal_features)]
24+
#![feature(rustdoc_internals)]
25+
#![doc(rust_logo)]
2626
#![allow(elided_lifetimes_in_paths)]
2727

2828
mod data {

compiler/rustc_borrowck/src/diagnostics/bound_region_errors.rs

+38-12
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ use rustc_infer::infer::RegionVariableOrigin;
1010
use rustc_infer::infer::{InferCtxt, RegionResolutionError, SubregionOrigin, TyCtxtInferExt as _};
1111
use rustc_infer::traits::ObligationCause;
1212
use rustc_middle::ty::error::TypeError;
13+
use rustc_middle::ty::RePlaceholder;
14+
use rustc_middle::ty::Region;
1315
use rustc_middle::ty::RegionVid;
1416
use rustc_middle::ty::UniverseIndex;
1517
use rustc_middle::ty::{self, Ty, TyCtxt, TypeFoldable};
@@ -205,6 +207,8 @@ trait TypeOpInfo<'tcx> {
205207
let span = cause.span;
206208
let nice_error = self.nice_error(mbcx, cause, placeholder_region, error_region);
207209

210+
debug!(?nice_error);
211+
208212
if let Some(nice_error) = nice_error {
209213
mbcx.buffer_error(nice_error);
210214
} else {
@@ -404,19 +408,41 @@ fn try_extract_error_from_region_constraints<'tcx>(
404408
mut region_var_origin: impl FnMut(RegionVid) -> RegionVariableOrigin,
405409
mut universe_of_region: impl FnMut(RegionVid) -> UniverseIndex,
406410
) -> Option<DiagnosticBuilder<'tcx, ErrorGuaranteed>> {
407-
let (sub_region, cause) =
408-
region_constraints.constraints.iter().find_map(|(constraint, cause)| {
409-
match *constraint {
410-
Constraint::RegSubReg(sub, sup) if sup == placeholder_region && sup != sub => {
411-
Some((sub, cause.clone()))
412-
}
413-
// FIXME: Should this check the universe of the var?
414-
Constraint::VarSubReg(vid, sup) if sup == placeholder_region => {
415-
Some((ty::Region::new_var(infcx.tcx, vid), cause.clone()))
416-
}
417-
_ => None,
411+
let matches =
412+
|a_region: Region<'tcx>, b_region: Region<'tcx>| match (a_region.kind(), b_region.kind()) {
413+
(RePlaceholder(a_p), RePlaceholder(b_p)) => a_p.bound == b_p.bound,
414+
_ => a_region == b_region,
415+
};
416+
let check = |constraint: &Constraint<'tcx>, cause: &SubregionOrigin<'tcx>, exact| {
417+
match *constraint {
418+
Constraint::RegSubReg(sub, sup)
419+
if ((exact && sup == placeholder_region)
420+
|| (!exact && matches(sup, placeholder_region)))
421+
&& sup != sub =>
422+
{
423+
Some((sub, cause.clone()))
424+
}
425+
// FIXME: Should this check the universe of the var?
426+
Constraint::VarSubReg(vid, sup)
427+
if ((exact && sup == placeholder_region)
428+
|| (!exact && matches(sup, placeholder_region))) =>
429+
{
430+
Some((ty::Region::new_var(infcx.tcx, vid), cause.clone()))
418431
}
419-
})?;
432+
_ => None,
433+
}
434+
};
435+
let mut info = region_constraints
436+
.constraints
437+
.iter()
438+
.find_map(|(constraint, cause)| check(constraint, cause, true));
439+
if info.is_none() {
440+
info = region_constraints
441+
.constraints
442+
.iter()
443+
.find_map(|(constraint, cause)| check(constraint, cause, false));
444+
}
445+
let (sub_region, cause) = info?;
420446

421447
debug!(?sub_region, "cause = {:#?}", cause);
422448
let error = match (error_region, *sub_region) {

compiler/rustc_borrowck/src/diagnostics/move_errors.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -607,7 +607,8 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
607607

608608
if let Some(adt) = local_ty.ty_adt_def()
609609
&& adt.repr().packed()
610-
&& let ExpnKind::Macro(MacroKind::Derive, name) = self.body.span.ctxt().outer_expn_data().kind
610+
&& let ExpnKind::Macro(MacroKind::Derive, name) =
611+
self.body.span.ctxt().outer_expn_data().kind
611612
{
612613
err.note(format!("`#[derive({name})]` triggers a move because taking references to the fields of a packed struct is undefined behaviour"));
613614
}

compiler/rustc_borrowck/src/diagnostics/region_errors.rs

+6
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,12 @@ impl<'tcx> RegionErrors<'tcx> {
9595
}
9696
}
9797

98+
impl std::fmt::Debug for RegionErrors<'_> {
99+
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
100+
f.debug_tuple("RegionErrors").field(&self.0).finish()
101+
}
102+
}
103+
98104
#[derive(Clone, Debug)]
99105
pub(crate) enum RegionErrorKind<'tcx> {
100106
/// A generic bound failure for a type test (`T: 'a`).

compiler/rustc_borrowck/src/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
//! This query borrow-checks the MIR to (further) ensure it is not broken.
22
33
#![allow(internal_features)]
4-
#![cfg_attr(not(bootstrap), feature(rustdoc_internals))]
5-
#![cfg_attr(not(bootstrap), doc(rust_logo))]
4+
#![feature(rustdoc_internals)]
5+
#![doc(rust_logo)]
66
#![feature(associated_type_bounds)]
77
#![feature(box_patterns)]
88
#![feature(let_chains)]

compiler/rustc_borrowck/src/region_infer/mod.rs

+9
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ pub(crate) struct AppliedMemberConstraint {
151151
pub(crate) member_constraint_index: NllMemberConstraintIndex,
152152
}
153153

154+
#[derive(Debug)]
154155
pub(crate) struct RegionDefinition<'tcx> {
155156
/// What kind of variable is this -- a free region? existential
156157
/// variable? etc. (See the `NllRegionVariableOrigin` for more
@@ -687,6 +688,9 @@ impl<'tcx> RegionInferenceContext<'tcx> {
687688
&mut errors_buffer,
688689
);
689690

691+
debug!(?errors_buffer);
692+
debug!(?outlives_requirements);
693+
690694
// In Polonius mode, the errors about missing universal region relations are in the output
691695
// and need to be emitted or propagated. Otherwise, we need to check whether the
692696
// constraints were too strong, and if so, emit or propagate those errors.
@@ -700,10 +704,14 @@ impl<'tcx> RegionInferenceContext<'tcx> {
700704
self.check_universal_regions(outlives_requirements.as_mut(), &mut errors_buffer);
701705
}
702706

707+
debug!(?errors_buffer);
708+
703709
if errors_buffer.is_empty() {
704710
self.check_member_constraints(infcx, &mut errors_buffer);
705711
}
706712

713+
debug!(?errors_buffer);
714+
707715
let outlives_requirements = outlives_requirements.unwrap_or_default();
708716

709717
if outlives_requirements.is_empty() {
@@ -1457,6 +1465,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
14571465
errors_buffer: &mut RegionErrors<'tcx>,
14581466
) {
14591467
for (fr, fr_definition) in self.definitions.iter_enumerated() {
1468+
debug!(?fr, ?fr_definition);
14601469
match fr_definition.origin {
14611470
NllRegionVariableOrigin::FreeRegion => {
14621471
// Go through each of the universal regions `fr` and check that

compiler/rustc_borrowck/src/type_check/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1202,7 +1202,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
12021202
self.infcx.tcx
12031203
}
12041204

1205-
#[instrument(skip(self, body, location), level = "debug")]
1205+
#[instrument(skip(self, body), level = "debug")]
12061206
fn check_stmt(&mut self, body: &Body<'tcx>, stmt: &Statement<'tcx>, location: Location) {
12071207
let tcx = self.tcx();
12081208
debug!("stmt kind: {:?}", stmt.kind);

compiler/rustc_builtin_macros/src/format.rs

+10-3
Original file line numberDiff line numberDiff line change
@@ -617,10 +617,17 @@ fn report_missing_placeholders(
617617
let placeholders = pieces
618618
.iter()
619619
.filter_map(|piece| {
620-
if let parse::Piece::NextArgument(argument) = piece && let ArgumentNamed(binding) = argument.position {
621-
let span = fmt_span.from_inner(InnerSpan::new(argument.position_span.start, argument.position_span.end));
620+
if let parse::Piece::NextArgument(argument) = piece
621+
&& let ArgumentNamed(binding) = argument.position
622+
{
623+
let span = fmt_span.from_inner(InnerSpan::new(
624+
argument.position_span.start,
625+
argument.position_span.end,
626+
));
622627
Some((span, binding))
623-
} else { None }
628+
} else {
629+
None
630+
}
624631
})
625632
.collect::<Vec<_>>();
626633

compiler/rustc_builtin_macros/src/lib.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
//! This crate contains implementations of built-in macros and other code generating facilities
22
//! injecting code into the crate before it is lowered to HIR.
33
4-
#![cfg_attr(not(bootstrap), allow(internal_features))]
5-
#![cfg_attr(not(bootstrap), feature(rustdoc_internals))]
6-
#![cfg_attr(not(bootstrap), doc(rust_logo))]
4+
#![allow(internal_features)]
5+
#![feature(rustdoc_internals)]
6+
#![doc(rust_logo)]
77
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
88
#![feature(array_windows)]
99
#![feature(box_patterns)]

compiler/rustc_codegen_cranelift/build_system/tests.rs

+2
Original file line numberDiff line numberDiff line change
@@ -457,6 +457,8 @@ impl<'a> TestRunner<'a> {
457457
cmd.arg("--target");
458458
cmd.arg(&self.target_compiler.triple);
459459
cmd.arg("-Cpanic=abort");
460+
cmd.arg("--check-cfg=cfg(no_unstable_features)");
461+
cmd.arg("--check-cfg=cfg(jit)");
460462
cmd.args(args);
461463
cmd
462464
}

compiler/rustc_codegen_gcc/src/lib.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
* TODO(antoyo): remove the patches.
1313
*/
1414

15-
#![cfg_attr(not(bootstrap), allow(internal_features))]
16-
#![cfg_attr(not(bootstrap), doc(rust_logo))]
17-
#![cfg_attr(not(bootstrap), feature(rustdoc_internals))]
15+
#![allow(internal_features)]
16+
#![doc(rust_logo)]
17+
#![feature(rustdoc_internals)]
1818
#![feature(
1919
rustc_private,
2020
decl_macro,

compiler/rustc_codegen_llvm/src/common.rs

+1
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,7 @@ impl<'ll, 'tcx> ConstMethods<'tcx> for CodegenCx<'ll, 'tcx> {
203203
unsafe {
204204
llvm::LLVMSetInitializer(g, sc);
205205
llvm::LLVMSetGlobalConstant(g, True);
206+
llvm::LLVMSetUnnamedAddress(g, llvm::UnnamedAddr::Global);
206207
llvm::LLVMRustSetLinkage(g, llvm::Linkage::InternalLinkage);
207208
}
208209
(s.to_owned(), g)

compiler/rustc_codegen_llvm/src/lib.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
//!
55
//! This API is completely unstable and subject to change.
66
7-
#![cfg_attr(not(bootstrap), allow(internal_features))]
8-
#![cfg_attr(not(bootstrap), feature(rustdoc_internals))]
9-
#![cfg_attr(not(bootstrap), doc(rust_logo))]
7+
#![allow(internal_features)]
8+
#![feature(rustdoc_internals)]
9+
#![doc(rust_logo)]
1010
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
1111
#![feature(exact_size_is_empty)]
1212
#![feature(extern_types)]

compiler/rustc_codegen_ssa/src/lib.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
2-
#![cfg_attr(not(bootstrap), doc(rust_logo))]
3-
#![cfg_attr(not(bootstrap), feature(rustdoc_internals))]
4-
#![cfg_attr(not(bootstrap), allow(internal_features))]
2+
#![doc(rust_logo)]
3+
#![feature(rustdoc_internals)]
4+
#![allow(internal_features)]
55
#![feature(associated_type_bounds)]
66
#![feature(box_patterns)]
77
#![feature(if_let_guard)]

compiler/rustc_const_eval/src/interpret/operator.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -114,9 +114,8 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
114114
use rustc_middle::mir::BinOp::*;
115115

116116
// Performs appropriate non-deterministic adjustments of NaN results.
117-
let adjust_nan = |f: F| -> F {
118-
if f.is_nan() { M::generate_nan(self, &[l, r]) } else { f }
119-
};
117+
let adjust_nan =
118+
|f: F| -> F { if f.is_nan() { M::generate_nan(self, &[l, r]) } else { f } };
120119

121120
let val = match bin_op {
122121
Eq => ImmTy::from_bool(l == r, *self.tcx),

0 commit comments

Comments
 (0)