diff options
| author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2018-07-31 21:43:29 +0200 |
|---|---|---|
| committer | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2018-07-31 21:43:29 +0200 |
| commit | d94bdf8c66932b0cecc0024508316131c797dc2a (patch) | |
| tree | afaee22ff8549cc610e39558bef4e8feb866b735 /src | |
| parent | d5f1f70a8e8d3f54230fe07eb0a79002161b2788 (diff) | |
Put back original field discovery
Diffstat (limited to 'src')
| -rw-r--r-- | src/librustdoc/clean/mod.rs | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs index e019b26dd1d..2d4f365c7d7 100644 --- a/src/librustdoc/clean/mod.rs +++ b/src/librustdoc/clean/mod.rs @@ -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() { |
