From 7928c5f830825a913ddeecbd4ec711152c7addb5 Mon Sep 17 00:00:00 2001 From: ouz-a Date: Tue, 5 Sep 2023 17:52:39 +0300 Subject: [PATCH] make comments less cryptic --- compiler/rustc_lint/src/traits.rs | 2 +- compiler/rustc_lint_defs/src/builtin.rs | 2 +- compiler/rustc_middle/src/ty/sty.rs | 2 +- tests/ui/drop-bounds/drop-bounds-impl-drop.rs | 10 +++++----- tests/ui/privacy/unnameable_types.rs | 8 ++++---- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/compiler/rustc_lint/src/traits.rs b/compiler/rustc_lint/src/traits.rs index 56508a2a6cc..e812493b3dd 100644 --- a/compiler/rustc_lint/src/traits.rs +++ b/compiler/rustc_lint/src/traits.rs @@ -96,7 +96,7 @@ impl<'tcx> LateLintPass<'tcx> for DropTraitConstraints { }; let def_id = trait_predicate.trait_ref.def_id; if cx.tcx.lang_items().drop_trait() == Some(def_id) { - // Explicitly allow `impl Drop`, a drop-guards-as-Voldemort-type pattern. + // Explicitly allow `impl Drop`, a drop-guards-as-unnameable-type pattern. if trait_predicate.trait_ref.self_ty().is_impl_trait() { continue; } diff --git a/compiler/rustc_lint_defs/src/builtin.rs b/compiler/rustc_lint_defs/src/builtin.rs index 0aa37642b74..aac83dda901 100644 --- a/compiler/rustc_lint_defs/src/builtin.rs +++ b/compiler/rustc_lint_defs/src/builtin.rs @@ -4408,7 +4408,7 @@ declare_lint! { /// pub struct S; /// } /// - /// pub fn get_voldemort() -> m::S { m::S } + /// pub fn get_unnameable() -> m::S { m::S } /// # fn main() {} /// ``` /// diff --git a/compiler/rustc_middle/src/ty/sty.rs b/compiler/rustc_middle/src/ty/sty.rs index 0291cdd6c57..fbbdfe5f14f 100644 --- a/compiler/rustc_middle/src/ty/sty.rs +++ b/compiler/rustc_middle/src/ty/sty.rs @@ -2857,7 +2857,7 @@ impl<'tcx> Ty<'tcx> { | ty::Uint(..) | ty::Float(..) => true, - // The voldemort ZSTs are fine. + // ZST which can't be named are fine. ty::FnDef(..) => true, ty::Array(element_ty, _len) => element_ty.is_trivially_pure_clone_copy(), diff --git a/tests/ui/drop-bounds/drop-bounds-impl-drop.rs b/tests/ui/drop-bounds/drop-bounds-impl-drop.rs index 063efc7b31a..15aebdf1bc9 100644 --- a/tests/ui/drop-bounds/drop-bounds-impl-drop.rs +++ b/tests/ui/drop-bounds/drop-bounds-impl-drop.rs @@ -2,13 +2,13 @@ #![deny(drop_bounds)] // As a special exemption, `impl Drop` in the return position raises no error. // This allows a convenient way to return an unnamed drop guard. -fn voldemort_type() -> impl Drop { - struct Voldemort; - impl Drop for Voldemort { +fn unnameable_type() -> impl Drop { + struct Unnameable; + impl Drop for Unnameable { fn drop(&mut self) {} } - Voldemort + Unnameable } fn main() { - let _ = voldemort_type(); + let _ = unnameable_type(); } diff --git a/tests/ui/privacy/unnameable_types.rs b/tests/ui/privacy/unnameable_types.rs index 46e24915259..9fa14c50583 100644 --- a/tests/ui/privacy/unnameable_types.rs +++ b/tests/ui/privacy/unnameable_types.rs @@ -21,10 +21,10 @@ mod m { } } -pub trait Voldemort {} +pub trait Unnameable {} -impl Voldemort for i32 {} -impl Voldemort for i32 {} -impl Voldemort for u32 where T: m::PubTr {} +impl Unnameable for i32 {} +impl Unnameable for i32 {} +impl Unnameable for u32 where T: m::PubTr {} fn main() {}