Skip to content

Commit 65b323b

Browse files
committed
Auto merge of rust-lang#119837 - matthiaskrgr:rollup-l2olpad, r=matthiaskrgr
Rollup of 11 pull requests Successful merges: - rust-lang#115046 (Use version-sorting for all sorting) - rust-lang#118915 (Add some comments, add `can_define_opaque_ty` check to `try_normalize_ty_recur`) - rust-lang#119006 (Fix is_global special address handling) - rust-lang#119637 (Pass LLVM error message back to pass wrapper.) - rust-lang#119715 (Exhaustiveness: abort on type error) - rust-lang#119763 (Cleanup things in and around `Diagnostic`) - rust-lang#119788 (change function name in comments) - rust-lang#119790 (Fix all_trait* methods to return all traits available in StableMIR) - rust-lang#119803 (Silence some follow-up errors [1/x]) - rust-lang#119804 (Stabilize mutex_unpoison feature) - rust-lang#119832 (Meta: Add project const traits to triagebot config) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 0a89233 + 1189d23 commit 65b323b

File tree

54 files changed

+690
-303
lines changed

Some content is hidden

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

54 files changed

+690
-303
lines changed

compiler/rustc_borrowck/src/diagnostics/explain_borrow.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ impl<'tcx> BorrowExplanation<'tcx> {
315315
let mut failed = false;
316316

317317
let elaborated_args = std::iter::zip(*args, &generics.params).map(|(arg, param)| {
318-
if let Some(ty::Dynamic(obj, _, ty::DynKind::Dyn)) = arg.as_type().map(Ty::kind) {
318+
if let Some(ty::Dynamic(obj, _, ty::Dyn)) = arg.as_type().map(Ty::kind) {
319319
let default = tcx.object_lifetime_default(param.def_id);
320320

321321
let re_static = tcx.lifetimes.re_static;
@@ -339,7 +339,7 @@ impl<'tcx> BorrowExplanation<'tcx> {
339339

340340
has_dyn = true;
341341

342-
Ty::new_dynamic(tcx, obj, implied_region, ty::DynKind::Dyn).into()
342+
Ty::new_dynamic(tcx, obj, implied_region, ty::Dyn).into()
343343
} else {
344344
arg
345345
}

compiler/rustc_builtin_macros/src/test.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,7 @@ fn not_testable_error(cx: &ExtCtxt<'_>, attr_sp: Span, item: Option<&ast::Item>)
394394
let level = match item.map(|i| &i.kind) {
395395
// These were a warning before #92959 and need to continue being that to avoid breaking
396396
// stable user code (#94508).
397-
Some(ast::ItemKind::MacCall(_)) => Level::Warning(None),
397+
Some(ast::ItemKind::MacCall(_)) => Level::Warning,
398398
_ => Level::Error,
399399
};
400400
let mut err = DiagnosticBuilder::<()>::new(dcx, level, msg);

compiler/rustc_codegen_llvm/src/back/write.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,7 @@ fn report_inline_asm(
417417
}
418418
let level = match level {
419419
llvm::DiagnosticLevel::Error => Level::Error,
420-
llvm::DiagnosticLevel::Warning => Level::Warning(None),
420+
llvm::DiagnosticLevel::Warning => Level::Warning,
421421
llvm::DiagnosticLevel::Note | llvm::DiagnosticLevel::Remark => Level::Note,
422422
};
423423
cgcx.diag_emitter.inline_asm_error(cookie as u32, msg, level, source);

compiler/rustc_codegen_ssa/src/back/write.rs

+2-7
Original file line numberDiff line numberDiff line change
@@ -1847,14 +1847,9 @@ impl SharedEmitterMain {
18471847
dcx.emit_diagnostic(d);
18481848
}
18491849
Ok(SharedEmitterMessage::InlineAsmError(cookie, msg, level, source)) => {
1850-
let err_level = match level {
1851-
Level::Error => Level::Error,
1852-
Level::Warning(_) => Level::Warning(None),
1853-
Level::Note => Level::Note,
1854-
_ => bug!("Invalid inline asm diagnostic level"),
1855-
};
1850+
assert!(matches!(level, Level::Error | Level::Warning | Level::Note));
18561851
let msg = msg.strip_prefix("error: ").unwrap_or(&msg).to_string();
1857-
let mut err = DiagnosticBuilder::<()>::new(sess.dcx(), err_level, msg);
1852+
let mut err = DiagnosticBuilder::<()>::new(sess.dcx(), level, msg);
18581853

18591854
// If the cookie is 0 then we don't have span information.
18601855
if cookie != 0 {

compiler/rustc_errors/src/annotate_snippet_emitter_writer.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ fn source_string(file: Lrc<SourceFile>, line: &Line) -> String {
8787
fn annotation_type_for_level(level: Level) -> AnnotationType {
8888
match level {
8989
Level::Bug | Level::DelayedBug | Level::Fatal | Level::Error => AnnotationType::Error,
90-
Level::Warning(_) => AnnotationType::Warning,
90+
Level::ForceWarning(_) | Level::Warning => AnnotationType::Warning,
9191
Level::Note | Level::OnceNote => AnnotationType::Note,
9292
Level::Help | Level::OnceHelp => AnnotationType::Help,
9393
// FIXME(#59346): Not sure how to map this level

compiler/rustc_errors/src/diagnostic.rs

+10-7
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,6 @@ pub enum DiagnosticId {
152152
name: String,
153153
/// Indicates whether this lint should show up in cargo's future breakage report.
154154
has_future_breakage: bool,
155-
is_force_warn: bool,
156155
},
157156
}
158157

@@ -248,7 +247,8 @@ impl Diagnostic {
248247
true
249248
}
250249

251-
Level::Warning(_)
250+
Level::ForceWarning(_)
251+
| Level::Warning
252252
| Level::Note
253253
| Level::OnceNote
254254
| Level::Help
@@ -262,7 +262,7 @@ impl Diagnostic {
262262
&mut self,
263263
unstable_to_stable: &FxIndexMap<LintExpectationId, LintExpectationId>,
264264
) {
265-
if let Level::Expect(expectation_id) | Level::Warning(Some(expectation_id)) =
265+
if let Level::Expect(expectation_id) | Level::ForceWarning(Some(expectation_id)) =
266266
&mut self.level
267267
{
268268
if expectation_id.is_stable() {
@@ -292,8 +292,11 @@ impl Diagnostic {
292292
}
293293

294294
pub(crate) fn is_force_warn(&self) -> bool {
295-
match self.code {
296-
Some(DiagnosticId::Lint { is_force_warn, .. }) => is_force_warn,
295+
match self.level {
296+
Level::ForceWarning(_) => {
297+
assert!(self.is_lint);
298+
true
299+
}
297300
_ => false,
298301
}
299302
}
@@ -472,7 +475,7 @@ impl Diagnostic {
472475
/// Add a warning attached to this diagnostic.
473476
#[rustc_lint_diagnostics]
474477
pub fn warn(&mut self, msg: impl Into<SubdiagnosticMessage>) -> &mut Self {
475-
self.sub(Level::Warning(None), msg, MultiSpan::new());
478+
self.sub(Level::Warning, msg, MultiSpan::new());
476479
self
477480
}
478481

@@ -484,7 +487,7 @@ impl Diagnostic {
484487
sp: S,
485488
msg: impl Into<SubdiagnosticMessage>,
486489
) -> &mut Self {
487-
self.sub(Level::Warning(None), msg, sp.into());
490+
self.sub(Level::Warning, msg, sp.into());
488491
self
489492
}
490493

compiler/rustc_errors/src/json.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ impl Emitter for JsonEmitter {
198198
.into_iter()
199199
.map(|mut diag| {
200200
if diag.level == crate::Level::Allow {
201-
diag.level = crate::Level::Warning(None);
201+
diag.level = crate::Level::Warning;
202202
}
203203
FutureBreakageItem {
204204
diagnostic: EmitTyped::Diagnostic(Diagnostic::from_errors_diagnostic(

0 commit comments

Comments
 (0)