mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-25 08:13:41 +00:00
make comments less cryptic
This commit is contained in:
parent
810573919f
commit
7928c5f830
@ -96,7 +96,7 @@ impl<'tcx> LateLintPass<'tcx> for DropTraitConstraints {
|
|||||||
};
|
};
|
||||||
let def_id = trait_predicate.trait_ref.def_id;
|
let def_id = trait_predicate.trait_ref.def_id;
|
||||||
if cx.tcx.lang_items().drop_trait() == Some(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() {
|
if trait_predicate.trait_ref.self_ty().is_impl_trait() {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -4408,7 +4408,7 @@ declare_lint! {
|
|||||||
/// pub struct S;
|
/// pub struct S;
|
||||||
/// }
|
/// }
|
||||||
///
|
///
|
||||||
/// pub fn get_voldemort() -> m::S { m::S }
|
/// pub fn get_unnameable() -> m::S { m::S }
|
||||||
/// # fn main() {}
|
/// # fn main() {}
|
||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
|
@ -2857,7 +2857,7 @@ impl<'tcx> Ty<'tcx> {
|
|||||||
| ty::Uint(..)
|
| ty::Uint(..)
|
||||||
| ty::Float(..) => true,
|
| ty::Float(..) => true,
|
||||||
|
|
||||||
// The voldemort ZSTs are fine.
|
// ZST which can't be named are fine.
|
||||||
ty::FnDef(..) => true,
|
ty::FnDef(..) => true,
|
||||||
|
|
||||||
ty::Array(element_ty, _len) => element_ty.is_trivially_pure_clone_copy(),
|
ty::Array(element_ty, _len) => element_ty.is_trivially_pure_clone_copy(),
|
||||||
|
@ -2,13 +2,13 @@
|
|||||||
#![deny(drop_bounds)]
|
#![deny(drop_bounds)]
|
||||||
// As a special exemption, `impl Drop` in the return position raises no error.
|
// As a special exemption, `impl Drop` in the return position raises no error.
|
||||||
// This allows a convenient way to return an unnamed drop guard.
|
// This allows a convenient way to return an unnamed drop guard.
|
||||||
fn voldemort_type() -> impl Drop {
|
fn unnameable_type() -> impl Drop {
|
||||||
struct Voldemort;
|
struct Unnameable;
|
||||||
impl Drop for Voldemort {
|
impl Drop for Unnameable {
|
||||||
fn drop(&mut self) {}
|
fn drop(&mut self) {}
|
||||||
}
|
}
|
||||||
Voldemort
|
Unnameable
|
||||||
}
|
}
|
||||||
fn main() {
|
fn main() {
|
||||||
let _ = voldemort_type();
|
let _ = unnameable_type();
|
||||||
}
|
}
|
||||||
|
@ -21,10 +21,10 @@ mod m {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait Voldemort<T> {}
|
pub trait Unnameable<T> {}
|
||||||
|
|
||||||
impl Voldemort<m::PubStruct> for i32 {}
|
impl Unnameable<m::PubStruct> for i32 {}
|
||||||
impl Voldemort<m::PubE> for i32 {}
|
impl Unnameable<m::PubE> for i32 {}
|
||||||
impl<T> Voldemort<T> for u32 where T: m::PubTr {}
|
impl<T> Unnameable<T> for u32 where T: m::PubTr {}
|
||||||
|
|
||||||
fn main() {}
|
fn main() {}
|
||||||
|
Loading…
Reference in New Issue
Block a user