]> git.lizzy.rs Git - rust.git/commitdiff
Simplify change to layout_of
authorEsteban Küber <esteban@kuber.com.ar>
Sun, 4 Aug 2019 05:04:39 +0000 (22:04 -0700)
committerEsteban Küber <esteban@kuber.com.ar>
Sun, 4 Aug 2019 05:04:39 +0000 (22:04 -0700)
src/librustc/lint/context.rs
src/librustc/ty/layout.rs
src/librustc_codegen_llvm/builder.rs
src/librustc_codegen_ssa/mir/rvalue.rs
src/librustc_mir/interpret/eval_context.rs
src/librustc_mir/transform/const_prop.rs
src/librustc_passes/layout_test.rs
src/librustc_target/abi/mod.rs

index 7d9653a9a55b15d6b2447673962fee56f5dffdc4..de812410e8bd83260f66925bcabbe285fbc0ee7d 100644 (file)
@@ -901,9 +901,6 @@ impl<'a, 'tcx> LayoutOf for LateContext<'a, 'tcx> {
     fn layout_of(&self, ty: Ty<'tcx>) -> Self::TyLayout {
         self.tcx.layout_of(self.param_env.and(ty))
     }
-    fn spanned_layout_of(&self, ty: Ty<'tcx>, _: Option<Span>) -> Self::TyLayout {
-        self.layout_of(ty)
-    }
 }
 
 impl<'a, 'tcx, T: LateLintPass<'a, 'tcx>> LateContextAndPass<'a, 'tcx, T> {
index 14d35fd4ce891b86a572b838bf29df8038b62999..3b4b814c92a90fff9d37846b58db408df5af67bc 100644 (file)
@@ -3,7 +3,7 @@
 
 use syntax::ast::{self, Ident, IntTy, UintTy};
 use syntax::attr;
-use syntax_pos::{DUMMY_SP, Span};
+use syntax_pos::DUMMY_SP;
 
 use std::cmp;
 use std::fmt;
@@ -1943,9 +1943,6 @@ fn layout_of(&self, ty: Ty<'tcx>) -> Self::TyLayout {
 
         Ok(layout)
     }
-    fn spanned_layout_of(&self, ty: Ty<'tcx>, _: Option<Span>) -> Self::TyLayout {
-        self.layout_of(ty)
-    }
 }
 
 impl LayoutOf for LayoutCx<'tcx, ty::query::TyCtxtAt<'tcx>> {
@@ -1977,9 +1974,6 @@ fn layout_of(&self, ty: Ty<'tcx>) -> Self::TyLayout {
 
         Ok(layout)
     }
-    fn spanned_layout_of(&self, ty: Ty<'tcx>, _: Option<Span>) -> Self::TyLayout {
-        self.layout_of(ty)
-    }
 }
 
 // Helper (inherent) `layout_of` methods to avoid pushing `LayoutCx` to users.
index c01ba728034ced9b93460b3196cc691b5c173e82..894e5c2fd3d93049d53f513039659813952b593b 100644 (file)
@@ -6,7 +6,6 @@
 use crate::type_of::LayoutLlvmExt;
 use crate::value::Value;
 use syntax::symbol::LocalInternedString;
-use syntax::source_map::Span;
 use rustc_codegen_ssa::common::{IntPredicate, TypeKind, RealPredicate};
 use rustc_codegen_ssa::MemFlags;
 use libc::{c_uint, c_char};
@@ -91,9 +90,6 @@ impl ty::layout::LayoutOf for Builder<'_, '_, 'tcx> {
     fn layout_of(&self, ty: Ty<'tcx>) -> Self::TyLayout {
         self.cx.layout_of(ty)
     }
-    fn spanned_layout_of(&self, ty: Ty<'tcx>, _: Option<Span>) -> Self::TyLayout {
-        self.cx.layout_of(ty)
-    }
 }
 
 impl Deref for Builder<'_, 'll, 'tcx> {
index 56c76cdc026f733733e7ab5d4d555ad413a2a986..4df45d1586086ae3368ca7f2831412a901ec0691 100644 (file)
@@ -713,7 +713,6 @@ pub fn rvalue_creates_operand(&self, rvalue: &mir::Rvalue<'tcx>, span: Option<Sp
                 let ty = rvalue.ty(self.mir, self.cx.tcx());
                 let ty = self.monomorphize(&ty);
                 self.cx.spanned_layout_of(ty, span).is_zst()
-                // self.cx.layout_of(ty).is_zst()
             }
         }
 
index 605afa7b3681021a3f995faee684cdb1315e4076..1f23d8c017ccd0d570262de6eb2e5fca27494012 100644 (file)
@@ -193,9 +193,6 @@ fn layout_of(&self, ty: Ty<'tcx>) -> Self::TyLayout {
             .layout_of(self.param_env.and(ty))
             .map_err(|layout| err_inval!(Layout(layout)).into())
     }
-    fn spanned_layout_of(&self, ty: Ty<'tcx>, _: Option<Span>) -> Self::TyLayout {
-        self.layout_of(ty)
-    }
 }
 
 impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
@@ -509,7 +506,7 @@ pub fn size_and_align_of_mplace(
     pub fn push_stack_frame(
         &mut self,
         instance: ty::Instance<'tcx>,
-        span: source_map::Span,
+        span: Span,
         body: &'mir mir::Body<'tcx>,
         return_place: Option<PlaceTy<'tcx, M::PointerTag>>,
         return_to_block: StackPopCleanup,
index 18b6f408fe12c0089a9cd140a08f72af89b0dbae..a450ec32e1a478410a432d9c971c7d9b32f6dbab 100644 (file)
@@ -134,9 +134,6 @@ impl<'mir, 'tcx> LayoutOf for ConstPropagator<'mir, 'tcx> {
     fn layout_of(&self, ty: Ty<'tcx>) -> Self::TyLayout {
         self.tcx.layout_of(self.param_env.and(ty))
     }
-    fn spanned_layout_of(&self, ty: Ty<'tcx>, _: Option<Span>) -> Self::TyLayout {
-        self.layout_of(ty)
-    }
 }
 
 impl<'mir, 'tcx> HasDataLayout for ConstPropagator<'mir, 'tcx> {
index 8c4635f3566ca316a2588f9af9de2e3ed6291427..95cb8de70675d12c604572560870fe51fb006c9f 100644 (file)
@@ -13,7 +13,6 @@
 use rustc::ty::TyCtxt;
 use syntax::ast::Attribute;
 use syntax::symbol::sym;
-use syntax::source_map::Span;
 
 pub fn test_layout(tcx: TyCtxt<'_>) {
     if tcx.features().rustc_attrs {
@@ -117,9 +116,6 @@ impl LayoutOf for UnwrapLayoutCx<'tcx> {
     fn layout_of(&self, ty: Ty<'tcx>) -> Self::TyLayout {
         self.tcx.layout_of(self.param_env.and(ty)).unwrap()
     }
-    fn spanned_layout_of(&self, ty: Ty<'tcx>, _: Option<Span>) -> Self::TyLayout {
-        self.layout_of(ty)
-    }
 }
 
 impl HasTyCtxt<'tcx> for UnwrapLayoutCx<'tcx> {
index c4f38f4a7f4c385a536797b3dd9969bec2016728..4f53c7795c2be0652aa2584e2feaf4f07d3c548e 100644 (file)
@@ -1013,7 +1013,9 @@ pub trait LayoutOf {
     type TyLayout;
 
     fn layout_of(&self, ty: Self::Ty) -> Self::TyLayout;
-    fn spanned_layout_of(&self, ty: Self::Ty, span: Option<Span>) -> Self::TyLayout;
+    fn spanned_layout_of(&self, ty: Self::Ty, _span: Option<Span>) -> Self::TyLayout {
+        self.layout_of(ty)
+    }
 }
 
 #[derive(Copy, Clone, PartialEq, Eq)]