about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2024-06-18 12:49:43 -0400
committerMichael Goulet <michael@errs.io>2024-06-18 18:51:26 -0400
commitc20d909701379ac932a49a946fb478477d907041 (patch)
tree6de5dae7ee2d03a101423a328e52e2636bf45d07
parent8fcd4dd08e2ba3e922d917d819ba0be066bdb005 (diff)
downloadrust-c20d909701379ac932a49a946fb478477d907041.tar.gz
rust-c20d909701379ac932a49a946fb478477d907041.zip
Make rustc_type_ir nightly again
-rw-r--r--compiler/rustc_type_ir/Cargo.toml2
-rw-r--r--compiler/rustc_type_ir/src/binder.rs6
-rw-r--r--compiler/rustc_type_ir/src/data_structures.rs19
-rw-r--r--compiler/rustc_type_ir/src/error.rs2
-rw-r--r--compiler/rustc_type_ir/src/fold.rs3
-rw-r--r--compiler/rustc_type_ir/src/generic_arg.rs1
-rw-r--r--compiler/rustc_type_ir/src/inherent.rs4
-rw-r--r--compiler/rustc_type_ir/src/lib.rs10
-rw-r--r--compiler/rustc_type_ir/src/opaque_ty.rs1
-rw-r--r--compiler/rustc_type_ir/src/relate.rs9
-rw-r--r--compiler/rustc_type_ir/src/visit.rs3
11 files changed, 40 insertions, 20 deletions
diff --git a/compiler/rustc_type_ir/Cargo.toml b/compiler/rustc_type_ir/Cargo.toml
index 18a09067a2c..02d163531b4 100644
--- a/compiler/rustc_type_ir/Cargo.toml
+++ b/compiler/rustc_type_ir/Cargo.toml
@@ -7,7 +7,7 @@ edition = "2021"
 # tidy-alphabetical-start
 bitflags = "2.4.1"
 derivative = "2.2.0"
-rustc_ast_ir = { path = "../rustc_ast_ir" }
+rustc_ast_ir = { path = "../rustc_ast_ir", default-features = false }
 rustc_data_structures = { path = "../rustc_data_structures", optional = true }
 rustc_index = { path = "../rustc_index", default-features = false }
 rustc_macros = { path = "../rustc_macros", optional = true }
diff --git a/compiler/rustc_type_ir/src/binder.rs b/compiler/rustc_type_ir/src/binder.rs
index e50d59ba5f0..39ea61f0393 100644
--- a/compiler/rustc_type_ir/src/binder.rs
+++ b/compiler/rustc_type_ir/src/binder.rs
@@ -5,14 +5,16 @@ use std::ops::{ControlFlow, Deref};
 
 #[cfg(feature = "nightly")]
 use rustc_macros::{HashStable_NoContext, TyDecodable, TyEncodable};
+#[cfg(feature = "nightly")]
 use rustc_serialize::Decodable;
 use tracing::debug;
 
+use crate::data_structures::SsoHashSet;
 use crate::fold::{FallibleTypeFolder, TypeFoldable, TypeFolder, TypeSuperFoldable};
 use crate::inherent::*;
 use crate::lift::Lift;
 use crate::visit::{Flags, TypeSuperVisitable, TypeVisitable, TypeVisitableExt, TypeVisitor};
-use crate::{self as ty, Interner, SsoHashSet};
+use crate::{self as ty, Interner};
 
 /// Binder is a binder for higher-ranked lifetimes or types. It is part of the
 /// compiler's representation for things like `for<'a> Fn(&'a isize)`
@@ -55,6 +57,7 @@ where
     }
 }
 
+#[cfg(feature = "nightly")]
 macro_rules! impl_binder_encode_decode {
     ($($t:ty),+ $(,)?) => {
         $(
@@ -82,6 +85,7 @@ macro_rules! impl_binder_encode_decode {
     }
 }
 
+#[cfg(feature = "nightly")]
 impl_binder_encode_decode! {
     ty::FnSig<I>,
     ty::TraitPredicate<I>,
diff --git a/compiler/rustc_type_ir/src/data_structures.rs b/compiler/rustc_type_ir/src/data_structures.rs
new file mode 100644
index 00000000000..86d7b31d216
--- /dev/null
+++ b/compiler/rustc_type_ir/src/data_structures.rs
@@ -0,0 +1,19 @@
+#[cfg(feature = "nightly")]
+mod impl_ {
+    pub use rustc_data_structures::fx::FxHashMap as HashMap;
+    pub use rustc_data_structures::fx::FxHashSet as HashSet;
+    pub use rustc_data_structures::sso::SsoHashMap as SsoHashMap;
+    pub use rustc_data_structures::sso::SsoHashSet as SsoHashSet;
+    pub use rustc_data_structures::sync::Lrc;
+}
+
+#[cfg(not(feature = "nightly"))]
+mod impl_ {
+    pub use std::collections::HashMap;
+    pub use std::collections::HashSet;
+    pub use std::collections::HashMap as SsoHashMap;
+    pub use std::collections::HashSet as SsoHashSet;
+    pub use std::sync::Arc as Lrc;
+}
+
+pub use impl_::*;
\ No newline at end of file
diff --git a/compiler/rustc_type_ir/src/error.rs b/compiler/rustc_type_ir/src/error.rs
index 27623ea9cac..8b59e9a6f48 100644
--- a/compiler/rustc_type_ir/src/error.rs
+++ b/compiler/rustc_type_ir/src/error.rs
@@ -30,7 +30,7 @@ impl<T> ExpectedFound<T> {
     Debug(bound = "")
 )]
 #[derive(TypeVisitable_Generic)]
-#[rustc_pass_by_value]
+#[cfg_attr(feature = "nightly", rustc_pass_by_value)]
 pub enum TypeError<I: Interner> {
     Mismatch,
     ConstnessMismatch(ExpectedFound<ty::BoundConstness>),
diff --git a/compiler/rustc_type_ir/src/fold.rs b/compiler/rustc_type_ir/src/fold.rs
index ee3e5ce66d0..26e365f64fa 100644
--- a/compiler/rustc_type_ir/src/fold.rs
+++ b/compiler/rustc_type_ir/src/fold.rs
@@ -49,9 +49,10 @@ use rustc_index::{Idx, IndexVec};
 use std::mem;
 use tracing::debug;
 
+use crate::data_structures::Lrc;
 use crate::inherent::*;
 use crate::visit::{TypeVisitable, TypeVisitableExt as _};
-use crate::{self as ty, Interner, Lrc};
+use crate::{self as ty, Interner};
 
 #[cfg(feature = "nightly")]
 type Never = !;
diff --git a/compiler/rustc_type_ir/src/generic_arg.rs b/compiler/rustc_type_ir/src/generic_arg.rs
index cc8c4444657..b158f0f5eee 100644
--- a/compiler/rustc_type_ir/src/generic_arg.rs
+++ b/compiler/rustc_type_ir/src/generic_arg.rs
@@ -1,3 +1,4 @@
+#[cfg(feature = "nightly")]
 use rustc_macros::{HashStable_NoContext, TyDecodable, TyEncodable};
 
 use crate::Interner;
diff --git a/compiler/rustc_type_ir/src/inherent.rs b/compiler/rustc_type_ir/src/inherent.rs
index 64d3400976a..be6deee011b 100644
--- a/compiler/rustc_type_ir/src/inherent.rs
+++ b/compiler/rustc_type_ir/src/inherent.rs
@@ -8,8 +8,8 @@ use std::hash::Hash;
 use std::ops::Deref;
 
 use rustc_ast_ir::Mutability;
-use rustc_data_structures::fx::FxHashSet;
 
+use crate::data_structures::HashSet;
 use crate::fold::{TypeFoldable, TypeSuperFoldable};
 use crate::relate::Relate;
 use crate::solve::{CacheData, CanonicalInput, QueryResult, Reveal};
@@ -530,7 +530,7 @@ pub trait EvaluationCache<I: Interner> {
         proof_tree: Option<I::CanonicalGoalEvaluationStepRef>,
         additional_depth: usize,
         encountered_overflow: bool,
-        cycle_participants: FxHashSet<CanonicalInput<I>>,
+        cycle_participants: HashSet<CanonicalInput<I>>,
         dep_node: I::DepNodeIndex,
         result: QueryResult<I>,
     );
diff --git a/compiler/rustc_type_ir/src/lib.rs b/compiler/rustc_type_ir/src/lib.rs
index 130ea231bf7..9b8ca5efdda 100644
--- a/compiler/rustc_type_ir/src/lib.rs
+++ b/compiler/rustc_type_ir/src/lib.rs
@@ -7,27 +7,19 @@
 #![cfg_attr(feature = "nightly", allow(internal_features))]
 // tidy-alphabetical-end
 
-#[cfg(feature = "nightly")]
 extern crate self as rustc_type_ir;
 
 #[cfg(feature = "nightly")]
-use rustc_data_structures::sso::SsoHashSet;
-#[cfg(feature = "nightly")]
-use rustc_data_structures::sync::Lrc;
-#[cfg(feature = "nightly")]
 use rustc_macros::{Decodable, Encodable, HashStable_NoContext};
-#[cfg(not(feature = "nightly"))]
-use std::collections::HashSet as SsoHashSet;
 use std::fmt;
 use std::hash::Hash;
-#[cfg(not(feature = "nightly"))]
-use std::sync::Arc as Lrc;
 
 // These modules are `pub` since they are not glob-imported.
 #[macro_use]
 pub mod visit;
 #[cfg(feature = "nightly")]
 pub mod codec;
+pub mod data_structures;
 pub mod error;
 pub mod fold;
 pub mod inherent;
diff --git a/compiler/rustc_type_ir/src/opaque_ty.rs b/compiler/rustc_type_ir/src/opaque_ty.rs
index 60737066597..738350f1b34 100644
--- a/compiler/rustc_type_ir/src/opaque_ty.rs
+++ b/compiler/rustc_type_ir/src/opaque_ty.rs
@@ -1,3 +1,4 @@
+#[cfg(feature = "nightly")]
 use rustc_macros::{HashStable_NoContext, TyDecodable, TyEncodable};
 use rustc_type_ir_macros::{TypeFoldable_Generic, TypeVisitable_Generic};
 
diff --git a/compiler/rustc_type_ir/src/relate.rs b/compiler/rustc_type_ir/src/relate.rs
index 8a6ba87b60e..429bc3197d4 100644
--- a/compiler/rustc_type_ir/src/relate.rs
+++ b/compiler/rustc_type_ir/src/relate.rs
@@ -1,12 +1,13 @@
 use std::iter;
 
 use rustc_ast_ir::Mutability;
-use rustc_type_ir::error::{ExpectedFound, TypeError};
-use rustc_type_ir::fold::TypeFoldable;
-use rustc_type_ir::inherent::*;
-use rustc_type_ir::{self as ty, Interner};
 use tracing::{debug, instrument};
 
+use crate::error::{ExpectedFound, TypeError};
+use crate::fold::TypeFoldable;
+use crate::inherent::*;
+use crate::{self as ty, Interner};
+
 pub type RelateResult<I, T> = Result<T, TypeError<I>>;
 
 /// Extra information about why we ended up with a particular variance.
diff --git a/compiler/rustc_type_ir/src/visit.rs b/compiler/rustc_type_ir/src/visit.rs
index 6880c7b8cef..473a0aa250f 100644
--- a/compiler/rustc_type_ir/src/visit.rs
+++ b/compiler/rustc_type_ir/src/visit.rs
@@ -47,8 +47,9 @@ use rustc_index::{Idx, IndexVec};
 use std::fmt;
 use std::ops::ControlFlow;
 
+use crate::data_structures::Lrc;
 use crate::inherent::*;
-use crate::{self as ty, Interner, Lrc, TypeFlags};
+use crate::{self as ty, Interner, TypeFlags};
 
 /// This trait is implemented for every type that can be visited,
 /// providing the skeleton of the traversal.