Function rustc::middle::cstore::tls::with_encoding_context [] [src]

pub fn with_encoding_context<'tcx, E, F, R>(encoder: &mut E, f: F) -> R where F: FnOnce(&EncodingContext<'tcx>, &mut OpaqueEncoder) -> R, E: Encoder
Unstable (rustc_private)
[]

Execute f with access to the thread-local encoding context and rbml encoder. This function will panic if the encoder passed in and the context encoder are not the same.

Note that this method is 'practically' safe due to its checking that the encoder passed in is the same as the one in TLS, but it would still be possible to construct cases where the EncodingContext is exchanged while the same encoder is used, thus working with a wrong context.