about summary refs log tree commit diff
path: root/compiler/rustc_middle/src/mir
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/rustc_middle/src/mir')
-rw-r--r--compiler/rustc_middle/src/mir/consts.rs2
-rw-r--r--compiler/rustc_middle/src/mir/interpret/allocation.rs11
-rw-r--r--compiler/rustc_middle/src/mir/interpret/allocation/init_mask.rs13
-rw-r--r--compiler/rustc_middle/src/mir/interpret/mod.rs4
-rw-r--r--compiler/rustc_middle/src/mir/interpret/queries.rs3
-rw-r--r--compiler/rustc_middle/src/mir/mod.rs9
-rw-r--r--compiler/rustc_middle/src/mir/query.rs3
7 files changed, 20 insertions, 25 deletions
diff --git a/compiler/rustc_middle/src/mir/consts.rs b/compiler/rustc_middle/src/mir/consts.rs
index 923160cc0cc..34b27c2e1cc 100644
--- a/compiler/rustc_middle/src/mir/consts.rs
+++ b/compiler/rustc_middle/src/mir/consts.rs
@@ -6,7 +6,7 @@ use rustc_macros::{HashStable, Lift, TyDecodable, TyEncodable, TypeFoldable, Typ
 use rustc_session::RemapFileNameExt;
 use rustc_session::config::RemapPathScopeComponents;
 use rustc_span::{DUMMY_SP, Span, Symbol};
-use rustc_type_ir::visit::TypeVisitableExt;
+use rustc_type_ir::TypeVisitableExt;
 
 use super::interpret::ReportedErrorInfo;
 use crate::mir::interpret::{AllocId, ConstAllocation, ErrorHandled, Scalar, alloc_range};
diff --git a/compiler/rustc_middle/src/mir/interpret/allocation.rs b/compiler/rustc_middle/src/mir/interpret/allocation.rs
index aed38414ab1..57aafbb26bc 100644
--- a/compiler/rustc_middle/src/mir/interpret/allocation.rs
+++ b/compiler/rustc_middle/src/mir/interpret/allocation.rs
@@ -16,8 +16,7 @@ use rustc_abi::{Align, HasDataLayout, Size};
 use rustc_ast::Mutability;
 use rustc_data_structures::intern::Interned;
 use rustc_macros::HashStable;
-use rustc_serialize::{Decodable, Encodable};
-use rustc_type_ir::{TyDecoder, TyEncoder};
+use rustc_serialize::{Decodable, Decoder, Encodable, Encoder};
 
 use super::{
     AllocId, BadBytesAccess, CtfeProvenance, InterpErrorKind, InterpResult, Pointer,
@@ -112,7 +111,7 @@ struct AllocFlags {
     all_zero: bool,
 }
 
-impl<E: TyEncoder> Encodable<E> for AllocFlags {
+impl<E: Encoder> Encodable<E> for AllocFlags {
     fn encode(&self, encoder: &mut E) {
         // Make sure Align::MAX can be stored with the high 2 bits unset.
         const {
@@ -131,7 +130,7 @@ impl<E: TyEncoder> Encodable<E> for AllocFlags {
     }
 }
 
-impl<D: TyDecoder> Decodable<D> for AllocFlags {
+impl<D: Decoder> Decodable<D> for AllocFlags {
     fn decode(decoder: &mut D) -> Self {
         let flags: u8 = Decodable::decode(decoder);
         let align = flags & 0b0011_1111;
@@ -173,7 +172,7 @@ fn all_zero(buf: &[u8]) -> bool {
 }
 
 /// Custom encoder for [`Allocation`] to more efficiently represent the case where all bytes are 0.
-impl<Prov: Provenance, Extra, Bytes, E: TyEncoder> Encodable<E> for Allocation<Prov, Extra, Bytes>
+impl<Prov: Provenance, Extra, Bytes, E: Encoder> Encodable<E> for Allocation<Prov, Extra, Bytes>
 where
     Bytes: AllocBytes,
     ProvenanceMap<Prov>: Encodable<E>,
@@ -193,7 +192,7 @@ where
     }
 }
 
-impl<Prov: Provenance, Extra, Bytes, D: TyDecoder> Decodable<D> for Allocation<Prov, Extra, Bytes>
+impl<Prov: Provenance, Extra, Bytes, D: Decoder> Decodable<D> for Allocation<Prov, Extra, Bytes>
 where
     Bytes: AllocBytes,
     ProvenanceMap<Prov>: Decodable<D>,
diff --git a/compiler/rustc_middle/src/mir/interpret/allocation/init_mask.rs b/compiler/rustc_middle/src/mir/interpret/allocation/init_mask.rs
index fea5038e6dd..20492cda4e2 100644
--- a/compiler/rustc_middle/src/mir/interpret/allocation/init_mask.rs
+++ b/compiler/rustc_middle/src/mir/interpret/allocation/init_mask.rs
@@ -5,9 +5,8 @@ use std::ops::Range;
 use std::{hash, iter};
 
 use rustc_abi::Size;
-use rustc_macros::{HashStable, TyDecodable, TyEncodable};
-use rustc_serialize::{Decodable, Encodable};
-use rustc_type_ir::{TyDecoder, TyEncoder};
+use rustc_macros::{Decodable_NoContext, Encodable_NoContext, HashStable};
+use rustc_serialize::{Decodable, Decoder, Encodable, Encoder};
 
 use super::AllocRange;
 
@@ -19,13 +18,13 @@ type Block = u64;
 /// possible. Currently, if all the blocks have the same value, then the mask represents either a
 /// fully initialized or fully uninitialized const allocation, so we can only store that single
 /// value.
-#[derive(Clone, Debug, Eq, PartialEq, TyEncodable, TyDecodable, Hash, HashStable)]
+#[derive(Clone, Debug, Eq, PartialEq, Encodable_NoContext, Decodable_NoContext, Hash, HashStable)]
 pub struct InitMask {
     blocks: InitMaskBlocks,
     len: Size,
 }
 
-#[derive(Clone, Debug, Eq, PartialEq, TyEncodable, TyDecodable, Hash, HashStable)]
+#[derive(Clone, Debug, Eq, PartialEq, Encodable_NoContext, Decodable_NoContext, Hash, HashStable)]
 enum InitMaskBlocks {
     Lazy {
         /// Whether the lazy init mask is fully initialized or uninitialized.
@@ -194,7 +193,7 @@ struct InitMaskMaterialized {
 // and also produces more output when the high bits of each `u64` are occupied.
 // Note: There is probably a remaining optimization for masks that do not use an entire
 // `Block`.
-impl<E: TyEncoder> Encodable<E> for InitMaskMaterialized {
+impl<E: Encoder> Encodable<E> for InitMaskMaterialized {
     fn encode(&self, encoder: &mut E) {
         encoder.emit_usize(self.blocks.len());
         for block in &self.blocks {
@@ -204,7 +203,7 @@ impl<E: TyEncoder> Encodable<E> for InitMaskMaterialized {
 }
 
 // This implementation is deliberately not derived, see the matching `Encodable` impl.
-impl<D: TyDecoder> Decodable<D> for InitMaskMaterialized {
+impl<D: Decoder> Decodable<D> for InitMaskMaterialized {
     fn decode(decoder: &mut D) -> Self {
         let num_blocks = decoder.read_usize();
         let mut blocks = Vec::with_capacity(num_blocks);
diff --git a/compiler/rustc_middle/src/mir/interpret/mod.rs b/compiler/rustc_middle/src/mir/interpret/mod.rs
index effedf854e4..c2438af6a1e 100644
--- a/compiler/rustc_middle/src/mir/interpret/mod.rs
+++ b/compiler/rustc_middle/src/mir/interpret/mod.rs
@@ -105,7 +105,7 @@ enum AllocDiscriminant {
     Static,
 }
 
-pub fn specialized_encode_alloc_id<'tcx, E: TyEncoder<I = TyCtxt<'tcx>>>(
+pub fn specialized_encode_alloc_id<'tcx, E: TyEncoder<'tcx>>(
     encoder: &mut E,
     tcx: TyCtxt<'tcx>,
     alloc_id: AllocId,
@@ -175,7 +175,7 @@ impl<'s> AllocDecodingSession<'s> {
     /// Decodes an `AllocId` in a thread-safe way.
     pub fn decode_alloc_id<'tcx, D>(&self, decoder: &mut D) -> AllocId
     where
-        D: TyDecoder<I = TyCtxt<'tcx>>,
+        D: TyDecoder<'tcx>,
     {
         // Read the index of the allocation.
         let idx = usize::try_from(decoder.read_u32()).unwrap();
diff --git a/compiler/rustc_middle/src/mir/interpret/queries.rs b/compiler/rustc_middle/src/mir/interpret/queries.rs
index 78749428c6d..4222a68e544 100644
--- a/compiler/rustc_middle/src/mir/interpret/queries.rs
+++ b/compiler/rustc_middle/src/mir/interpret/queries.rs
@@ -10,8 +10,7 @@ use super::{
 };
 use crate::mir;
 use crate::query::TyCtxtEnsureOk;
-use crate::ty::visit::TypeVisitableExt;
-use crate::ty::{self, GenericArgs, TyCtxt};
+use crate::ty::{self, GenericArgs, TyCtxt, TypeVisitableExt};
 
 impl<'tcx> TyCtxt<'tcx> {
     /// Evaluates a constant without providing any generic parameters. This is useful to evaluate consts
diff --git a/compiler/rustc_middle/src/mir/mod.rs b/compiler/rustc_middle/src/mir/mod.rs
index 83857ab6c5c..7090e93549e 100644
--- a/compiler/rustc_middle/src/mir/mod.rs
+++ b/compiler/rustc_middle/src/mir/mod.rs
@@ -32,10 +32,9 @@ pub use self::query::*;
 use crate::mir::interpret::{AllocRange, Scalar};
 use crate::ty::codec::{TyDecoder, TyEncoder};
 use crate::ty::print::{FmtPrinter, Printer, pretty_print_const, with_no_trimmed_paths};
-use crate::ty::visit::TypeVisitableExt;
 use crate::ty::{
-    self, AdtDef, GenericArg, GenericArgsRef, Instance, InstanceKind, List, Ty, TyCtxt, TypingEnv,
-    UserTypeAnnotationIndex,
+    self, AdtDef, GenericArg, GenericArgsRef, Instance, InstanceKind, List, Ty, TyCtxt,
+    TypeVisitableExt, TypingEnv, UserTypeAnnotationIndex,
 };
 
 mod basic_blocks;
@@ -791,7 +790,7 @@ impl<T> ClearCrossCrate<T> {
 const TAG_CLEAR_CROSS_CRATE_CLEAR: u8 = 0;
 const TAG_CLEAR_CROSS_CRATE_SET: u8 = 1;
 
-impl<E: TyEncoder, T: Encodable<E>> Encodable<E> for ClearCrossCrate<T> {
+impl<'tcx, E: TyEncoder<'tcx>, T: Encodable<E>> Encodable<E> for ClearCrossCrate<T> {
     #[inline]
     fn encode(&self, e: &mut E) {
         if E::CLEAR_CROSS_CRATE {
@@ -807,7 +806,7 @@ impl<E: TyEncoder, T: Encodable<E>> Encodable<E> for ClearCrossCrate<T> {
         }
     }
 }
-impl<D: TyDecoder, T: Decodable<D>> Decodable<D> for ClearCrossCrate<T> {
+impl<'tcx, D: TyDecoder<'tcx>, T: Decodable<D>> Decodable<D> for ClearCrossCrate<T> {
     #[inline]
     fn decode(d: &mut D) -> ClearCrossCrate<T> {
         if D::CLEAR_CROSS_CRATE {
diff --git a/compiler/rustc_middle/src/mir/query.rs b/compiler/rustc_middle/src/mir/query.rs
index 50494355e3e..5a9fe10938a 100644
--- a/compiler/rustc_middle/src/mir/query.rs
+++ b/compiler/rustc_middle/src/mir/query.rs
@@ -13,8 +13,7 @@ use rustc_span::{Span, Symbol};
 use smallvec::SmallVec;
 
 use super::{ConstValue, SourceInfo};
-use crate::ty::fold::fold_regions;
-use crate::ty::{self, CoroutineArgsExt, OpaqueHiddenType, Ty, TyCtxt};
+use crate::ty::{self, CoroutineArgsExt, OpaqueHiddenType, Ty, TyCtxt, fold_regions};
 
 rustc_index::newtype_index! {
     #[derive(HashStable)]