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:
parent
85fbf49ce0
commit
0f2bd56b29
4 changed files with 27 additions and 25 deletions
|
@ -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",
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue