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

Commit 2efb0cd

Browse files
committed
Auto merge of rust-lang#103954 - matthiaskrgr:rollup-tskpxnj, r=matthiaskrgr
Rollup of 10 pull requests Successful merges: - rust-lang#103825 (Remove let_underscore_must_use from list of uplifted lints) - rust-lang#103884 (Add visit_fn_ret_ty to hir intravisit) - rust-lang#103892 (Properly render asyncness for trait fns without default body) - rust-lang#103905 (rustdoc: remove redundant mobile CSS `.sidebar-elems { background }`) - rust-lang#103912 (Add howto for adding new targets) - rust-lang#103915 (Improve use of ErrorGuaranteed and code cleanup) - rust-lang#103930 (Move some tests from `src/test/ui` to more reasonable places) - rust-lang#103931 (Add note to RELEASES.md regarding issue 102754.) - rust-lang#103938 (rustdoc: clean up hardcoded CSS border color on search results) - rust-lang#103940 (rustdoc: remove no-op CSS `#main-content > .item-info { margin-top: 0 }`) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents 15d7556 + 923d907 commit 2efb0cd

File tree

34 files changed

+125
-83
lines changed

34 files changed

+125
-83
lines changed

RELEASES.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Language
66
- [Error on `as` casts of enums with `#[non_exhaustive]` variants](https://github.com/rust-lang/rust/pull/92744/)
77
- [Stabilize `let else`](https://github.com/rust-lang/rust/pull/93628/)
88
- [Stabilize generic associated types (GATs)](https://github.com/rust-lang/rust/pull/96709/)
9-
- [Add lints `let_underscore_drop`, `let_underscore_lock`, and `let_underscore_must_use` from Clippy](https://github.com/rust-lang/rust/pull/97739/)
9+
- [Add lints `let_underscore_drop` and `let_underscore_lock` from Clippy](https://github.com/rust-lang/rust/pull/97739/)
1010
- [Stabilize `break`ing from arbitrary labeled blocks ("label-break-value")](https://github.com/rust-lang/rust/pull/99332/)
1111
- [Uninitialized integers, floats, and raw pointers are now considered immediate UB](https://github.com/rust-lang/rust/pull/98919/).
1212
Usage of `MaybeUninit` is the correct way to work with uninitialized memory.
@@ -87,6 +87,9 @@ Compatibility Notes
8787
This strengthens the forward compatibility lint deprecated_cfg_attr_crate_type_name to deny.
8888
- [`llvm-has-rust-patches` allows setting the build system to treat the LLVM as having Rust-specific patches](https://github.com/rust-lang/rust/pull/101072)
8989
This option may need to be set for distributions that are building Rust with a patched LLVM via `llvm-config`, not the built-in LLVM.
90+
- Combining three or more languages (e.g. Objective C, C++ and Rust) into one binary may hit linker limitations when using `lld`. For more information, see [issue 102754][102754].
91+
92+
[102754]: https://github.com/rust-lang/rust/issues/102754
9093

9194
Internal Changes
9295
----------------

compiler/rustc_const_eval/src/interpret/operand.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
use rustc_hir::def::Namespace;
55
use rustc_middle::ty::layout::{LayoutOf, PrimitiveExt, TyAndLayout};
66
use rustc_middle::ty::print::{FmtPrinter, PrettyPrinter};
7-
use rustc_middle::ty::{ConstInt, DelaySpanBugEmitted, Ty};
7+
use rustc_middle::ty::{ConstInt, Ty};
88
use rustc_middle::{mir, ty};
99
use rustc_target::abi::{self, Abi, Align, HasDataLayout, Size, TagEncoding};
1010
use rustc_target::abi::{VariantIdx, Variants};
@@ -567,7 +567,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
567567
ty::ConstKind::Param(_) | ty::ConstKind::Placeholder(..) => {
568568
throw_inval!(TooGeneric)
569569
}
570-
ty::ConstKind::Error(DelaySpanBugEmitted { reported, .. }) => {
570+
ty::ConstKind::Error(reported) => {
571571
throw_inval!(AlreadyReported(reported))
572572
}
573573
ty::ConstKind::Unevaluated(uv) => {

compiler/rustc_const_eval/src/transform/promote_consts.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,10 @@ impl<'tcx> MirPass<'tcx> for PromoteTemps<'tcx> {
4545
// There's not really any point in promoting errorful MIR.
4646
//
4747
// This does not include MIR that failed const-checking, which we still try to promote.
48-
if body.return_ty().references_error() {
49-
tcx.sess.delay_span_bug(body.span, "PromoteTemps: MIR had errors");
48+
if let Err(_) = body.return_ty().error_reported() {
49+
debug!("PromoteTemps: MIR had errors");
5050
return;
5151
}
52-
5352
if body.source.promoted.is_some() {
5453
return;
5554
}

compiler/rustc_hir/src/intravisit.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,9 @@ pub trait Visitor<'v>: Sized {
358358
fn visit_where_predicate(&mut self, predicate: &'v WherePredicate<'v>) {
359359
walk_where_predicate(self, predicate)
360360
}
361+
fn visit_fn_ret_ty(&mut self, ret_ty: &'v FnRetTy<'v>) {
362+
walk_fn_ret_ty(self, ret_ty)
363+
}
361364
fn visit_fn_decl(&mut self, fd: &'v FnDecl<'v>) {
362365
walk_fn_decl(self, fd)
363366
}
@@ -903,7 +906,7 @@ pub fn walk_fn_decl<'v, V: Visitor<'v>>(visitor: &mut V, function_declaration: &
903906
for ty in function_declaration.inputs {
904907
visitor.visit_ty(ty)
905908
}
906-
walk_fn_ret_ty(visitor, &function_declaration.output)
909+
visitor.visit_fn_ret_ty(&function_declaration.output)
907910
}
908911

909912
pub fn walk_fn_ret_ty<'v, V: Visitor<'v>>(visitor: &mut V, ret_ty: &'v FnRetTy<'v>) {

compiler/rustc_hir_analysis/src/astconv/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1979,7 +1979,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
19791979
}
19801980

19811981
err.emit()
1982-
} else if let Some(reported) = qself_ty.error_reported() {
1982+
} else if let Err(reported) = qself_ty.error_reported() {
19831983
reported
19841984
} else {
19851985
// Don't print `TyErr` to the user.

compiler/rustc_hir_analysis/src/coherence/orphan.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,7 @@ pub(crate) fn orphan_check_impl(
2323
impl_def_id: LocalDefId,
2424
) -> Result<(), ErrorGuaranteed> {
2525
let trait_ref = tcx.impl_trait_ref(impl_def_id).unwrap();
26-
if let Some(err) = trait_ref.error_reported() {
27-
return Err(err);
28-
}
26+
trait_ref.error_reported()?;
2927

3028
let ret = do_orphan_check_impl(tcx, trait_ref, impl_def_id);
3129
if tcx.trait_is_auto(trait_ref.def_id) {

compiler/rustc_hir_typeck/src/cast.rs

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
9494
debug!("pointer_kind({:?}, {:?})", t, span);
9595

9696
let t = self.resolve_vars_if_possible(t);
97-
98-
if let Some(reported) = t.error_reported() {
99-
return Err(reported);
100-
}
97+
t.error_reported()?;
10198

10299
if self.type_is_sized_modulo_regions(self.param_env, t, span) {
103100
return Ok(Some(PointerKind::Thin));
@@ -222,8 +219,7 @@ impl<'a, 'tcx> CastCheck<'tcx> {
222219
// inference is more completely known.
223220
match cast_ty.kind() {
224221
ty::Dynamic(_, _, ty::Dyn) | ty::Slice(..) => {
225-
let reported = check.report_cast_to_unsized_type(fcx);
226-
Err(reported)
222+
Err(check.report_cast_to_unsized_type(fcx))
227223
}
228224
_ => Ok(check),
229225
}
@@ -614,10 +610,11 @@ impl<'a, 'tcx> CastCheck<'tcx> {
614610
}
615611

616612
fn report_cast_to_unsized_type(&self, fcx: &FnCtxt<'a, 'tcx>) -> ErrorGuaranteed {
617-
if let Some(reported) =
618-
self.cast_ty.error_reported().or_else(|| self.expr_ty.error_reported())
619-
{
620-
return reported;
613+
if let Err(err) = self.cast_ty.error_reported() {
614+
return err;
615+
}
616+
if let Err(err) = self.expr_ty.error_reported() {
617+
return err;
621618
}
622619

623620
let tstr = fcx.ty_to_string(self.cast_ty);

compiler/rustc_middle/src/traits/specialization_graph.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ pub fn ancestors<'tcx>(
262262

263263
if let Some(reported) = specialization_graph.has_errored {
264264
Err(reported)
265-
} else if let Some(reported) = tcx.type_of(start_from_impl).error_reported() {
265+
} else if let Err(reported) = tcx.type_of(start_from_impl).error_reported() {
266266
Err(reported)
267267
} else {
268268
Ok(Ancestors {

compiler/rustc_middle/src/ty/abstract_const.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//! A subset of a mir body used for const evaluatability checking.
22
use crate::mir;
33
use crate::ty::visit::TypeVisitable;
4-
use crate::ty::{self, DelaySpanBugEmitted, EarlyBinder, SubstsRef, Ty, TyCtxt};
4+
use crate::ty::{self, EarlyBinder, SubstsRef, Ty, TyCtxt};
55
use rustc_errors::ErrorGuaranteed;
66
use rustc_hir::def_id::DefId;
77
use std::cmp;
@@ -43,7 +43,7 @@ impl<'tcx> AbstractConst<'tcx> {
4343
) -> Result<Option<AbstractConst<'tcx>>, ErrorGuaranteed> {
4444
match ct.kind() {
4545
ty::ConstKind::Unevaluated(uv) => AbstractConst::new(tcx, uv),
46-
ty::ConstKind::Error(DelaySpanBugEmitted { reported, .. }) => Err(reported),
46+
ty::ConstKind::Error(reported) => Err(reported),
4747
_ => Ok(None),
4848
}
4949
}

compiler/rustc_middle/src/ty/consts/kind.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ pub enum ConstKind<'tcx> {
6969

7070
/// A placeholder for a const which could not be computed; this is
7171
/// propagated to avoid useless error messages.
72-
Error(ty::DelaySpanBugEmitted),
72+
Error(ErrorGuaranteed),
7373
}
7474

7575
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]

0 commit comments

Comments
 (0)