Use same name as attr.

Co-authored-by: Bastian Kauschke <bastian_kauschke@hotmail.de>
This commit is contained in:
jumbatm 2020-08-25 23:52:41 +10:00
parent 671770ed85
commit 2ea86af1ea
2 changed files with 3 additions and 3 deletions

View file

@ -2172,7 +2172,7 @@ impl ClashingExternDeclarations {
loop {
if let ty::Adt(def, substs) = ty.kind {
let is_transparent = def.subst(tcx, substs).repr.transparent();
let is_non_null = crate::types::guaranteed_nonnull_optimization(tcx, &def);
let is_non_null = crate::types::nonnull_optimization_guaranteed(tcx, &def);
debug!(
"non_transparent_ty({:?}) -- type is transparent? {}, type is non-null? {}",
ty, is_transparent, is_non_null

View file

@ -527,7 +527,7 @@ enum FfiResult<'tcx> {
FfiUnsafe { ty: Ty<'tcx>, reason: String, help: Option<String> },
}
crate fn guaranteed_nonnull_optimization<'tcx>(tcx: TyCtxt<'tcx>, def: &ty::AdtDef) -> bool {
crate fn nonnull_optimization_guaranteed<'tcx>(tcx: TyCtxt<'tcx>, def: &ty::AdtDef) -> bool {
tcx.get_attrs(def.did)
.iter()
.any(|a| tcx.sess.check_name(a, sym::rustc_nonnull_optimization_guaranteed))
@ -541,7 +541,7 @@ crate fn ty_is_known_nonnull<'tcx>(cx: &LateContext<'tcx>, ty: Ty<'tcx>, mode: C
ty::Ref(..) => true,
ty::Adt(def, _) if def.is_box() && matches!(mode, CItemKind::Definition) => true,
ty::Adt(def, substs) if def.repr.transparent() && !def.is_union() => {
let marked_non_null = guaranteed_nonnull_optimization(tcx, &def);
let marked_non_null = nonnull_optimization_guaranteed(tcx, &def);
if marked_non_null {
return true;