bevy icon indicating copy to clipboard operation
bevy copied to clipboard

bevy::picking::events::Drop clashes with std::ops::Drop

Open ItsDoot opened this issue 1 year ago • 2 comments

What problem does this solve or what need does it fill?

Valid as of latest main (3cf70ba4f9d62396240b186ff379d27a312d2aa2).

#14686 Introduced a name clash when using use bevy::prelude::*;

Which causes this error:

error[E0404]: expected trait, found struct `Drop`
 --> src\t.rs:5:6
  |
5 | impl Drop for Foo {
  |      ^^^^ not a trait
  |
help: consider importing one of these items instead
  |
1 + use core::ops::Drop;
  |
1 + use std::ops::Drop;
  |

with:

use bevy::prelude::*;

pub struct Foo {}

impl Drop for Foo {
    fn drop(&mut self) {}
}

What solution would you like?

Rename bevy::picking::events::Drop. No personal preference on what the new name should be.

ItsDoot avatar Aug 24 '24 05:08 ItsDoot

If I might suggest an alternative name for bevy::picking::events::Drop... perhaps DropOnto? It stays just as explicit with what it's for (an event where something is dropped onto something else), while no longer conflicting with std::ops::Drop.

If that doesn't work, perhaps DragDrop, which sticks with the naming scheme of structs just above it (Drag followed by a suffix).

LikeLakers2 avatar Aug 24 '24 06:08 LikeLakers2

+1 to DragDrop

MrGVSV avatar Aug 24 '24 13:08 MrGVSV

I thought I would name it Droppable, but then I realized, there is DragLeave, DragOver ... so DragDrop is a good match as it was mentioned in earlier comments.

I would like to pull request. Bear with me, it's my first pull request here and I haven't done very few PR overall. Suggestions or even dropping the pull request is fine. But please comment.

kivi avatar Aug 26 '24 15:08 kivi