Skip to content

Commit 2340067

Browse files
committed
Simplify change to layout_of
1 parent db099fb commit 2340067

File tree

8 files changed

+5
-27
lines changed

8 files changed

+5
-27
lines changed

src/librustc/lint/context.rs

-3
Original file line numberDiff line numberDiff line change
@@ -901,9 +901,6 @@ impl<'a, 'tcx> LayoutOf for LateContext<'a, 'tcx> {
901901
fn layout_of(&self, ty: Ty<'tcx>) -> Self::TyLayout {
902902
self.tcx.layout_of(self.param_env.and(ty))
903903
}
904-
fn spanned_layout_of(&self, ty: Ty<'tcx>, _: Option<Span>) -> Self::TyLayout {
905-
self.layout_of(ty)
906-
}
907904
}
908905

909906
impl<'a, 'tcx, T: LateLintPass<'a, 'tcx>> LateContextAndPass<'a, 'tcx, T> {

src/librustc/ty/layout.rs

+1-7
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use crate::ty::{self, Ty, TyCtxt, TypeFoldable, ReprOptions};
33

44
use syntax::ast::{self, Ident, IntTy, UintTy};
55
use syntax::attr;
6-
use syntax_pos::{DUMMY_SP, Span};
6+
use syntax_pos::DUMMY_SP;
77

88
use std::cmp;
99
use std::fmt;
@@ -1943,9 +1943,6 @@ impl<'tcx> LayoutOf for LayoutCx<'tcx, TyCtxt<'tcx>> {
19431943

19441944
Ok(layout)
19451945
}
1946-
fn spanned_layout_of(&self, ty: Ty<'tcx>, _: Option<Span>) -> Self::TyLayout {
1947-
self.layout_of(ty)
1948-
}
19491946
}
19501947

19511948
impl LayoutOf for LayoutCx<'tcx, ty::query::TyCtxtAt<'tcx>> {
@@ -1977,9 +1974,6 @@ impl LayoutOf for LayoutCx<'tcx, ty::query::TyCtxtAt<'tcx>> {
19771974

19781975
Ok(layout)
19791976
}
1980-
fn spanned_layout_of(&self, ty: Ty<'tcx>, _: Option<Span>) -> Self::TyLayout {
1981-
self.layout_of(ty)
1982-
}
19831977
}
19841978

19851979
// Helper (inherent) `layout_of` methods to avoid pushing `LayoutCx` to users.

src/librustc_codegen_llvm/builder.rs

-4
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ use crate::type_::Type;
66
use crate::type_of::LayoutLlvmExt;
77
use crate::value::Value;
88
use syntax::symbol::LocalInternedString;
9-
use syntax::source_map::Span;
109
use rustc_codegen_ssa::common::{IntPredicate, TypeKind, RealPredicate};
1110
use rustc_codegen_ssa::MemFlags;
1211
use libc::{c_uint, c_char};
@@ -91,9 +90,6 @@ impl ty::layout::LayoutOf for Builder<'_, '_, 'tcx> {
9190
fn layout_of(&self, ty: Ty<'tcx>) -> Self::TyLayout {
9291
self.cx.layout_of(ty)
9392
}
94-
fn spanned_layout_of(&self, ty: Ty<'tcx>, _: Option<Span>) -> Self::TyLayout {
95-
self.cx.layout_of(ty)
96-
}
9793
}
9894

9995
impl Deref for Builder<'_, 'll, 'tcx> {

src/librustc_codegen_ssa/mir/rvalue.rs

-1
Original file line numberDiff line numberDiff line change
@@ -713,7 +713,6 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
713713
let ty = rvalue.ty(self.mir, self.cx.tcx());
714714
let ty = self.monomorphize(&ty);
715715
self.cx.spanned_layout_of(ty, span).is_zst()
716-
// self.cx.layout_of(ty).is_zst()
717716
}
718717
}
719718

src/librustc_mir/interpret/eval_context.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -193,9 +193,6 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> LayoutOf for InterpCx<'mir, 'tcx, M> {
193193
.layout_of(self.param_env.and(ty))
194194
.map_err(|layout| err_inval!(Layout(layout)).into())
195195
}
196-
fn spanned_layout_of(&self, ty: Ty<'tcx>, _: Option<Span>) -> Self::TyLayout {
197-
self.layout_of(ty)
198-
}
199196
}
200197

201198
impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
@@ -509,7 +506,7 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
509506
pub fn push_stack_frame(
510507
&mut self,
511508
instance: ty::Instance<'tcx>,
512-
span: source_map::Span,
509+
span: Span,
513510
body: &'mir mir::Body<'tcx>,
514511
return_place: Option<PlaceTy<'tcx, M::PointerTag>>,
515512
return_to_block: StackPopCleanup,

src/librustc_mir/transform/const_prop.rs

-3
Original file line numberDiff line numberDiff line change
@@ -134,9 +134,6 @@ impl<'mir, 'tcx> LayoutOf for ConstPropagator<'mir, 'tcx> {
134134
fn layout_of(&self, ty: Ty<'tcx>) -> Self::TyLayout {
135135
self.tcx.layout_of(self.param_env.and(ty))
136136
}
137-
fn spanned_layout_of(&self, ty: Ty<'tcx>, _: Option<Span>) -> Self::TyLayout {
138-
self.layout_of(ty)
139-
}
140137
}
141138

142139
impl<'mir, 'tcx> HasDataLayout for ConstPropagator<'mir, 'tcx> {

src/librustc_passes/layout_test.rs

-4
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ use rustc::ty::Ty;
1313
use rustc::ty::TyCtxt;
1414
use syntax::ast::Attribute;
1515
use syntax::symbol::sym;
16-
use syntax::source_map::Span;
1716

1817
pub fn test_layout(tcx: TyCtxt<'_>) {
1918
if tcx.features().rustc_attrs {
@@ -117,9 +116,6 @@ impl LayoutOf for UnwrapLayoutCx<'tcx> {
117116
fn layout_of(&self, ty: Ty<'tcx>) -> Self::TyLayout {
118117
self.tcx.layout_of(self.param_env.and(ty)).unwrap()
119118
}
120-
fn spanned_layout_of(&self, ty: Ty<'tcx>, _: Option<Span>) -> Self::TyLayout {
121-
self.layout_of(ty)
122-
}
123119
}
124120

125121
impl HasTyCtxt<'tcx> for UnwrapLayoutCx<'tcx> {

src/librustc_target/abi/mod.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -1013,7 +1013,9 @@ pub trait LayoutOf {
10131013
type TyLayout;
10141014

10151015
fn layout_of(&self, ty: Self::Ty) -> Self::TyLayout;
1016-
fn spanned_layout_of(&self, ty: Self::Ty, span: Option<Span>) -> Self::TyLayout;
1016+
fn spanned_layout_of(&self, ty: Self::Ty, _span: Option<Span>) -> Self::TyLayout {
1017+
self.layout_of(ty)
1018+
}
10171019
}
10181020

10191021
#[derive(Copy, Clone, PartialEq, Eq)]

0 commit comments

Comments
 (0)