Skip to content

Commit 87deb4f

Browse files
committed
---
yaml --- r: 225998 b: refs/heads/stable c: d914831 h: refs/heads/master v: v3
1 parent 7915a9f commit 87deb4f

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
@@ -29,6 +29,6 @@ refs/heads/tmp: e5d90d98402475b6e154ce216f9efcb80da1a747
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f
3030
refs/tags/homu-tmp: 1fe32ca12c51afcd761d9962f51a74ff0d07a591
3131
refs/tags/1.0.0-beta: 8cbb92b53468ee2b0c2d3eeb8567005953d40828
32-
refs/heads/stable: 0b58fdf9252ccd08bf610e13625f49380e769e06
32+
refs/heads/stable: d9148311451d38e831dcaa15548fb6ac6f6450b9
3333
refs/tags/1.0.0: 55bd4f8ff2b323f317ae89e254ce87162d52a375
3434
refs/tags/1.1.0: bc3c16f09287e5545c1d3f76b7abd54f2eca868b

branches/stable/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)