Skip to content

Commit c20d909

Browse files
Make rustc_type_ir nightly again
1 parent 8fcd4dd commit c20d909

File tree

11 files changed

+40
-20
lines changed

11 files changed

+40
-20
lines changed

compiler/rustc_type_ir/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ edition = "2021"
77
# tidy-alphabetical-start
88
bitflags = "2.4.1"
99
derivative = "2.2.0"
10-
rustc_ast_ir = { path = "../rustc_ast_ir" }
10+
rustc_ast_ir = { path = "../rustc_ast_ir", default-features = false }
1111
rustc_data_structures = { path = "../rustc_data_structures", optional = true }
1212
rustc_index = { path = "../rustc_index", default-features = false }
1313
rustc_macros = { path = "../rustc_macros", optional = true }

compiler/rustc_type_ir/src/binder.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,16 @@ use std::ops::{ControlFlow, Deref};
55

66
#[cfg(feature = "nightly")]
77
use rustc_macros::{HashStable_NoContext, TyDecodable, TyEncodable};
8+
#[cfg(feature = "nightly")]
89
use rustc_serialize::Decodable;
910
use tracing::debug;
1011

12+
use crate::data_structures::SsoHashSet;
1113
use crate::fold::{FallibleTypeFolder, TypeFoldable, TypeFolder, TypeSuperFoldable};
1214
use crate::inherent::*;
1315
use crate::lift::Lift;
1416
use crate::visit::{Flags, TypeSuperVisitable, TypeVisitable, TypeVisitableExt, TypeVisitor};
15-
use crate::{self as ty, Interner, SsoHashSet};
17+
use crate::{self as ty, Interner};
1618

1719
/// Binder is a binder for higher-ranked lifetimes or types. It is part of the
1820
/// compiler's representation for things like `for<'a> Fn(&'a isize)`
@@ -55,6 +57,7 @@ where
5557
}
5658
}
5759

60+
#[cfg(feature = "nightly")]
5861
macro_rules! impl_binder_encode_decode {
5962
($($t:ty),+ $(,)?) => {
6063
$(
@@ -82,6 +85,7 @@ macro_rules! impl_binder_encode_decode {
8285
}
8386
}
8487

88+
#[cfg(feature = "nightly")]
8589
impl_binder_encode_decode! {
8690
ty::FnSig<I>,
8791
ty::TraitPredicate<I>,
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#[cfg(feature = "nightly")]
2+
mod impl_ {
3+
pub use rustc_data_structures::fx::FxHashMap as HashMap;
4+
pub use rustc_data_structures::fx::FxHashSet as HashSet;
5+
pub use rustc_data_structures::sso::SsoHashMap as SsoHashMap;
6+
pub use rustc_data_structures::sso::SsoHashSet as SsoHashSet;
7+
pub use rustc_data_structures::sync::Lrc;
8+
}
9+
10+
#[cfg(not(feature = "nightly"))]
11+
mod impl_ {
12+
pub use std::collections::HashMap;
13+
pub use std::collections::HashSet;
14+
pub use std::collections::HashMap as SsoHashMap;
15+
pub use std::collections::HashSet as SsoHashSet;
16+
pub use std::sync::Arc as Lrc;
17+
}
18+
19+
pub use impl_::*;

compiler/rustc_type_ir/src/error.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ impl<T> ExpectedFound<T> {
3030
Debug(bound = "")
3131
)]
3232
#[derive(TypeVisitable_Generic)]
33-
#[rustc_pass_by_value]
33+
#[cfg_attr(feature = "nightly", rustc_pass_by_value)]
3434
pub enum TypeError<I: Interner> {
3535
Mismatch,
3636
ConstnessMismatch(ExpectedFound<ty::BoundConstness>),

compiler/rustc_type_ir/src/fold.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,10 @@ use rustc_index::{Idx, IndexVec};
4949
use std::mem;
5050
use tracing::debug;
5151

52+
use crate::data_structures::Lrc;
5253
use crate::inherent::*;
5354
use crate::visit::{TypeVisitable, TypeVisitableExt as _};
54-
use crate::{self as ty, Interner, Lrc};
55+
use crate::{self as ty, Interner};
5556

5657
#[cfg(feature = "nightly")]
5758
type Never = !;

compiler/rustc_type_ir/src/generic_arg.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#[cfg(feature = "nightly")]
12
use rustc_macros::{HashStable_NoContext, TyDecodable, TyEncodable};
23

34
use crate::Interner;

compiler/rustc_type_ir/src/inherent.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ use std::hash::Hash;
88
use std::ops::Deref;
99

1010
use rustc_ast_ir::Mutability;
11-
use rustc_data_structures::fx::FxHashSet;
1211

12+
use crate::data_structures::HashSet;
1313
use crate::fold::{TypeFoldable, TypeSuperFoldable};
1414
use crate::relate::Relate;
1515
use crate::solve::{CacheData, CanonicalInput, QueryResult, Reveal};
@@ -530,7 +530,7 @@ pub trait EvaluationCache<I: Interner> {
530530
proof_tree: Option<I::CanonicalGoalEvaluationStepRef>,
531531
additional_depth: usize,
532532
encountered_overflow: bool,
533-
cycle_participants: FxHashSet<CanonicalInput<I>>,
533+
cycle_participants: HashSet<CanonicalInput<I>>,
534534
dep_node: I::DepNodeIndex,
535535
result: QueryResult<I>,
536536
);

compiler/rustc_type_ir/src/lib.rs

+1-9
Original file line numberDiff line numberDiff line change
@@ -7,27 +7,19 @@
77
#![cfg_attr(feature = "nightly", allow(internal_features))]
88
// tidy-alphabetical-end
99

10-
#[cfg(feature = "nightly")]
1110
extern crate self as rustc_type_ir;
1211

13-
#[cfg(feature = "nightly")]
14-
use rustc_data_structures::sso::SsoHashSet;
15-
#[cfg(feature = "nightly")]
16-
use rustc_data_structures::sync::Lrc;
1712
#[cfg(feature = "nightly")]
1813
use rustc_macros::{Decodable, Encodable, HashStable_NoContext};
19-
#[cfg(not(feature = "nightly"))]
20-
use std::collections::HashSet as SsoHashSet;
2114
use std::fmt;
2215
use std::hash::Hash;
23-
#[cfg(not(feature = "nightly"))]
24-
use std::sync::Arc as Lrc;
2516

2617
// These modules are `pub` since they are not glob-imported.
2718
#[macro_use]
2819
pub mod visit;
2920
#[cfg(feature = "nightly")]
3021
pub mod codec;
22+
pub mod data_structures;
3123
pub mod error;
3224
pub mod fold;
3325
pub mod inherent;

compiler/rustc_type_ir/src/opaque_ty.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#[cfg(feature = "nightly")]
12
use rustc_macros::{HashStable_NoContext, TyDecodable, TyEncodable};
23
use rustc_type_ir_macros::{TypeFoldable_Generic, TypeVisitable_Generic};
34

compiler/rustc_type_ir/src/relate.rs

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
use std::iter;
22

33
use rustc_ast_ir::Mutability;
4-
use rustc_type_ir::error::{ExpectedFound, TypeError};
5-
use rustc_type_ir::fold::TypeFoldable;
6-
use rustc_type_ir::inherent::*;
7-
use rustc_type_ir::{self as ty, Interner};
84
use tracing::{debug, instrument};
95

6+
use crate::error::{ExpectedFound, TypeError};
7+
use crate::fold::TypeFoldable;
8+
use crate::inherent::*;
9+
use crate::{self as ty, Interner};
10+
1011
pub type RelateResult<I, T> = Result<T, TypeError<I>>;
1112

1213
/// Extra information about why we ended up with a particular variance.

compiler/rustc_type_ir/src/visit.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,9 @@ use rustc_index::{Idx, IndexVec};
4747
use std::fmt;
4848
use std::ops::ControlFlow;
4949

50+
use crate::data_structures::Lrc;
5051
use crate::inherent::*;
51-
use crate::{self as ty, Interner, Lrc, TypeFlags};
52+
use crate::{self as ty, Interner, TypeFlags};
5253

5354
/// This trait is implemented for every type that can be visited,
5455
/// providing the skeleton of the traversal.

0 commit comments

Comments
 (0)