diff options
| author | Junseok Lee <lee.junseok@berkeley.edu> | 2015-02-18 16:23:13 -0800 |
|---|---|---|
| committer | Junseok Lee <lee.junseok@berkeley.edu> | 2015-02-20 16:16:09 -0800 |
| commit | 838595add0586e3e23967722e2005b66ea8387b8 (patch) | |
| tree | 75e98a8659cb754aff98ab4b269aca33275bf779 | |
| parent | 522d09dfecbeca1595f25ac58c6d0178bbd21d7d (diff) | |
suggestions no longer include private fields for structs outside local crate. closes #22421
| -rw-r--r-- | src/librustc_typeck/check/mod.rs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs index e443b4d0e60..9af5b85993c 100644 --- a/src/librustc_typeck/check/mod.rs +++ b/src/librustc_typeck/check/mod.rs @@ -117,7 +117,7 @@ use std::iter::repeat; use std::slice; use syntax::{self, abi, attr}; use syntax::attr::AttrMetaMethods; -use syntax::ast::{self, ProvidedMethod, RequiredMethod, TypeTraitItem, DefId}; +use syntax::ast::{self, ProvidedMethod, RequiredMethod, TypeTraitItem, DefId, Visibility}; use syntax::ast_util::{self, local_def, PostExpansionMethod}; use syntax::codemap::{self, Span}; use syntax::owned_slice::OwnedSlice; @@ -3117,6 +3117,10 @@ fn check_expr_with_unifier<'a, 'tcx, F>(fcx: &FnCtxt<'a, 'tcx>, if skip.iter().any(|&x| x == n) { continue; } + // ignore private fields from non-local crates + if id.krate != ast::LOCAL_CRATE && elem.vis != Visibility::Public { + continue; + } let dist = lev_distance(n, name); if dist < best_dist { best = Some(n); |
