1
Fork 0

Remove the def-id from type parameters. Having this def-id was bad for several reasons:

1. Produced more unique types than is necessary. This increases memory consumption.
2. Linking the type parameter to its definition *seems* like a good idea, but it
   encourages reliance on the bounds listing.
3. It made pretty-printing harder and in particular was causing bad error messages
   when errors occurred before the `TypeParameterDef` entries were fully stored.
This commit is contained in:
Niko Matsakis 2014-12-27 19:42:27 -05:00
parent 964a5fabb7
commit 2bbd2f9cea
14 changed files with 120 additions and 138 deletions

View file

@ -435,15 +435,14 @@ impl fmt::Show for clean::Type {
clean::TyParamBinder(id) => {
f.write(cache().typarams[ast_util::local_def(id)].as_bytes())
}
clean::Generic(did) => {
f.write(cache().typarams[did].as_bytes())
clean::Generic(ref name) => {
f.write(name.as_bytes())
}
clean::ResolvedPath{ did, ref typarams, ref path } => {
try!(resolved_path(f, did, path, false));
tybounds(f, typarams)
}
clean::Infer => write!(f, "_"),
clean::Self(..) => f.write("Self".as_bytes()),
clean::Primitive(prim) => primitive_link(f, prim, prim.to_string()),
clean::Closure(ref decl) => {
write!(f, "{style}{lifetimes}|{args}|{bounds}{arrow}",