1
Fork 0

Don't show fields from other crates

This commit is contained in:
Oli Scherer 2022-11-03 15:30:52 +00:00
parent 2e79f5f9f8
commit fcb1f1874f
2 changed files with 7 additions and 35 deletions

View file

@ -2499,7 +2499,9 @@ impl<'tcx> LateLintPass<'tcx> for InvalidValue {
) -> Option<InitError> {
let field_err = variant.fields.iter().find_map(|field| {
ty_find_init_error(cx, field.ty(cx.tcx, substs), init).map(|mut err| {
if err.span.is_none() {
if !field.did.is_local() {
err
} else if err.span.is_none() {
err.span = Some(cx.tcx.def_span(field.did));
write!(&mut err.message, " (in this {descr})").unwrap();
err