1
Fork 0

Rollup merge of #130457 - nnethercote:cleanup-codegen-traits, r=bjorn3

Cleanup codegen traits

The traits governing codegen are quite complicated and hard to follow. This PR cleans them up a bit.

r? `@bjorn3`
This commit is contained in:
Matthias Krüger 2024-09-18 17:49:43 +02:00 committed by GitHub
commit 21313d7947
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
50 changed files with 154 additions and 226 deletions

View file

@ -2,7 +2,7 @@ use rustc_ast::Attribute;
use rustc_hir::def::DefKind;
use rustc_hir::def_id::LocalDefId;
use rustc_middle::span_bug;
use rustc_middle::ty::layout::{HasParamEnv, HasTyCtxt, LayoutError, LayoutOfHelpers, TyAndLayout};
use rustc_middle::ty::layout::{HasParamEnv, HasTyCtxt, LayoutError, LayoutOfHelpers};
use rustc_middle::ty::{self, ParamEnv, Ty, TyCtxt};
use rustc_span::source_map::Spanned;
use rustc_span::symbol::sym;
@ -139,8 +139,6 @@ struct UnwrapLayoutCx<'tcx> {
}
impl<'tcx> LayoutOfHelpers<'tcx> for UnwrapLayoutCx<'tcx> {
type LayoutOfResult = TyAndLayout<'tcx>;
fn handle_layout_err(&self, err: LayoutError<'tcx>, span: Span, ty: Ty<'tcx>) -> ! {
span_bug!(span, "`#[rustc_layout(..)]` test resulted in `layout_of({ty}) = Err({err})`",);
}