]> git.lizzy.rs Git - rust.git/commitdiff
Put back original field discovery
authorGuillaume Gomez <guillaume1.gomez@gmail.com>
Tue, 31 Jul 2018 19:43:29 +0000 (21:43 +0200)
committerGuillaume Gomez <guillaume1.gomez@gmail.com>
Tue, 31 Jul 2018 19:43:29 +0000 (21:43 +0200)
src/librustdoc/clean/mod.rs

index e019b26dd1dd9a3013646061943347d16bf1235f..2d4f365c7d78ea425d252552a92d20fe966785d1 100644 (file)
@@ -1211,8 +1211,14 @@ fn resolve(cx: &DocContext, path_str: &str, is_val: bool) -> Result<(Def, Option
                 } else {
                     match cx.tcx.type_of(did).sty {
                         ty::TyAdt(def, _) => {
-                            if let Some(item) = def.all_fields()
-                                                   .find(|item| item.ident.name == item_name) {
+                            if let Some(item) = if def.is_enum() {
+                                def.all_fields().find(|item| item.ident.name == item_name)
+                            } else {
+                                def.non_enum_variant()
+                                   .fields
+                                   .iter()
+                                   .find(|item| item.ident.name == item_name)
+                            } {
                                 Ok((ty.def,
                                     Some(format!("{}.{}",
                                                  if def.is_enum() {