make comments less cryptic

This commit is contained in:
ouz-a 2023-09-05 17:52:39 +03:00
parent 810573919f
commit 7928c5f830
5 changed files with 12 additions and 12 deletions

View File

@ -96,7 +96,7 @@ fn check_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx hir::Item<'tcx>) {
};
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;
}

View File

@ -4408,7 +4408,7 @@
/// pub struct S;
/// }
///
/// pub fn get_voldemort() -> m::S { m::S }
/// pub fn get_unnameable() -> m::S { m::S }
/// # fn main() {}
/// ```
///

View File

@ -2857,7 +2857,7 @@ pub fn is_trivially_pure_clone_copy(self) -> bool {
| 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(),

View File

@ -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();
}

View File

@ -21,10 +21,10 @@ fn f() {}
}
}
pub trait Voldemort<T> {}
pub trait Unnameable<T> {}
impl Voldemort<m::PubStruct> for i32 {}
impl Voldemort<m::PubE> for i32 {}
impl<T> Voldemort<T> for u32 where T: m::PubTr {}
impl Unnameable<m::PubStruct> for i32 {}
impl Unnameable<m::PubE> for i32 {}
impl<T> Unnameable<T> for u32 where T: m::PubTr {}
fn main() {}