Skip to content

Commit 5335530

Browse files
Make Identity trait public to run ui test and put projection of type aliases behind an env variable
1 parent 08ff70e commit 5335530

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

compiler/rustc_hir_analysis/src/astconv/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2630,7 +2630,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
26302630
assert_eq!(opt_self_ty, None);
26312631
self.prohibit_generics(path.segments.split_last().unwrap().1.iter(), |_| {});
26322632

2633-
if let Some(identity_def_id) = tcx.lang_items().identity_type() {
2633+
if let Some(identity_def_id) = tcx.lang_items().identity_type() && std::env::var("TEST_WITH_IDENTITY").is_ok() {
26342634
let item_segment = path.segments.split_last().unwrap();
26352635

26362636
let substs = self.ast_path_substs_for_ty(span, def_id, item_segment.0);

library/core/src/marker.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -786,11 +786,15 @@ unsafe impl<T: ?Sized> Freeze for &mut T {}
786786
/// // becomes:
787787
/// type Foo = <Bar as Identity>::Identity;
788788
/// ```
789-
pub(crate) trait Identity: Sized {
789+
#[stable(feature = "pin", since = "1.33.0")]
790+
pub trait Identity: Sized {
790791
#[cfg_attr(not(bootstrap), lang = "identity")]
792+
#[stable(feature = "pin", since = "1.33.0")]
793+
/// lol
791794
type Identity;
792795
}
793796

797+
#[stable(feature = "pin", since = "1.33.0")]
794798
impl<T> Identity for T {
795799
type Identity = T;
796800
}

0 commit comments

Comments
 (0)