Skip to content

Commit f1c4a92

Browse files
committed
stub out trait aliases in resolve
1 parent d4a2826 commit f1c4a92

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

src/librustc_resolve/build_reduced_graph.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,11 @@ impl<'a> Resolver<'a> {
344344
}
345345
}
346346

347+
ItemKind::TraitAlias(..) => {
348+
let def = Def::TraitAlias(self.definitions.local_def_id(item.id));
349+
self.define(parent, ident, TypeNS, (def, vis, sp, expansion));
350+
}
351+
347352
// These items live in both the type and value namespaces.
348353
ItemKind::Struct(ref struct_def, _) => {
349354
// Define a name in the type namespace.
@@ -411,6 +416,7 @@ impl<'a> Resolver<'a> {
411416
self.define(parent, ident, TypeNS, (module, vis, sp, expansion));
412417
self.current_module = module;
413418
}
419+
414420
ItemKind::MacroDef(..) | ItemKind::Mac(_) => unreachable!(),
415421
}
416422
}

src/librustc_resolve/lib.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -474,6 +474,7 @@ impl<'a> PathSource<'a> {
474474
},
475475
PathSource::Trait => match def {
476476
Def::Trait(..) => true,
477+
Def::TraitAlias(..) => true,
477478
_ => false,
478479
},
479480
PathSource::Expr(..) => match def {
@@ -1935,6 +1936,17 @@ impl<'a> Resolver<'a> {
19351936
});
19361937
}
19371938

1939+
ItemKind::TraitAlias(ref generics, ref bounds) => {
1940+
// Create a new rib for the trait-wide type parameters.
1941+
self.with_type_parameter_rib(HasTypeParameters(generics, ItemRibKind), |this| {
1942+
let local_def_id = this.definitions.local_def_id(item.id);
1943+
this.with_self_rib(Def::SelfTy(Some(local_def_id), None), |this| {
1944+
this.visit_generics(generics);
1945+
walk_list!(this, visit_ty_param_bound, bounds);
1946+
});
1947+
});
1948+
}
1949+
19381950
ItemKind::Mod(_) | ItemKind::ForeignMod(_) => {
19391951
self.with_scope(item.id, |this| {
19401952
visit::walk_item(this, item);

0 commit comments

Comments
 (0)