about summary refs log tree commit diff
path: root/src/librustc_save_analysis
diff options
context:
space:
mode:
authorDylan DPC <dylan.dpc@gmail.com>2020-02-23 09:57:43 +0100
committerGitHub <noreply@github.com>2020-02-23 09:57:43 +0100
commitae50725dc3e272a46726f548aaff801a4f456563 (patch)
tree9e831818289723cfa6bdedc9f19243f3dba41434 /src/librustc_save_analysis
parentcec00033a78d46df814728bcd831e71355a0efb0 (diff)
parent9f3dfd29a21f1bdc26720703f79d3fabdc7471de (diff)
downloadrust-ae50725dc3e272a46726f548aaff801a4f456563.tar.gz
rust-ae50725dc3e272a46726f548aaff801a4f456563.zip
Rollup merge of #69361 - Centril:free-ty-alias, r=petrochenkov
parse: allow `type Foo: Ord` syntactically

This addresses:
> (Work still remains to fuse this with free type aliases, but this can be done later.)

in https://github.com/rust-lang/rust/pull/69194.

r? @petrochenkov
Diffstat (limited to 'src/librustc_save_analysis')
-rw-r--r--src/librustc_save_analysis/dump_visitor.rs9
-rw-r--r--src/librustc_save_analysis/sig.rs7
2 files changed, 11 insertions, 5 deletions
diff --git a/src/librustc_save_analysis/dump_visitor.rs b/src/librustc_save_analysis/dump_visitor.rs
index db7733e7241..53dd6d28f89 100644
--- a/src/librustc_save_analysis/dump_visitor.rs
+++ b/src/librustc_save_analysis/dump_visitor.rs
@@ -1311,12 +1311,15 @@ impl<'l, 'tcx> Visitor<'l> for DumpVisitor<'l, 'tcx> {
                 self.process_mod(item);
                 visit::walk_mod(self, m);
             }
-            TyAlias(ref ty, ref ty_params) => {
+            TyAlias(ref ty_params, _, ref ty) => {
                 let qualname = format!(
                     "::{}",
                     self.tcx.def_path_str(self.tcx.hir().local_def_id_from_node_id(item.id))
                 );
-                let value = ty_to_string(&ty);
+                let value = match ty {
+                    Some(ty) => ty_to_string(&ty),
+                    None => "_".to_string(),
+                };
                 if !self.span.filter_generated(item.ident.span) {
                     let span = self.span_from_span(item.ident.span);
                     let id = id_from_node_id(item.id, &self.save_ctxt);
@@ -1341,7 +1344,7 @@ impl<'l, 'tcx> Visitor<'l> for DumpVisitor<'l, 'tcx> {
                     );
                 }
 
-                self.visit_ty(&ty);
+                walk_list!(self, visit_ty, ty);
                 self.process_generic_params(ty_params, &qualname, item.id);
             }
             Mac(_) => (),
diff --git a/src/librustc_save_analysis/sig.rs b/src/librustc_save_analysis/sig.rs
index a2c61db4b7c..2c07ed0571b 100644
--- a/src/librustc_save_analysis/sig.rs
+++ b/src/librustc_save_analysis/sig.rs
@@ -423,12 +423,15 @@ impl Sig for ast::Item {
 
                 Ok(Signature { text, defs, refs: vec![] })
             }
-            ast::ItemKind::TyAlias(ref ty, ref generics) => {
+            ast::ItemKind::TyAlias(ref generics, _, ref ty) => {
                 let text = "type ".to_owned();
                 let mut sig = name_and_generics(text, offset, generics, self.id, self.ident, scx)?;
 
                 sig.text.push_str(" = ");
-                let ty = ty.make(offset + sig.text.len(), id, scx)?;
+                let ty = match ty {
+                    Some(ty) => ty.make(offset + sig.text.len(), id, scx)?,
+                    None => Err("Ty")?,
+                };
                 sig.text.push_str(&ty.text);
                 sig.text.push(';');