1
Fork 0

lint/ty: move fns to avoid abstraction violation

This commit moves `transparent_newtype_field` and `is_zst` to
`LateContext` where they are used, rather than being on the `VariantDef`
and `TyS` types.

Signed-off-by: David Wood <david@davidtw.co>
This commit is contained in:
David Wood 2020-08-03 11:08:03 +01:00
parent 85fbf49ce0
commit 0f2bd56b29
No known key found for this signature in database
GPG key ID: 2592E76C87381FD9
4 changed files with 27 additions and 25 deletions

View file

@ -21,7 +21,8 @@
//! `late_lint_methods!` invocation in `lib.rs`.
use crate::{
types::CItemKind, EarlyContext, EarlyLintPass, LateContext, LateLintPass, LintContext,
types::{transparent_newtype_field, CItemKind},
EarlyContext, EarlyLintPass, LateContext, LateLintPass, LintContext,
};
use rustc_ast::attr::{self, HasAttrs};
use rustc_ast::tokenstream::{TokenStream, TokenTree};
@ -2180,8 +2181,7 @@ impl ClashingExternDeclarations {
if is_transparent && !is_non_null {
debug_assert!(def.variants.len() == 1);
let v = &def.variants[VariantIdx::new(0)];
ty = v
.transparent_newtype_field(tcx)
ty = transparent_newtype_field(tcx, v)
.expect(
"single-variant transparent structure with zero-sized field",
)