mirror of https://github.com/rust-lang/rust.git
Make rustc_type_ir nightly again
This commit is contained in:
parent
8fcd4dd08e
commit
c20d909701
|
@ -7,7 +7,7 @@ edition = "2021"
|
||||||
# tidy-alphabetical-start
|
# tidy-alphabetical-start
|
||||||
bitflags = "2.4.1"
|
bitflags = "2.4.1"
|
||||||
derivative = "2.2.0"
|
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_data_structures = { path = "../rustc_data_structures", optional = true }
|
||||||
rustc_index = { path = "../rustc_index", default-features = false }
|
rustc_index = { path = "../rustc_index", default-features = false }
|
||||||
rustc_macros = { path = "../rustc_macros", optional = true }
|
rustc_macros = { path = "../rustc_macros", optional = true }
|
||||||
|
|
|
@ -5,14 +5,16 @@ use std::ops::{ControlFlow, Deref};
|
||||||
|
|
||||||
#[cfg(feature = "nightly")]
|
#[cfg(feature = "nightly")]
|
||||||
use rustc_macros::{HashStable_NoContext, TyDecodable, TyEncodable};
|
use rustc_macros::{HashStable_NoContext, TyDecodable, TyEncodable};
|
||||||
|
#[cfg(feature = "nightly")]
|
||||||
use rustc_serialize::Decodable;
|
use rustc_serialize::Decodable;
|
||||||
use tracing::debug;
|
use tracing::debug;
|
||||||
|
|
||||||
|
use crate::data_structures::SsoHashSet;
|
||||||
use crate::fold::{FallibleTypeFolder, TypeFoldable, TypeFolder, TypeSuperFoldable};
|
use crate::fold::{FallibleTypeFolder, TypeFoldable, TypeFolder, TypeSuperFoldable};
|
||||||
use crate::inherent::*;
|
use crate::inherent::*;
|
||||||
use crate::lift::Lift;
|
use crate::lift::Lift;
|
||||||
use crate::visit::{Flags, TypeSuperVisitable, TypeVisitable, TypeVisitableExt, TypeVisitor};
|
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
|
/// 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)`
|
/// 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 {
|
macro_rules! impl_binder_encode_decode {
|
||||||
($($t:ty),+ $(,)?) => {
|
($($t:ty),+ $(,)?) => {
|
||||||
$(
|
$(
|
||||||
|
@ -82,6 +85,7 @@ macro_rules! impl_binder_encode_decode {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "nightly")]
|
||||||
impl_binder_encode_decode! {
|
impl_binder_encode_decode! {
|
||||||
ty::FnSig<I>,
|
ty::FnSig<I>,
|
||||||
ty::TraitPredicate<I>,
|
ty::TraitPredicate<I>,
|
||||||
|
|
|
@ -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_::*;
|
|
@ -30,7 +30,7 @@ impl<T> ExpectedFound<T> {
|
||||||
Debug(bound = "")
|
Debug(bound = "")
|
||||||
)]
|
)]
|
||||||
#[derive(TypeVisitable_Generic)]
|
#[derive(TypeVisitable_Generic)]
|
||||||
#[rustc_pass_by_value]
|
#[cfg_attr(feature = "nightly", rustc_pass_by_value)]
|
||||||
pub enum TypeError<I: Interner> {
|
pub enum TypeError<I: Interner> {
|
||||||
Mismatch,
|
Mismatch,
|
||||||
ConstnessMismatch(ExpectedFound<ty::BoundConstness>),
|
ConstnessMismatch(ExpectedFound<ty::BoundConstness>),
|
||||||
|
|
|
@ -49,9 +49,10 @@ use rustc_index::{Idx, IndexVec};
|
||||||
use std::mem;
|
use std::mem;
|
||||||
use tracing::debug;
|
use tracing::debug;
|
||||||
|
|
||||||
|
use crate::data_structures::Lrc;
|
||||||
use crate::inherent::*;
|
use crate::inherent::*;
|
||||||
use crate::visit::{TypeVisitable, TypeVisitableExt as _};
|
use crate::visit::{TypeVisitable, TypeVisitableExt as _};
|
||||||
use crate::{self as ty, Interner, Lrc};
|
use crate::{self as ty, Interner};
|
||||||
|
|
||||||
#[cfg(feature = "nightly")]
|
#[cfg(feature = "nightly")]
|
||||||
type Never = !;
|
type Never = !;
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
#[cfg(feature = "nightly")]
|
||||||
use rustc_macros::{HashStable_NoContext, TyDecodable, TyEncodable};
|
use rustc_macros::{HashStable_NoContext, TyDecodable, TyEncodable};
|
||||||
|
|
||||||
use crate::Interner;
|
use crate::Interner;
|
||||||
|
|
|
@ -8,8 +8,8 @@ use std::hash::Hash;
|
||||||
use std::ops::Deref;
|
use std::ops::Deref;
|
||||||
|
|
||||||
use rustc_ast_ir::Mutability;
|
use rustc_ast_ir::Mutability;
|
||||||
use rustc_data_structures::fx::FxHashSet;
|
|
||||||
|
|
||||||
|
use crate::data_structures::HashSet;
|
||||||
use crate::fold::{TypeFoldable, TypeSuperFoldable};
|
use crate::fold::{TypeFoldable, TypeSuperFoldable};
|
||||||
use crate::relate::Relate;
|
use crate::relate::Relate;
|
||||||
use crate::solve::{CacheData, CanonicalInput, QueryResult, Reveal};
|
use crate::solve::{CacheData, CanonicalInput, QueryResult, Reveal};
|
||||||
|
@ -530,7 +530,7 @@ pub trait EvaluationCache<I: Interner> {
|
||||||
proof_tree: Option<I::CanonicalGoalEvaluationStepRef>,
|
proof_tree: Option<I::CanonicalGoalEvaluationStepRef>,
|
||||||
additional_depth: usize,
|
additional_depth: usize,
|
||||||
encountered_overflow: bool,
|
encountered_overflow: bool,
|
||||||
cycle_participants: FxHashSet<CanonicalInput<I>>,
|
cycle_participants: HashSet<CanonicalInput<I>>,
|
||||||
dep_node: I::DepNodeIndex,
|
dep_node: I::DepNodeIndex,
|
||||||
result: QueryResult<I>,
|
result: QueryResult<I>,
|
||||||
);
|
);
|
||||||
|
|
|
@ -7,27 +7,19 @@
|
||||||
#![cfg_attr(feature = "nightly", allow(internal_features))]
|
#![cfg_attr(feature = "nightly", allow(internal_features))]
|
||||||
// tidy-alphabetical-end
|
// tidy-alphabetical-end
|
||||||
|
|
||||||
#[cfg(feature = "nightly")]
|
|
||||||
extern crate self as rustc_type_ir;
|
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")]
|
#[cfg(feature = "nightly")]
|
||||||
use rustc_macros::{Decodable, Encodable, HashStable_NoContext};
|
use rustc_macros::{Decodable, Encodable, HashStable_NoContext};
|
||||||
#[cfg(not(feature = "nightly"))]
|
|
||||||
use std::collections::HashSet as SsoHashSet;
|
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use std::hash::Hash;
|
use std::hash::Hash;
|
||||||
#[cfg(not(feature = "nightly"))]
|
|
||||||
use std::sync::Arc as Lrc;
|
|
||||||
|
|
||||||
// These modules are `pub` since they are not glob-imported.
|
// These modules are `pub` since they are not glob-imported.
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
pub mod visit;
|
pub mod visit;
|
||||||
#[cfg(feature = "nightly")]
|
#[cfg(feature = "nightly")]
|
||||||
pub mod codec;
|
pub mod codec;
|
||||||
|
pub mod data_structures;
|
||||||
pub mod error;
|
pub mod error;
|
||||||
pub mod fold;
|
pub mod fold;
|
||||||
pub mod inherent;
|
pub mod inherent;
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
#[cfg(feature = "nightly")]
|
||||||
use rustc_macros::{HashStable_NoContext, TyDecodable, TyEncodable};
|
use rustc_macros::{HashStable_NoContext, TyDecodable, TyEncodable};
|
||||||
use rustc_type_ir_macros::{TypeFoldable_Generic, TypeVisitable_Generic};
|
use rustc_type_ir_macros::{TypeFoldable_Generic, TypeVisitable_Generic};
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,13 @@
|
||||||
use std::iter;
|
use std::iter;
|
||||||
|
|
||||||
use rustc_ast_ir::Mutability;
|
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 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>>;
|
pub type RelateResult<I, T> = Result<T, TypeError<I>>;
|
||||||
|
|
||||||
/// Extra information about why we ended up with a particular variance.
|
/// Extra information about why we ended up with a particular variance.
|
||||||
|
|
|
@ -47,8 +47,9 @@ use rustc_index::{Idx, IndexVec};
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use std::ops::ControlFlow;
|
use std::ops::ControlFlow;
|
||||||
|
|
||||||
|
use crate::data_structures::Lrc;
|
||||||
use crate::inherent::*;
|
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,
|
/// This trait is implemented for every type that can be visited,
|
||||||
/// providing the skeleton of the traversal.
|
/// providing the skeleton of the traversal.
|
||||||
|
|
Loading…
Reference in New Issue