Skip to content

Commit 8d36948

Browse files
committed
Auto merge of #104168 - GuillaumeGomez:rollup-tf4edqc, r=GuillaumeGomez
Rollup of 12 pull requests Successful merges: - #103928 (Add 'ty_error_with_guaranteed' and 'const_error_with_guaranteed') - #104027 (Place config.toml in current working directory if config not found) - #104093 (disable btree size tests on Miri) - #104097 (run alloc benchmarks in Miri and fix UB) - #104104 (Add split-debuginfo print option) - #104109 (rustdoc: Add mutable to the description) - #104113 (Fix `const_fn_trait_ref_impl`, add test for it) - #104114 (Fix invalid background-image file name) - #104132 (fix: lint against lint functions) - #104139 (Clarify licensing situation of MPSC and SPSC queue) - #104147 (Remove an address comparison from the parser) - #104165 (Add llvm-main to triagebot.toml) Failed merges: - #104115 (Migrate crate-search element to CSS variables) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 85f4f41 + c46cc1d commit 8d36948

File tree

36 files changed

+235
-93
lines changed

36 files changed

+235
-93
lines changed

compiler/rustc_borrowck/src/region_infer/opaque_types.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -299,8 +299,8 @@ impl<'tcx> InferCtxtExt<'tcx> for InferCtxt<'tcx> {
299299
if errors.is_empty() {
300300
definition_ty
301301
} else {
302-
infcx.err_ctxt().report_fulfillment_errors(&errors, None);
303-
self.tcx.ty_error()
302+
let reported = infcx.err_ctxt().report_fulfillment_errors(&errors, None);
303+
self.tcx.ty_error_with_guaranteed(reported)
304304
}
305305
}
306306
}

compiler/rustc_borrowck/src/type_check/free_region_relations.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -247,12 +247,13 @@ impl<'tcx> UniversalRegionRelationsBuilder<'_, 'tcx> {
247247
.and(type_op::normalize::Normalize::new(ty))
248248
.fully_perform(self.infcx)
249249
.unwrap_or_else(|_| {
250-
self.infcx
250+
let reported = self
251+
.infcx
251252
.tcx
252253
.sess
253254
.delay_span_bug(span, &format!("failed to normalize {:?}", ty));
254255
TypeOpOutput {
255-
output: self.infcx.tcx.ty_error(),
256+
output: self.infcx.tcx.ty_error_with_guaranteed(reported),
256257
constraints: None,
257258
error_info: None,
258259
}

compiler/rustc_borrowck/src/type_check/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,11 +233,11 @@ pub(crate) fn type_check<'mir, 'tcx>(
233233
let mut hidden_type = infcx.resolve_vars_if_possible(decl.hidden_type);
234234
trace!("finalized opaque type {:?} to {:#?}", opaque_type_key, hidden_type.ty.kind());
235235
if hidden_type.has_non_region_infer() {
236-
infcx.tcx.sess.delay_span_bug(
236+
let reported = infcx.tcx.sess.delay_span_bug(
237237
decl.hidden_type.span,
238238
&format!("could not resolve {:#?}", hidden_type.ty.kind()),
239239
);
240-
hidden_type.ty = infcx.tcx.ty_error();
240+
hidden_type.ty = infcx.tcx.ty_error_with_guaranteed(reported);
241241
}
242242

243243
(opaque_type_key, (hidden_type, decl.origin))

compiler/rustc_driver/src/lib.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -736,6 +736,17 @@ fn print_crate_info(
736736
// Any output here interferes with Cargo's parsing of other printed output
737737
NativeStaticLibs => {}
738738
LinkArgs => {}
739+
SplitDebuginfo => {
740+
use rustc_target::spec::SplitDebuginfo::{Off, Packed, Unpacked};
741+
742+
for split in &[Off, Packed, Unpacked] {
743+
let stable = sess.target.options.supported_split_debuginfo.contains(split);
744+
let unstable_ok = sess.unstable_options();
745+
if stable || unstable_ok {
746+
println!("{}", split);
747+
}
748+
}
749+
}
739750
}
740751
}
741752
Compilation::Stop

compiler/rustc_errors/src/diagnostic_builder.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -482,9 +482,9 @@ impl<'a, G: EmissionGuarantee> DiagnosticBuilder<'a, G> {
482482
/// In the meantime, though, callsites are required to deal with the "bug"
483483
/// locally in whichever way makes the most sense.
484484
#[track_caller]
485-
pub fn delay_as_bug(&mut self) {
485+
pub fn delay_as_bug(&mut self) -> G {
486486
self.downgrade_to_delayed_bug();
487-
self.emit();
487+
self.emit()
488488
}
489489

490490
forward!(

compiler/rustc_hir_analysis/src/astconv/mod.rs

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1201,7 +1201,8 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
12011201
(_, _) => {
12021202
let got = if let Some(_) = term.ty() { "type" } else { "constant" };
12031203
let expected = def_kind.descr(assoc_item_def_id);
1204-
tcx.sess
1204+
let reported = tcx
1205+
.sess
12051206
.struct_span_err(
12061207
binding.span,
12071208
&format!("expected {expected} bound, found {got}"),
@@ -1212,11 +1213,14 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
12121213
)
12131214
.emit();
12141215
term = match def_kind {
1215-
hir::def::DefKind::AssocTy => tcx.ty_error().into(),
1216+
hir::def::DefKind::AssocTy => {
1217+
tcx.ty_error_with_guaranteed(reported).into()
1218+
}
12161219
hir::def::DefKind::AssocConst => tcx
1217-
.const_error(
1220+
.const_error_with_guaranteed(
12181221
tcx.bound_type_of(assoc_item_def_id)
12191222
.subst(tcx, projection_ty.skip_binder().substs),
1223+
reported,
12201224
)
12211225
.into(),
12221226
_ => unreachable!(),
@@ -1334,8 +1338,9 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
13341338
.map(|&(trait_ref, _, _)| trait_ref.def_id())
13351339
.find(|&trait_ref| tcx.is_trait_alias(trait_ref))
13361340
.map(|trait_ref| tcx.def_span(trait_ref));
1337-
tcx.sess.emit_err(TraitObjectDeclaredWithNoTraits { span, trait_alias_span });
1338-
return tcx.ty_error();
1341+
let reported =
1342+
tcx.sess.emit_err(TraitObjectDeclaredWithNoTraits { span, trait_alias_span });
1343+
return tcx.ty_error_with_guaranteed(reported);
13391344
}
13401345

13411346
// Check that there are no gross object safety violations;
@@ -1345,14 +1350,14 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
13451350
let object_safety_violations =
13461351
astconv_object_safety_violations(tcx, item.trait_ref().def_id());
13471352
if !object_safety_violations.is_empty() {
1348-
report_object_safety_error(
1353+
let reported = report_object_safety_error(
13491354
tcx,
13501355
span,
13511356
item.trait_ref().def_id(),
13521357
&object_safety_violations,
13531358
)
13541359
.emit();
1355-
return tcx.ty_error();
1360+
return tcx.ty_error_with_guaranteed(reported);
13561361
}
13571362
}
13581363

@@ -2112,13 +2117,13 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
21122117
"Type"
21132118
};
21142119

2115-
self.report_ambiguous_associated_type(
2120+
let reported = self.report_ambiguous_associated_type(
21162121
span,
21172122
type_name,
21182123
&path_str,
21192124
item_segment.ident.name,
21202125
);
2121-
return tcx.ty_error();
2126+
return tcx.ty_error_with_guaranteed(reported)
21222127
};
21232128

21242129
debug!("qpath_to_ty: self_type={:?}", self_ty);
@@ -2560,8 +2565,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
25602565
{
25612566
err.span_note(impl_.self_ty.span, "not a concrete type");
25622567
}
2563-
err.emit();
2564-
tcx.ty_error()
2568+
tcx.ty_error_with_guaranteed(err.emit())
25652569
} else {
25662570
self.normalize_ty(span, ty)
25672571
}

compiler/rustc_hir_analysis/src/check/compare_method.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -611,11 +611,11 @@ pub fn collect_trait_impl_trait_tys<'tcx>(
611611
collected_tys.insert(def_id, ty);
612612
}
613613
Err(err) => {
614-
tcx.sess.delay_span_bug(
614+
let reported = tcx.sess.delay_span_bug(
615615
return_span,
616616
format!("could not fully resolve: {ty} => {err:?}"),
617617
);
618-
collected_tys.insert(def_id, tcx.ty_error());
618+
collected_tys.insert(def_id, tcx.ty_error_with_guaranteed(reported));
619619
}
620620
}
621621
}

compiler/rustc_hir_analysis/src/collect.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -512,8 +512,7 @@ impl<'tcx> AstConv<'tcx> for ItemCtxt<'tcx> {
512512
}
513513
_ => {}
514514
}
515-
err.emit();
516-
self.tcx().ty_error()
515+
self.tcx().ty_error_with_guaranteed(err.emit())
517516
}
518517
}
519518

compiler/rustc_hir_analysis/src/collect/type_of.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -698,7 +698,7 @@ fn find_opaque_ty_constraints_for_tait(tcx: TyCtxt<'_>, def_id: LocalDefId) -> T
698698
}
699699

700700
let Some(hidden) = locator.found else {
701-
tcx.sess.emit_err(UnconstrainedOpaqueType {
701+
let reported = tcx.sess.emit_err(UnconstrainedOpaqueType {
702702
span: tcx.def_span(def_id),
703703
name: tcx.item_name(tcx.local_parent(def_id).to_def_id()),
704704
what: match tcx.hir().get(scope) {
@@ -708,7 +708,7 @@ fn find_opaque_ty_constraints_for_tait(tcx: TyCtxt<'_>, def_id: LocalDefId) -> T
708708
_ => "item",
709709
},
710710
});
711-
return tcx.ty_error();
711+
return tcx.ty_error_with_guaranteed(reported);
712712
};
713713

714714
// Only check against typeck if we didn't already error

compiler/rustc_hir_typeck/src/coercion.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1639,9 +1639,9 @@ impl<'tcx, 'exprs, E: AsCoercionSite> CoerceMany<'tcx, 'exprs, E> {
16391639
if visitor.ret_exprs.len() > 0 && let Some(expr) = expression {
16401640
self.note_unreachable_loop_return(&mut err, &expr, &visitor.ret_exprs);
16411641
}
1642-
err.emit_unless(unsized_return);
1642+
let reported = err.emit_unless(unsized_return);
16431643

1644-
self.final_ty = Some(fcx.tcx.ty_error());
1644+
self.final_ty = Some(fcx.tcx.ty_error_with_guaranteed(reported));
16451645
}
16461646
}
16471647
}

0 commit comments

Comments
 (0)