Skip to content

Commit 93543bc

Browse files
authored
Rollup merge of #115578 - ouz-a:rustc_clarify, r=oli-obk
Clarify cryptic comments Clarifies some unclear comments that lurked in the compiler. r? ``@oli-obk``
2 parents 7498dca + 7928c5f commit 93543bc

File tree

5 files changed

+12
-12
lines changed

5 files changed

+12
-12
lines changed

compiler/rustc_lint/src/traits.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ impl<'tcx> LateLintPass<'tcx> for DropTraitConstraints {
9696
};
9797
let def_id = trait_predicate.trait_ref.def_id;
9898
if cx.tcx.lang_items().drop_trait() == Some(def_id) {
99-
// Explicitly allow `impl Drop`, a drop-guards-as-Voldemort-type pattern.
99+
// Explicitly allow `impl Drop`, a drop-guards-as-unnameable-type pattern.
100100
if trait_predicate.trait_ref.self_ty().is_impl_trait() {
101101
continue;
102102
}

compiler/rustc_lint_defs/src/builtin.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4363,7 +4363,7 @@ declare_lint! {
43634363
/// pub struct S;
43644364
/// }
43654365
///
4366-
/// pub fn get_voldemort() -> m::S { m::S }
4366+
/// pub fn get_unnameable() -> m::S { m::S }
43674367
/// # fn main() {}
43684368
/// ```
43694369
///

compiler/rustc_middle/src/ty/sty.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2857,7 +2857,7 @@ impl<'tcx> Ty<'tcx> {
28572857
| ty::Uint(..)
28582858
| ty::Float(..) => true,
28592859

2860-
// The voldemort ZSTs are fine.
2860+
// ZST which can't be named are fine.
28612861
ty::FnDef(..) => true,
28622862

28632863
ty::Array(element_ty, _len) => element_ty.is_trivially_pure_clone_copy(),

tests/ui/drop-bounds/drop-bounds-impl-drop.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
#![deny(drop_bounds)]
33
// As a special exemption, `impl Drop` in the return position raises no error.
44
// This allows a convenient way to return an unnamed drop guard.
5-
fn voldemort_type() -> impl Drop {
6-
struct Voldemort;
7-
impl Drop for Voldemort {
5+
fn unnameable_type() -> impl Drop {
6+
struct Unnameable;
7+
impl Drop for Unnameable {
88
fn drop(&mut self) {}
99
}
10-
Voldemort
10+
Unnameable
1111
}
1212
fn main() {
13-
let _ = voldemort_type();
13+
let _ = unnameable_type();
1414
}

tests/ui/privacy/unnameable_types.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ mod m {
2020
}
2121
}
2222

23-
pub trait Voldemort<T> {}
23+
pub trait Unnameable<T> {}
2424

25-
impl Voldemort<m::PubStruct> for i32 {}
26-
impl Voldemort<m::PubE> for i32 {}
27-
impl<T> Voldemort<T> for u32 where T: m::PubTr {}
25+
impl Unnameable<m::PubStruct> for i32 {}
26+
impl Unnameable<m::PubE> for i32 {}
27+
impl<T> Unnameable<T> for u32 where T: m::PubTr {}
2828

2929
fn main() {}

0 commit comments

Comments
 (0)