about summary refs log tree commit diff
path: root/compiler/rustc_lint/src
diff options
context:
space:
mode:
authorEduard-Mihai Burtescu <eddyb@lyken.rs>2021-08-25 16:40:39 +0300
committerEduard-Mihai Burtescu <eddyb@lyken.rs>2021-08-27 13:09:32 +0300
commit87d1fb747f8ed3dde3cd36c17d1ef735872a7bf9 (patch)
tree0557567511048be5e9f425d3d0e7ad7fcb4c9e17 /compiler/rustc_lint/src
parent8486571a10ce57b02ae19bfb1b31736fb2a1b4fe (diff)
downloadrust-87d1fb747f8ed3dde3cd36c17d1ef735872a7bf9.tar.gz
rust-87d1fb747f8ed3dde3cd36c17d1ef735872a7bf9.zip
rustc_target: require `TyAbiInterface` in `LayoutOf`.
Diffstat (limited to 'compiler/rustc_lint/src')
-rw-r--r--compiler/rustc_lint/src/context.rs23
1 files changed, 22 insertions, 1 deletions
diff --git a/compiler/rustc_lint/src/context.rs b/compiler/rustc_lint/src/context.rs
index 6c622a43015..7dbc3d60439 100644
--- a/compiler/rustc_lint/src/context.rs
+++ b/compiler/rustc_lint/src/context.rs
@@ -41,7 +41,7 @@ use rustc_session::Session;
 use rustc_session::SessionLintStore;
 use rustc_span::lev_distance::find_best_match_for_name;
 use rustc_span::{symbol::Symbol, MultiSpan, Span, DUMMY_SP};
-use rustc_target::abi::LayoutOf;
+use rustc_target::abi::{self, LayoutOf};
 use tracing::debug;
 
 use std::cell::Cell;
@@ -1059,6 +1059,27 @@ impl<'tcx> LateContext<'tcx> {
     }
 }
 
+impl<'tcx> abi::HasDataLayout for LateContext<'tcx> {
+    #[inline]
+    fn data_layout(&self) -> &abi::TargetDataLayout {
+        &self.tcx.data_layout
+    }
+}
+
+impl<'tcx> ty::layout::HasTyCtxt<'tcx> for LateContext<'tcx> {
+    #[inline]
+    fn tcx(&self) -> TyCtxt<'tcx> {
+        self.tcx
+    }
+}
+
+impl<'tcx> ty::layout::HasParamEnv<'tcx> for LateContext<'tcx> {
+    #[inline]
+    fn param_env(&self) -> ty::ParamEnv<'tcx> {
+        self.param_env
+    }
+}
+
 impl<'tcx> LayoutOf<'tcx> for LateContext<'tcx> {
     type Ty = Ty<'tcx>;
     type TyAndLayout = Result<TyAndLayout<'tcx>, LayoutError<'tcx>>;