8000 Auto merge of #119609 - matthiaskrgr:rollup-zg85wqn, r=matthiaskrgr · rust-lang-ci/rust@7c83a70 · GitHub
[go: up one dir, main page]

Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 7c83a70

Browse files
committed
Auto merge of rust-lang#119609 - matthiaskrgr:rollup-zg85wqn, r=matthiaskrgr
Rollup of 7 pull requests Successful merges: - rust-lang#118680 (Add support for shell argfiles) - rust-lang#119216 (Use diagnostic namespace in stdlib) - rust-lang#119350 (Imply outlives-bounds on lazy type aliases) - rust-lang#119538 (Cleanup error handlers: round 5) - rust-lang#119563 (Check yield terminator's resume type in borrowck) - rust-lang#119577 (Migrate memory overlap check from validator to lint) - rust-lang#119589 (cstore: Remove unnecessary locking from `CrateMetadata`) Failed merges: - rust-lang#119591 (rustc_mir_transform: Make DestinationPropagation stable for queries) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 8d39ec1 + 6880711 commit 7c83a70

File tree

120 files changed

+1177
-970
lines changed
  • rustc_expand/src
  • rustc_hir_analysis/src
  • rustc_hir_typeck/src
  • rustc_infer/src/errors
  • rustc_interface/src
  • rustc_lint/src
  • rustc_macros/src/diagnostics
  • rustc_metadata/src
  • rustc_middle/src
  • rustc_mir_build/src
  • rustc_mir_transform/src
  • rustc_monomorphize/src
  • rustc_parse/src
  • rustc_passes/src
  • rustc_pattern_analysis/src
  • rustc_resolve/src/late
  • rustc_session/src
  • rustc_symbol_mangling/src
  • rustc_trait_selection/src
  • library/core/src
  • src
  • tests
  • Some content is hidden

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

    120 files changed

    +1177
    -970
    lines changed

    Cargo.lock

    Lines changed: 1 addition & 0 deletions
    Original file line numberDiff line numberDiff line change
    @@ -3738,6 +3738,7 @@ dependencies = [
    37383738
    "rustc_trait_selection",
    37393739
    "rustc_ty_utils",
    37403740
    "serde_json",
    3741+
    "shlex",
    37413742
    "time",
    37423743
    "tracing",
    37433744
    "windows",

    compiler/rustc_ast_passes/src/errors.rs

    Lines changed: 2 additions & 2 deletions
    Original file line numberDiff line numberDiff line change
    @@ -725,8 +725,8 @@ impl AddToDiagnostic for StableFeature {
    725725
    rustc_errors::SubdiagnosticMessage,
    726726
    ) -> rustc_errors::SubdiagnosticMessage,
    727727
    {
    728-
    diag.set_arg("name", self.name);
    729-
    diag.set_arg("since", self.since);
    728+
    diag.arg("name", self.name);
    729+
    diag.arg("since", self.since);
    730730
    diag.help(fluent::ast_passes_stable_since);
    731731
    }
    732732
    }

    compiler/rustc_attr/src/session_diagnostics.rs

    Lines changed: 4 additions & 4 deletions
    Original file line numberDiff line numberDiff line change
    @@ -55,10 +55,10 @@ impl<'a, G: EmissionGuarantee> IntoDiagnostic<'a, G> for UnknownMetaItem<'_> {
    5555
    fn into_diagnostic(self, dcx: &'a DiagCtxt, level: Level) -> DiagnosticBuilder<'a, G> {
    5656
    let expected = self.expected.iter().map(|name| format!("`{name}`")).collect::<Vec<_>>();
    5757
    let mut diag = DiagnosticBuilder::new(dcx, level, fluent::attr_unknown_meta_item);
    58-
    diag.set_span(self.span);
    58+
    diag.span(self.span);
    5959
    diag.code(error_code!(E0541));
    60-
    diag.set_arg("item", self.item);
    61-
    diag.set_arg("expected", expected.join(", "));
    60+
    diag.arg("item", self.item);
    61+
    diag.arg("expected", expected.join(", "));
    6262
    diag.span_label(self.span, fluent::attr_label);
    6363
    diag
    6464
    }
    @@ -215,7 +215,7 @@ impl<'a, G: EmissionGuarantee> IntoDiagnostic<'a, G> for UnsupportedLiteral {
    215215
    }
    216216
    },
    217217
    );
    218-
    diag.set_span(self.span);
    218+
    diag.span(self.span);
    219219
    diag.code(error_code!(E0565));
    220220
    if self.is_bytestr {
    221221
    diag.span_suggestion(

    compiler/rustc_borrowck/src/type_check/input_output.rs

    Lines changed: 12 additions & 21 deletions
    Original file line numberDiff line numberDiff line change
    @@ -94,31 +94,22 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
    9494
    );
    9595
    }
    9696

    97-
    debug!(
    98-
    "equate_inputs_and_outputs: body.yield_ty {:?}, universal_regions.yield_ty {:?}",
    99-
    body.yield_ty(),
    100-
    universal_regions.yield_ty
    101-
    );
    102-
    103-
    // We will not have a universal_regions.yield_ty if we yield (by accident)
    104-
    // outside of a coroutine and return an `impl Trait`, so emit a span_delayed_bug
    105-
    // because we don't want to panic in an assert here if we've already got errors.
    106-
    if body.yield_ty().is_some() != universal_regions.yield_ty.is_some() {
    107-
    self.tcx().dcx().span_delayed_bug(
    108-
    body.span,
    109-
    format!(
    110-
    "Expected body to have yield_ty ({:?}) iff we have a UR yield_ty ({:?})",
    111-
    body.yield_ty(),
    112-
    universal_regions.yield_ty,
    113-
    ),
    97+
    if let Some(mir_yield_ty) = body.yield_ty() {
    98+
    let yield_span = body.local_decls[RETURN_PLACE].source_info.span;
    99+
    self.equate_normalized_input_or_output(
    100+
    universal_regions.yield_ty.unwrap(),
    101+
    mir_yield_ty,
    102+
    yield_span,
    114103
    );
    115104
    }
    116105

    117-
    if let (Some(mir_yield_ty), Some(ur_yield_ty)) =
    118-
    (body.yield_ty(), universal_regions.yield_ty)
    119-
    {
    106+
    if let Some(mir_resume_ty) = body.resume_ty() {
    120107
    let yield_span = body.local_decls[RETURN_PLACE].source_info.span;
    121-
    self.equate_normalized_input_or_output(ur_yield_ty, mir_yield_ty, yield_span);
    108+
    self.equate_normalized_input_or_output(
    109+
    universal_regions.resume_ty.unwrap(),
    110+
    mir_resume_ty,
    111+
    yield_span,
    112+
    );
    122113
    }
    123114

    124115
    // Return types are a bit more complex. They may contain opaque `impl Trait` types.

    compiler/rustc_borrowck/src/type_check/liveness/mod.rs

    Lines changed: 1 addition & 0 deletions
    Original file line numberDiff line numberDiff line change
    @@ -183,6 +183,7 @@ impl<'cx, 'tcx> Visitor<'tcx> for LiveVariablesVisitor<'cx, 'tcx> {
    183183
    match ty_context {
    184184
    TyContext::ReturnTy(SourceInfo { span, .. })
    185185
    | TyContext::YieldTy(SourceInfo { span, .. })
    186+
    | TyContext::ResumeTy(SourceInfo { span, .. })
    186187
    | TyContext::UserTy(span)
    187188
    | TyContext::LocalDecl { source_info: SourceInfo { span, .. }, .. } => {
    188189
    span_bug!(span, "should not be visiting outside of the CFG: {:?}", ty_context);

    compiler/rustc_borrowck/src/type_check/mod.rs

    Lines changed: 24 additions & 2 deletions
    Original file line numberDiff line numberDiff line change
    @@ -1450,13 +1450,13 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
    14501450
    }
    14511451
    }
    14521452
    }
    1453-
    TerminatorKind::Yield { value, .. } => {
    1453+
    TerminatorKind::Yield { value, resume_arg, .. } => {
    14541454
    self.check_operand(value, term_location);
    14551455

    1456-
    let value_ty = value.ty(body, tcx);
    14571456
    match body.yield_ty() {
    14581457
    None => span_mirbug!(self, term, "yield in non-coroutine"),
    14591458
    Some(ty) => {
    1459+
    let value_ty = value.ty(body, tcx);
    14601460
    if let Err(terr) = self.sub_types(
    14611461
    value_ty,
    14621462
    ty,
    @@ -1474,6 +1474,28 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
    14741474
    }
    14751475
    }
    14761476
    }
    1477+
    1478+
    match body.resume_ty() {
    1479+
    None => span_mirbug!(self, term, "yield in non-coroutine"),
    1480+
    Some(ty) => {
    1481+
    let resume_ty = resume_arg.ty(body, tcx);
    1482+
    if let Err(terr) = self.sub_types(
    1483+
    ty,
    1484+
    resume_ty.ty,
    1485+
    term_location.to_locations(),
    1486+
    ConstraintCategory::Yield,
    1487+
    ) {
    1488+
    span_mirbug!(
    1489+
    self,
    1490+
    term,
    1491+
    "type of resume place is {:?}, but the resume type is {:?}: {:?}",
    1492+
    resume_ty,
    1493+
    ty,
    1494+
    terr
    1495+
    );
    1496+
    }
    1497+
    }
    1498+
    }
    14771499
    }
    14781500
    }
    14791501
    }

    compiler/rustc_borrowck/src/universal_regions.rs

    Lines changed: 9 additions & 3 deletions
    Original file line numberDiff line numberDiff line change
    @@ -76,6 +76,8 @@ pub struct UniversalRegions<'tcx> {
    7676
    pub unnormalized_input_tys: &'tcx [Ty<'tcx>],
    7777

    7878
    pub yield_ty: Option<Ty<'tcx>>,
    79+
    80+
    pub resume_ty: Option<Ty<'tcx>>,
    7981
    }
    8082

    8183
    /// The "defining type" for this MIR. The key feature of the "defining
    @@ -525,9 +527,12 @@ impl<'cx, 'tcx> UniversalRegionsBuilder<'cx, 'tcx> {
    525527
    debug!("build: extern regions = {}..{}", first_extern_index, first_local_index);
    526528
    debug!("build: local regions = {}..{}", first_local_index, num_universals);
    527529

    528-
    let yield_ty = match defining_ty {
    529-
    DefiningTy::Coroutine(_, args) => Some(args.as_coroutine().yield_ty()),
    530-
    _ => None,
    530+
    let (resume_ty, yield_ty) = match defining_ty {
    531+
    DefiningTy::Coroutine(_, args) => {
    532+
    let tys = args.as_coroutine();
    533+
    (Some(tys.resume_ty()), Some(tys.yield_ty()))
    534+
    }
    535+
    _ => (None, None),
    531536
    };
    532537

    533538
    UniversalRegions {
    @@ -541,6 +546,7 @@ impl<'cx, 'tcx> UniversalRegionsBuilder<'cx, 'tcx> {
    541546
    unnormalized_output_ty: *unnormalized_output_ty,
    542547
    unnormalized_input_tys,
    543548
    yield_ty,
    549+
    resume_ty,
    544550
    }
    545551
    }
    546552

    compiler/rustc_builtin_macros/src/errors.rs

    Lines changed: 3 additions & 3 deletions
    Original file line numberDiff line numberDiff line change
    @@ -454,7 +454,7 @@ impl<'a, G: EmissionGuarantee> IntoDiagnostic<'a, G> for EnvNotDefinedWithUserMe
    454454
    reason = "cannot translate user-provided messages"
    455455
    )]
    456456
    let mut diag = DiagnosticBuilder::new(dcx, level, self.msg_from_user.to_string());
    457-
    diag.set_span(self.span);
    457+
    diag.span(self.span);
    458458
    diag
    459459
    }
    460460
    }
    @@ -618,7 +618,7 @@ impl AddToDiagnostic for FormatUnusedArg {
    618618
    rustc_errors::SubdiagnosticMessage,
    619619
    ) -> rustc_errors::SubdiagnosticMessage,
    620620
    {
    621-
    diag.set_arg("named", self.named);
    621+
    diag.arg("named", self.named);
    622622
    let msg = f(diag, crate::fluent_generated::builtin_macros_format_unused_arg.into());
    623623
    diag.span_label(self.span, msg);
    624624
    }
    @@ -808,7 +808,7 @@ impl<'a, G: EmissionGuarantee> IntoDiagnostic<'a, G> for AsmClobberNoReg {
    808808
    level,
    809809
    crate::fluent_generated::builtin_macros_asm_clobber_no_reg,
    810810
    );
    811-
    diag.set_span(self.spans.clone());
    811+
    diag.span(self.spans.clone());
    812812
    // eager translation as `span_labels` takes `AsRef<str>`
    813813
    let lbl1 = dcx.eagerly_translate_to_string(
    814814
    crate::fluent_generated::builtin_macros_asm_clobber_abi,

    compiler/rustc_builtin_macros/src/test.rs

    Lines changed: 2 additions & 2 deletions
    Original file line numberDiff line numberDiff line change
    @@ -395,10 +395,10 @@ fn not_testable_error(cx: &ExtCtxt<'_>, attr_sp: Span, item: Option<&ast::Item>)
    395395
    // These were a warning before #92959 and need to continue being that to avoid breaking
    396396
    // stable user code (#94508).
    397397
    Some(ast::ItemKind::MacCall(_)) => Level::Warning(None),
    398-
    _ => Level::Error { lint: false },
    398+
    _ => Level::Error,
    399399
    };
    400400
    let mut err = DiagnosticBuilder::<()>::new(dcx, level, msg);
    401-
    err.set_span(attr_sp);
    401+
    err.span(attr_sp);
    402402
    if let Some(item) = item {
    403403
    err.span_label(
    404404
    item.span,

    compiler/rustc_codegen_gcc/src/errors.rs

    Lines changed: 2 additions & 2 deletions
    Original file line numberDiff line numberDiff line change
    @@ -119,12 +119,12 @@ impl<G: EmissionGuarantee> IntoDiagnostic<'_, G> for TargetFeatureDisableOrEnabl
    119119
    fluent::codegen_gcc_target_feature_disable_or_enable
    120120
    );
    121121
    if let Some(span) = self.span {
    122-
    diag.set_span(span);
    122+
    diag.span(span);
    123123
    };
    124124
    if let Some(missing_features) = self.missing_features {
    125125
    diag.subdiagnostic(missing_features);
    126126
    }
    127-
    diag.set_arg("features", self.features.join(", "));
    127+
    diag.arg("features", self.features.join(", "));
    128128
    diag
    129129
    }
    130130
    }

    0 commit comments

    Comments
     (0)
    0