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

Commit 2b7a8f9

Browse files
committed
Auto merge of rust-lang#119611 - GuillaumeGomez:rollup-zbc4mc8, r=GuillaumeGomez
Rollup of 10 pull requests Successful merges: - rust-lang#119354 (Make `negative_bounds` internal & fix some of its issues) - rust-lang#119414 (bootstrap: Move -Clto= setting from Rustc::run to rustc_cargo) - rust-lang#119420 (Handle ForeignItem as TAIT scope.) - rust-lang#119506 (Use `resolutions(()).effective_visiblities` to avoid cycle errors in `report_object_error`) - rust-lang#119538 (Cleanup error handlers: round 5) - rust-lang#119566 (Remove `-Zdump-mir-spanview`) - rust-lang#119567 (Remove `-Zreport-delayed-bugs`.) - rust-lang#119577 (Migrate memory overlap check from validator to lint) - rust-lang#119586 ([rustdoc] Fix invalid handling for static method calls in jump to definition feature) - rust-lang#119588 (Move `i586-unknown-netbsd` from tier 2 to tier 3 platform support table) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 8d39ec1 + 2a10782 commit 2b7a8f9

File tree

108 files changed

+987
-1805
lines changed

Some content is hidden

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

108 files changed

+987
-1805
lines changed

compiler/rustc_ast_passes/messages.ftl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,9 @@ ast_passes_module_nonascii = trying to load file for module `{$name}` with non-a
188188
ast_passes_negative_bound_not_supported =
189189
negative bounds are not supported
190190
191+
ast_passes_negative_bound_with_parenthetical_notation =
192+
parenthetical notation may not be used for negative bounds
193+
191194
ast_passes_nested_impl_trait = nested `impl Trait` is not allowed
192195
.outer = outer `impl Trait`
193196
.inner = nested `impl Trait` here

compiler/rustc_ast_passes/src/ast_validation.rs

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1312,13 +1312,24 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
13121312
if let GenericBound::Trait(trait_ref, modifiers) = bound
13131313
&& let BoundPolarity::Negative(_) = modifiers.polarity
13141314
&& let Some(segment) = trait_ref.trait_ref.path.segments.last()
1315-
&& let Some(ast::GenericArgs::AngleBracketed(args)) = segment.args.as_deref()
13161315
{
1317-
for arg in &args.args {
1318-
if let ast::AngleBracketedArg::Constraint(constraint) = arg {
1319-
self.dcx()
1320-
.emit_err(errors::ConstraintOnNegativeBound { span: constraint.span });
1316+
match segment.args.as_deref() {
1317+
Some(ast::GenericArgs::AngleBracketed(args)) => {
1318+
for arg in &args.args {
1319+
if let ast::AngleBracketedArg::Constraint(constraint) = arg {
1320+
self.dcx().emit_err(errors::ConstraintOnNegativeBound {
1321+
span: constraint.span,
1322+
});
1323+
}
1324+
}
1325+
}
1326+
// The lowered form of parenthesized generic args contains a type binding.
1327+
Some(ast::GenericArgs::Parenthesized(args)) => {
1328+
self.dcx().emit_err(errors::NegativeBoundWithParentheticalNotation {
1329+
span: args.span,
1330+
});
13211331
}
1332+
None => {}
13221333
}
13231334
}
13241335

compiler/rustc_ast_passes/src/errors.rs

Lines changed: 9 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
}
@@ -763,6 +763,13 @@ pub struct ConstraintOnNegativeBound {
763763
pub span: Span,
764764
}
765765

766+
#[derive(Diagnostic)]
767+
#[diag(ast_passes_negative_bound_with_parenthetical_notation)]
768+
pub struct NegativeBoundWithParentheticalNotation {
769+
#[primary_span]
770+
pub span: Span,
771+
}
772+
766773
#[derive(Diagnostic)]
767774
#[diag(ast_passes_invalid_unnamed_field_ty)]
768775
pub struct InvalidUnnamedFieldTy {

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_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
}

compiler/rustc_codegen_llvm/src/back/write.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,7 @@ fn report_inline_asm(
416416
cookie = 0;
417417
}
418418
let level = match level {
419-
llvm::DiagnosticLevel::Error => Level::Error { lint: false },
419+
llvm::DiagnosticLevel::Error => Level::Error,
420420
llvm::DiagnosticLevel::Warning => Level::Warning(None),
421421
llvm::DiagnosticLevel::Note | llvm::DiagnosticLevel::Remark => Level::Note,
422422
};

compiler/rustc_codegen_llvm/src/errors.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ impl<G: EmissionGuarantee> IntoDiagnostic<'_, G> for ParseTargetMachineConfig<'_
107107

108108
let mut diag =
109109
DiagnosticBuilder::new(dcx, level, fluent::codegen_llvm_parse_target_machine_config);
110-
diag.set_arg("error", message);
110+
diag.arg("error", message);
111111
diag
112112
}
113113
}
@@ -130,12 +130,12 @@ impl<G: EmissionGuarantee> IntoDiagnostic<'_, G> for TargetFeatureDisableOrEnabl
130130
fluent::codegen_llvm_target_feature_disable_or_enable,
131131
);
132132
if let Some(span) = self.span {
133-
diag.set_span(span);
133+
diag.span(span);
134134
};
135135
if let Some(missing_features) = self.missing_features {
136136
diag.subdiagnostic(missing_features);
137137
}
138-
diag.set_arg("features", self.features.join(", "));
138+
diag.arg("features", self.features.join(", "));
139139
diag
140140
}
141141
}
@@ -205,8 +205,8 @@ impl<G: EmissionGuarantee> IntoDiagnostic<'_, G> for WithLlvmError<'_> {
205205
ParseBitcode => fluent::codegen_llvm_parse_bitcode_with_llvm_err,
206206
};
207207
let mut diag = self.0.into_diagnostic(dcx, level);
208-
diag.set_primary_message(msg_with_llvm_err);
209-
diag.set_arg("llvm_err", self.1);
208+
diag.primary_message(msg_with_llvm_err);
209+
diag.arg("llvm_err", self.1);
210210
diag
211211
}
212212
}

compiler/rustc_codegen_ssa/src/back/write.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1848,9 +1848,9 @@ impl SharedEmitterMain {
18481848
}
18491849
Ok(SharedEmitterMessage::InlineAsmError(cookie, msg, level, source)) => {
18501850
let err_level = match level {
1851-
Level::Error { lint: false } => rustc_errors::Level::Error { lint: false },
1852-
Level::Warning(_) => rustc_errors::Level::Warning(None),
1853-
Level::Note => rustc_errors::Level::Note,
1851+
Level::Error => Level::Error,
1852+
Level::Warning(_) => Level::Warning(None),
1853+
Level::Note => Level::Note,
18541854
_ => bug!("Invalid inline asm diagnostic level"),
18551855
};
18561856
let msg = msg.strip_prefix("error: ").unwrap_or(&msg).to_string();
@@ -1860,7 +1860,7 @@ impl SharedEmitterMain {
18601860
if cookie != 0 {
18611861
let pos = BytePos::from_u32(cookie);
18621862
let span = Span::with_root_ctxt(pos, pos);
1863-
err.set_span(span);
1863+
err.span(span);
18641864
};
18651865

18661866
// Point to the generated assembly if it is available.

0 commit comments

Comments
 (0)