Skip to content

Commit 60673de

Browse files
committed
---
yaml --- r: 213937 b: refs/heads/tmp c: d914831 h: refs/heads/master i: 213935: ae1791a v: v3
1 parent d3b939a commit 60673de

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
@@ -32,7 +32,7 @@ refs/heads/building: 126db549b038c84269a1e4fe46f051b2c15d6970
3232
refs/heads/beta: e99b1404e9b3f60dc496a8eb0a6ce9fecc7ac583
3333
refs/heads/windistfix: 7608dbad651f02e837ed05eef3d74a6662a6e928
3434
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
35-
refs/heads/tmp: 0b58fdf9252ccd08bf610e13625f49380e769e06
35+
refs/heads/tmp: d9148311451d38e831dcaa15548fb6ac6f6450b9
3636
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f
3737
refs/tags/homu-tmp: d8a9570154dfbc4032cb3a6ba8b51c6256518dcd
3838
refs/heads/gate: 97c84447b65164731087ea82685580cc81424412

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