1 // Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
4 //
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
10
11 // Type encoding
12
13 #![allow(unused_must_use)] // as with encoding, everything is a no-fail MemWriter
14 #![allow(non_camel_case_types)]
15
16 use std::cell::RefCell;
17 use collections::HashMap;
18 use std::io;
19 use std::io::MemWriter;
20 use std::fmt;
21
22 use middle::ty::param_ty;
23 use middle::ty;
24
25 use syntax::abi::Abi;
26 use syntax::ast;
27 use syntax::ast::*;
28 use syntax::diagnostic::SpanHandler;
29 use syntax::parse::token;
30
31 macro_rules! mywrite( ($wr:expr, $($arg:tt)*) => (
32 format_args!(|a| { mywrite($wr, a) }, $($arg)*)
33 ) )
34
35 pub struct ctxt<'a> {
36 pub diag: &'a SpanHandler,
37 // Def -> str Callback:
38 pub ds: fn(DefId) -> ~str,
39 // The type context.
40 pub tcx: &'a ty::ctxt,
41 pub abbrevs: &'a abbrev_map
42 }
43
44 // Compact string representation for ty.t values. API ty_str & parse_from_str.
45 // Extra parameters are for converting to/from def_ids in the string rep.
46 // Whatever format you choose should not contain pipe characters.
47 pub struct ty_abbrev {
48 pos: uint,
49 len: uint,
50 s: ~str
51 }
52
53 pub type abbrev_map = RefCell<HashMap<ty::t, ty_abbrev>>;
54
55 fn mywrite(w: &mut MemWriter, fmt: &fmt::Arguments) {
56 fmt::write(&mut *w as &mut io::Writer, fmt);
57 }
58
59 pub fn enc_ty(w: &mut MemWriter, cx: &ctxt, t: ty::t) {
60 match cx.abbrevs.borrow_mut().find(&t) {
61 Some(a) => { w.write(a.s.as_bytes()); return; }
62 None => {}
63 }
64 let pos = w.tell().unwrap();
65 enc_sty(w, cx, &ty::get(t).sty);
66 let end = w.tell().unwrap();
67 let len = end - pos;
68 fn estimate_sz(u: u64) -> u64 {
69 let mut n = u;
70 let mut len = 0;
71 while n != 0 { len += 1; n = n >> 4; }
72 return len;
73 }
74 let abbrev_len = 3 + estimate_sz(pos) + estimate_sz(len);
75 if abbrev_len < len {
76 // I.e. it's actually an abbreviation.
77 cx.abbrevs.borrow_mut().insert(t, ty_abbrev {
78 pos: pos as uint,
79 len: len as uint,
80 s: format!("\\#{:x}:{:x}\\#", pos, len)
81 });
82 }
83 }
84
85 fn enc_mutability(w: &mut MemWriter, mt: ast::Mutability) {
86 match mt {
87 MutImmutable => (),
88 MutMutable => mywrite!(w, "m"),
89 }
90 }
91
92 fn enc_mt(w: &mut MemWriter, cx: &ctxt, mt: ty::mt) {
93 enc_mutability(w, mt.mutbl);
94 enc_ty(w, cx, mt.ty);
95 }
96
97 fn enc_opt<T>(w: &mut MemWriter, t: Option<T>, enc_f: |&mut MemWriter, T|) {
98 match t {
99 None => mywrite!(w, "n"),
100 Some(v) => {
101 mywrite!(w, "s");
102 enc_f(w, v);
103 }
104 }
105 }
106
107 pub fn enc_substs(w: &mut MemWriter, cx: &ctxt, substs: &ty::substs) {
108 enc_region_substs(w, cx, &substs.regions);
109 enc_opt(w, substs.self_ty, |w, t| enc_ty(w, cx, t));
110 mywrite!(w, "[");
111 for t in substs.tps.iter() { enc_ty(w, cx, *t); }
112 mywrite!(w, "]");
113 }
114
115 fn enc_region_substs(w: &mut MemWriter, cx: &ctxt, substs: &ty::RegionSubsts) {
116 match *substs {
117 ty::ErasedRegions => {
118 mywrite!(w, "e");
119 }
120 ty::NonerasedRegions(ref regions) => {
121 mywrite!(w, "n");
122 for &r in regions.iter() {
123 enc_region(w, cx, r);
124 }
125 mywrite!(w, ".");
126 }
127 }
128 }
129
130 fn enc_region(w: &mut MemWriter, cx: &ctxt, r: ty::Region) {
131 match r {
132 ty::ReLateBound(id, br) => {
133 mywrite!(w, "b[{}|", id);
134 enc_bound_region(w, cx, br);
135 mywrite!(w, "]");
136 }
137 ty::ReEarlyBound(node_id, index, name) => {
138 mywrite!(w, "B[{}|{}|{}]",
139 node_id,
140 index,
141 token::get_name(name));
142 }
143 ty::ReFree(ref fr) => {
144 mywrite!(w, "f[{}|", fr.scope_id);
145 enc_bound_region(w, cx, fr.bound_region);
146 mywrite!(w, "]");
147 }
148 ty::ReScope(nid) => {
149 mywrite!(w, "s{}|", nid);
150 }
151 ty::ReStatic => {
152 mywrite!(w, "t");
153 }
154 ty::ReEmpty => {
155 mywrite!(w, "e");
156 }
157 ty::ReInfer(_) => {
158 // these should not crop up after typeck
159 cx.diag.handler().bug("cannot encode region variables");
160 }
161 }
162 }
163
164 fn enc_bound_region(w: &mut MemWriter, cx: &ctxt, br: ty::BoundRegion) {
165 match br {
166 ty::BrAnon(idx) => {
167 mywrite!(w, "a{}|", idx);
168 }
169 ty::BrNamed(d, name) => {
170 mywrite!(w, "[{}|{}]",
171 (cx.ds)(d),
172 token::get_name(name));
173 }
174 ty::BrFresh(id) => {
175 mywrite!(w, "f{}|", id);
176 }
177 }
178 }
179
180 pub fn enc_trait_ref(w: &mut MemWriter, cx: &ctxt, s: &ty::TraitRef) {
181 mywrite!(w, "{}|", (cx.ds)(s.def_id));
182 enc_substs(w, cx, &s.substs);
183 }
184
185 pub fn enc_trait_store(w: &mut MemWriter, cx: &ctxt, s: ty::TraitStore) {
186 match s {
187 ty::UniqTraitStore => mywrite!(w, "~"),
188 ty::RegionTraitStore(re, m) => {
189 mywrite!(w, "&");
190 enc_region(w, cx, re);
191 enc_mutability(w, m);
192 }
193 }
194 }
195
196 fn enc_sty(w: &mut MemWriter, cx: &ctxt, st: &ty::sty) {
197 match *st {
198 ty::ty_nil => mywrite!(w, "n"),
199 ty::ty_bot => mywrite!(w, "z"),
200 ty::ty_bool => mywrite!(w, "b"),
201 ty::ty_char => mywrite!(w, "c"),
202 ty::ty_int(t) => {
203 match t {
204 TyI => mywrite!(w, "i"),
205 TyI8 => mywrite!(w, "MB"),
206 TyI16 => mywrite!(w, "MW"),
207 TyI32 => mywrite!(w, "ML"),
208 TyI64 => mywrite!(w, "MD")
209 }
210 }
211 ty::ty_uint(t) => {
212 match t {
213 TyU => mywrite!(w, "u"),
214 TyU8 => mywrite!(w, "Mb"),
215 TyU16 => mywrite!(w, "Mw"),
216 TyU32 => mywrite!(w, "Ml"),
217 TyU64 => mywrite!(w, "Md")
218 }
219 }
220 ty::ty_float(t) => {
221 match t {
222 TyF32 => mywrite!(w, "Mf"),
223 TyF64 => mywrite!(w, "MF"),
224 TyF128 => mywrite!(w, "MQ")
225 }
226 }
227 ty::ty_enum(def, ref substs) => {
228 mywrite!(w, "t[{}|", (cx.ds)(def));
229 enc_substs(w, cx, substs);
230 mywrite!(w, "]");
231 }
232 ty::ty_trait(box ty::TyTrait {
233 def_id,
234 ref substs,
235 store,
236 bounds
237 }) => {
238 mywrite!(w, "x[{}|", (cx.ds)(def_id));
239 enc_substs(w, cx, substs);
240 enc_trait_store(w, cx, store);
241 let bounds = ty::ParamBounds {builtin_bounds: bounds,
242 trait_bounds: Vec::new()};
243 enc_bounds(w, cx, &bounds);
244 mywrite!(w, "]");
245 }
246 ty::ty_tup(ref ts) => {
247 mywrite!(w, "T[");
248 for t in ts.iter() { enc_ty(w, cx, *t); }
249 mywrite!(w, "]");
250 }
251 ty::ty_box(typ) => { mywrite!(w, "@"); enc_ty(w, cx, typ); }
252 ty::ty_uniq(typ) => { mywrite!(w, "~"); enc_ty(w, cx, typ); }
253 ty::ty_ptr(mt) => { mywrite!(w, "*"); enc_mt(w, cx, mt); }
254 ty::ty_rptr(r, mt) => {
255 mywrite!(w, "&");
256 enc_region(w, cx, r);
257 enc_mt(w, cx, mt);
258 }
259 ty::ty_vec(mt, sz) => {
260 mywrite!(w, "V");
261 enc_mt(w, cx, mt);
262 mywrite!(w, "/");
263 match sz {
264 Some(n) => mywrite!(w, "{}|", n),
265 None => mywrite!(w, "|"),
266 }
267 }
268 ty::ty_str => {
269 mywrite!(w, "v");
270 }
271 ty::ty_closure(ref f) => {
272 mywrite!(w, "f");
273 enc_closure_ty(w, cx, *f);
274 }
275 ty::ty_bare_fn(ref f) => {
276 mywrite!(w, "F");
277 enc_bare_fn_ty(w, cx, f);
278 }
279 ty::ty_infer(_) => {
280 cx.diag.handler().bug("cannot encode inference variable types");
281 }
282 ty::ty_param(param_ty {idx: id, def_id: did}) => {
283 mywrite!(w, "p{}|{}", (cx.ds)(did), id);
284 }
285 ty::ty_self(did) => {
286 mywrite!(w, "s{}|", (cx.ds)(did));
287 }
288 ty::ty_struct(def, ref substs) => {
289 mywrite!(w, "a[{}|", (cx.ds)(def));
290 enc_substs(w, cx, substs);
291 mywrite!(w, "]");
292 }
293 ty::ty_err => fail!("shouldn't encode error type")
294 }
295 }
296
297 fn enc_fn_style(w: &mut MemWriter, p: FnStyle) {
298 match p {
299 NormalFn => mywrite!(w, "n"),
300 UnsafeFn => mywrite!(w, "u"),
301 }
302 }
303
304 fn enc_abi(w: &mut MemWriter, abi: Abi) {
305 mywrite!(w, "[");
306 mywrite!(w, "{}", abi.name());
307 mywrite!(w, "]")
308 }
309
310 fn enc_onceness(w: &mut MemWriter, o: Onceness) {
311 match o {
312 Once => mywrite!(w, "o"),
313 Many => mywrite!(w, "m")
314 }
315 }
316
317 pub fn enc_bare_fn_ty(w: &mut MemWriter, cx: &ctxt, ft: &ty::BareFnTy) {
318 enc_fn_style(w, ft.fn_style);
319 enc_abi(w, ft.abi);
320 enc_fn_sig(w, cx, &ft.sig);
321 }
322
323 fn enc_closure_ty(w: &mut MemWriter, cx: &ctxt, ft: &ty::ClosureTy) {
324 enc_fn_style(w, ft.fn_style);
325 enc_onceness(w, ft.onceness);
326 enc_trait_store(w, cx, ft.store);
327 let bounds = ty::ParamBounds {builtin_bounds: ft.bounds,
328 trait_bounds: Vec::new()};
329 enc_bounds(w, cx, &bounds);
330 enc_fn_sig(w, cx, &ft.sig);
331 }
332
333 fn enc_fn_sig(w: &mut MemWriter, cx: &ctxt, fsig: &ty::FnSig) {
334 mywrite!(w, "[{}|", fsig.binder_id);
335 for ty in fsig.inputs.iter() {
336 enc_ty(w, cx, *ty);
337 }
338 mywrite!(w, "]");
339 if fsig.variadic {
340 mywrite!(w, "V");
341 } else {
342 mywrite!(w, "N");
343 }
344 enc_ty(w, cx, fsig.output);
345 }
346
347 fn enc_bounds(w: &mut MemWriter, cx: &ctxt, bs: &ty::ParamBounds) {
348 for bound in bs.builtin_bounds.iter() {
349 match bound {
350 ty::BoundSend => mywrite!(w, "S"),
351 ty::BoundStatic => mywrite!(w, "O"),
352 ty::BoundSized => mywrite!(w, "Z"),
353 ty::BoundCopy => mywrite!(w, "P"),
354 ty::BoundShare => mywrite!(w, "T"),
355 }
356 }
357
358 for tp in bs.trait_bounds.iter() {
359 mywrite!(w, "I");
360 enc_trait_ref(w, cx, &**tp);
361 }
362
363 mywrite!(w, ".");
364 }
365
366 pub fn enc_type_param_def(w: &mut MemWriter, cx: &ctxt, v: &ty::TypeParameterDef) {
367 mywrite!(w, "{}:{}|", token::get_ident(v.ident), (cx.ds)(v.def_id));
368 enc_bounds(w, cx, &*v.bounds);
369 enc_opt(w, v.default, |w, t| enc_ty(w, cx, t));
370 }
librustc/metadata/tyencode.rs:332:1-332:1 -fn- definition:
fn enc_fn_sig(w: &mut MemWriter, cx: &ctxt, fsig: &ty::FnSig) {
mywrite!(w, "[{}|", fsig.binder_id);
for ty in fsig.inputs.iter() {
references:- 2329: enc_bounds(w, cx, &bounds);
330: enc_fn_sig(w, cx, &ft.sig);
331: }
librustc/metadata/tyencode.rs:54:1-54:1 -fn- definition:
fn mywrite(w: &mut MemWriter, fmt: &fmt::Arguments) {
fmt::write(&mut *w as &mut io::Writer, fmt);
}
references:- 79librustc/metadata/tyencode.rs:58:1-58:1 -fn- definition:
pub fn enc_ty(w: &mut MemWriter, cx: &ctxt, t: ty::t) {
match cx.abbrevs.borrow_mut().find(&t) {
Some(a) => { w.write(a.s.as_bytes()); return; }
references:- 11250: }
251: ty::ty_box(typ) => { mywrite!(w, "@"); enc_ty(w, cx, typ); }
252: ty::ty_uniq(typ) => { mywrite!(w, "~"); enc_ty(w, cx, typ); }
--
343: }
344: enc_ty(w, cx, fsig.output);
345: }
--
368: enc_bounds(w, cx, &*v.bounds);
369: enc_opt(w, v.default, |w, t| enc_ty(w, cx, t));
370: }
librustc/metadata/encoder.rs:
212: };
213: tyencode::enc_ty(ebml_w.writer, ty_str_ctxt, typ);
214: }
--
1865: let mut wr = MemWriter::new();
1866: tyencode::enc_ty(&mut wr, &tyencode::ctxt {
1867: diag: tcx.sess.diagnostic(),
librustc/metadata/tyencode.rs:68:4-68:4 -fn- definition:
fn estimate_sz(u: u64) -> u64 {
let mut n = u;
let mut len = 0;
references:- 273: }
74: let abbrev_len = 3 + estimate_sz(pos) + estimate_sz(len);
75: if abbrev_len < len {
librustc/metadata/tyencode.rs:52:1-52:1 -NK_AS_STR_TODO- definition:
pub type abbrev_map = RefCell<HashMap<ty::t, ty_abbrev>>;
fn mywrite(w: &mut MemWriter, fmt: &fmt::Arguments) {
fmt::write(&mut *w as &mut io::Writer, fmt);
references:- 240: pub tcx: &'a ty::ctxt,
41: pub abbrevs: &'a abbrev_map
42: }
librustc/metadata/encoder.rs:
88: pub encode_inlined_item: RefCell<EncodeInlinedItem<'a>>,
89: pub type_abbrevs: tyencode::abbrev_map,
90: }
librustc/metadata/tyencode.rs:163:1-163:1 -fn- definition:
fn enc_bound_region(w: &mut MemWriter, cx: &ctxt, br: ty::BoundRegion) {
match br {
ty::BrAnon(idx) => {
references:- 2144: mywrite!(w, "f[{}|", fr.scope_id);
145: enc_bound_region(w, cx, fr.bound_region);
146: mywrite!(w, "]");
librustc/metadata/tyencode.rs:96:1-96:1 -fn- definition:
fn enc_opt<T>(w: &mut MemWriter, t: Option<T>, enc_f: |&mut MemWriter, T|) {
match t {
None => mywrite!(w, "n"),
references:- 2368: enc_bounds(w, cx, &*v.bounds);
369: enc_opt(w, v.default, |w, t| enc_ty(w, cx, t));
370: }
librustc/metadata/tyencode.rs:179:1-179:1 -fn- definition:
pub fn enc_trait_ref(w: &mut MemWriter, cx: &ctxt, s: &ty::TraitRef) {
mywrite!(w, "{}|", (cx.ds)(s.def_id));
enc_substs(w, cx, &s.substs);
references:- 2359: mywrite!(w, "I");
360: enc_trait_ref(w, cx, &**tp);
361: }
librustc/metadata/encoder.rs:
121: ebml_w.start_tag(tag);
122: tyencode::enc_trait_ref(ebml_w.writer, ty_str_ctxt, trait_ref);
123: ebml_w.end_tag();
librustc/metadata/tyencode.rs:34:1-34:1 -struct- definition:
pub struct ctxt<'a> {
pub diag: &'a SpanHandler,
// Def -> str Callback:
references:- 22librustc/metadata/encoder.rs:
1865: let mut wr = MemWriter::new();
1866: tyencode::enc_ty(&mut wr, &tyencode::ctxt {
1867: diag: tcx.sess.diagnostic(),
librustc/middle/astencode.rs:
780: fn ty_str_ctxt<'a>(&'a self) -> tyencode::ctxt<'a> {
781: tyencode::ctxt {
782: diag: self.tcx.sess.diagnostic(),
librustc/metadata/tyencode.rs:
185: pub fn enc_trait_store(w: &mut MemWriter, cx: &ctxt, s: ty::TraitStore) {
186: match s {
--
317: pub fn enc_bare_fn_ty(w: &mut MemWriter, cx: &ctxt, ft: &ty::BareFnTy) {
318: enc_fn_style(w, ft.fn_style);
--
347: fn enc_bounds(w: &mut MemWriter, cx: &ctxt, bs: &ty::ParamBounds) {
348: for bound in bs.builtin_bounds.iter() {
--
366: pub fn enc_type_param_def(w: &mut MemWriter, cx: &ctxt, v: &ty::TypeParameterDef) {
367: mywrite!(w, "{}:{}|", token::get_ident(v.ident), (cx.ds)(v.def_id));
librustc/middle/astencode.rs:
775: trait get_ty_str_ctxt {
776: fn ty_str_ctxt<'a>(&'a self) -> tyencode::ctxt<'a>;
777: }
--
779: impl<'a> get_ty_str_ctxt for e::EncodeContext<'a> {
780: fn ty_str_ctxt<'a>(&'a self) -> tyencode::ctxt<'a> {
781: tyencode::ctxt {
librustc/metadata/tyencode.rs:
107: pub fn enc_substs(w: &mut MemWriter, cx: &ctxt, substs: &ty::substs) {
108: enc_region_substs(w, cx, &substs.regions);
librustc/metadata/tyencode.rs:296:1-296:1 -fn- definition:
fn enc_fn_style(w: &mut MemWriter, p: FnStyle) {
match p {
NormalFn => mywrite!(w, "n"),
references:- 2323: fn enc_closure_ty(w: &mut MemWriter, cx: &ctxt, ft: &ty::ClosureTy) {
324: enc_fn_style(w, ft.fn_style);
325: enc_onceness(w, ft.onceness);
librustc/metadata/tyencode.rs:129:1-129:1 -fn- definition:
fn enc_region(w: &mut MemWriter, cx: &ctxt, r: ty::Region) {
match r {
ty::ReLateBound(id, br) => {
references:- 3189: mywrite!(w, "&");
190: enc_region(w, cx, re);
191: enc_mutability(w, m);
--
255: mywrite!(w, "&");
256: enc_region(w, cx, r);
257: enc_mt(w, cx, mt);
librustc/metadata/tyencode.rs:346:1-346:1 -fn- definition:
fn enc_bounds(w: &mut MemWriter, cx: &ctxt, bs: &ty::ParamBounds) {
for bound in bs.builtin_bounds.iter() {
match bound {
references:- 3367: mywrite!(w, "{}:{}|", token::get_ident(v.ident), (cx.ds)(v.def_id));
368: enc_bounds(w, cx, &*v.bounds);
369: enc_opt(w, v.default, |w, t| enc_ty(w, cx, t));
librustc/metadata/tyencode.rs:184:1-184:1 -fn- definition:
pub fn enc_trait_store(w: &mut MemWriter, cx: &ctxt, s: ty::TraitStore) {
match s {
ty::UniqTraitStore => mywrite!(w, "~"),
references:- 2239: enc_substs(w, cx, substs);
240: enc_trait_store(w, cx, store);
241: let bounds = ty::ParamBounds {builtin_bounds: bounds,
--
325: enc_onceness(w, ft.onceness);
326: enc_trait_store(w, cx, ft.store);
327: let bounds = ty::ParamBounds {builtin_bounds: ft.bounds,
librustc/metadata/tyencode.rs:106:1-106:1 -fn- definition:
pub fn enc_substs(w: &mut MemWriter, cx: &ctxt, substs: &ty::substs) {
enc_region_substs(w, cx, &substs.regions);
enc_opt(w, substs.self_ty, |w, t| enc_ty(w, cx, t));
references:- 5228: mywrite!(w, "t[{}|", (cx.ds)(def));
229: enc_substs(w, cx, substs);
230: mywrite!(w, "]");
--
289: mywrite!(w, "a[{}|", (cx.ds)(def));
290: enc_substs(w, cx, substs);
291: mywrite!(w, "]");
librustc/middle/astencode.rs:
845: fn emit_substs(&mut self, ecx: &e::EncodeContext, substs: &ty::substs) {
846: self.emit_opaque(|this| Ok(tyencode::enc_substs(this.writer,
847: &ecx.ty_str_ctxt(),
librustc/metadata/tyencode.rs:
238: mywrite!(w, "x[{}|", (cx.ds)(def_id));
239: enc_substs(w, cx, substs);
240: enc_trait_store(w, cx, store);
librustc/metadata/tyencode.rs:84:1-84:1 -fn- definition:
fn enc_mutability(w: &mut MemWriter, mt: ast::Mutability) {
match mt {
MutImmutable => (),
references:- 2190: enc_region(w, cx, re);
191: enc_mutability(w, m);
192: }
librustc/metadata/tyencode.rs:46:66-46:66 -struct- definition:
// Whatever format you choose should not contain pipe characters.
pub struct ty_abbrev {
pos: uint,
references:- 276: // I.e. it's actually an abbreviation.
77: cx.abbrevs.borrow_mut().insert(t, ty_abbrev {
78: pos: pos as uint,
librustc/metadata/tyencode.rs:365:1-365:1 -fn- definition:
pub fn enc_type_param_def(w: &mut MemWriter, cx: &ctxt, v: &ty::TypeParameterDef) {
mywrite!(w, "{}:{}|", token::get_ident(v.ident), (cx.ds)(v.def_id));
enc_bounds(w, cx, &*v.bounds);
references:- 2librustc/middle/astencode.rs:
815: self.emit_opaque(|this| {
816: Ok(tyencode::enc_type_param_def(this.writer,
817: &ecx.ty_str_ctxt(),
librustc/metadata/encoder.rs:
157: ebml_w.start_tag(tag);
158: tyencode::enc_type_param_def(ebml_w.writer, ty_str_ctxt, param);
159: ebml_w.end_tag();
librustc/metadata/tyencode.rs:316:1-316:1 -fn- definition:
pub fn enc_bare_fn_ty(w: &mut MemWriter, cx: &ctxt, ft: &ty::BareFnTy) {
enc_fn_style(w, ft.fn_style);
enc_abi(w, ft.abi);
references:- 2276: mywrite!(w, "F");
277: enc_bare_fn_ty(w, cx, f);
278: }
librustc/metadata/encoder.rs:
234: };
235: tyencode::enc_bare_fn_ty(ebml_w.writer, ty_str_ctxt, typ);
librustc/metadata/tyencode.rs:91:1-91:1 -fn- definition:
fn enc_mt(w: &mut MemWriter, cx: &ctxt, mt: ty::mt) {
enc_mutability(w, mt.mutbl);
enc_ty(w, cx, mt.ty);
references:- 3256: enc_region(w, cx, r);
257: enc_mt(w, cx, mt);
258: }
--
260: mywrite!(w, "V");
261: enc_mt(w, cx, mt);
262: mywrite!(w, "/");