Skip to content

Commit 1e8e28d

Browse files
committed
---
yaml --- r: 213980 b: refs/heads/master c: d914831 h: refs/heads/master v: v3
1 parent 8d11211 commit 1e8e28d

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 0b58fdf9252ccd08bf610e13625f49380e769e06
2+
refs/heads/master: d9148311451d38e831dcaa15548fb6ac6f6450b9
33
refs/heads/snap-stage3: ba0e1cd8147d452c356aacb29fb87568ca26f111
44
refs/heads/try: b53c0f93eedcdedd4fd89bccc5a3a09d1c5cd23e
55
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105

trunk/src/librustc/middle/ty.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -816,6 +816,12 @@ impl<'tcx> ctxt<'tcx> {
816816
/// provided ty::ctxt<'tcx>.
817817
/// This can be done, for example, for Ty<'tcx> or &'tcx Substs<'tcx>
818818
/// by looking them up in their respective interners.
819+
/// None is returned if the value or one of the components is not part
820+
/// of the provided context.
821+
/// For Ty, None can be returned if either the type interner doesn't
822+
/// contain the TypeVariants key or if the address of the interned
823+
/// pointer differs. The latter case is possible if a primitive type,
824+
/// e.g. `()` or `u8`, was interned in a different context.
819825
pub trait Lift<'tcx> {
820826
type Lifted;
821827
fn lift_to_tcx(&self, tcx: &ctxt<'tcx>) -> Option<Self::Lifted>;
@@ -3016,6 +3022,10 @@ impl<'tcx> CommonTypes<'tcx> {
30163022
}
30173023
}
30183024

3025+
/// Create a type context and call the closure with a `&ty::ctxt` reference
3026+
/// to the context. The closure enforces that the type context and any interned
3027+
/// value (types, substs, etc.) can only be used while `ty::tls` has a valid
3028+
/// reference to the context, to allow formatting values that need it.
30193029
pub fn with_ctxt<'tcx, F, R>(s: Session,
30203030
arenas: &'tcx CtxtArenas<'tcx>,
30213031
def_map: DefMap,

0 commit comments

Comments
 (0)