Skip to content

Commit

Permalink
Rollup merge of #115570 - ouz-a:rustc_expelliarmus, r=davidtwco
Browse files Browse the repository at this point in the history
Make Voldemort comments less cryptic

These comments stumbled me when I saw them and had to ask what they meant, so I changed them to be less cryptic.

r? `@davidtwco`
  • Loading branch information
Dylan-DPC authored Sep 5, 2023
2 parents dcc4b5c + 6a0b1bc commit 9e1c684
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion compiler/rustc_lint/src/traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_middle/src/ty/sty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down
1 change: 1 addition & 0 deletions tests/ui/drop-bounds/drop-bounds-impl-drop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#![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.
// Voldemort here refers to types that are unnameable.
fn voldemort_type() -> impl Drop {
struct Voldemort;
impl Drop for Voldemort {
Expand Down

0 comments on commit 9e1c684

Please sign in to comment.