Change:
<!-- Thank you for filing a bug report! Please provide a short summary of the bug, along with any information you feel relevant to replicating the bug. --Defining traits that contain methods that return such a type: The compiler should probably have warned me about not using the of the , consistent with the behaviour of async functions in Rust 1.67.0. This will also work without the need for traits but async traits is one of the most common use cases for such a type. <!-- If you're using the stable version of the compiler, you should also check if the bug also exists in the beta or nightly versions. --: <!-- Include a backtrace in the code block by setting in your environment. E.g. . --<details<summaryBacktrace</summary<p</p</details<!-- TRIAGEBOTSTART --<!-- TRIAGEBOTASSIGNSTART --<!-- TRIAGEBOTASSIGNDATASTARTTRIAGEBOTASSIGNDATAEND --<!-- TRIAGEBOTASSIGNEND --<!-- TRIAGEBOTEND --
We looked at this as the wg-async triage meeting today. We agree this is a bug and that the behavior should be consistent with on and/or . This is also likely a good first issue for someone wanting to contribute to async.
Would you say this is also a good issue for a first-time contributor to Rust? I'm not super familiar with the language, but I want to contribute to open source compilers, so I'm hoping to potentially take on this task.
Can I take this ?
Either one of you ( or are welcome to work on this! If it's your first time contributing to Rust, it might take a while to ramp up on it, but I find the best way to do that is to just do it. If you decided to have a go at it, feel free to ask any questions you have either here or in . I tend to watch #wg-async closer than GitHub issues, so you'll probably get a more prompt reply there.
this issue wasn't claimed so you are free to claim and work on it if you still are interested. Kindly comment with to claim the issue.
claim
This is also a very special case of

Discussion:
/// The root of the normal must_use lint with an optional message. Def(Span, DefId, Option<Symbol>), Boxed(Box<Self>), <ins> Pinned(Box<Self>), </ins> Opaque(Box<Self>), TraitObject(Box<Self>), TupleElement(Vec<(usize, Self)>),

is_ty_must_use(cx, boxed_ty, expr, span) .map(|inner| MustUsePath::Boxed(Box::new(inner))) } <ins> ty::Adt(def, args) if cx.tcx.lang_items().pin_type() == Some(def.did()) => { let pinned_ty = args.type_at(0); is_ty_must_use(cx, pinned_ty, expr, span) .map(|inner| MustUsePath::Pinned(Box::new(inner))) } </ins> ty::Adt(def, _) => is_def_must_use(cx, def.did(), span), ty::Alias(ty::Opaque, ty::AliasTy { def_id: def, .. }) => { elaborate(

expr_is_from_block, ); } <ins> MustUsePath::Pinned(path) => { let descr_pre = &format!("{descr_pre}pinned "); emit_must_use_untranslated( cx, path, descr_pre, descr_post, plural_len, true, expr_is_from_block, ); } </ins> MustUsePath::Opaque(path) => { let descr_pre = &format!("{descr_pre}implementer{plural_suffix} of "); emit_must_use_untranslated(

<ins> #![deny(unused_must_use)] use std::{ops::Deref, pin::Pin}; #[must_use] struct MustUse; #[must_use] struct MustUsePtr<'a, T>(&'a T); impl<'a, T> Deref for MustUsePtr<'a, T> { type Target = T; fn deref(&self) -> &Self::Target { self.0 } } fn pin_ref() -> Pin<&'static ()> { Pin::new(&()) } fn pin_ref_mut() -> Pin<&'static mut ()> { Pin::new(unimplemented!()) } fn pin_must_use_ptr() -> Pin<MustUsePtr<'static, ()>> { Pin::new(MustUsePtr(&())) } fn pin_box() -> Pin<Box<()>> { Box::pin(()) } fn pin_box_must_use() -> Pin<Box<MustUse>> { Box::pin(MustUse) } fn main() { pin_ref(); pin_ref_mut(); pin_must_use_ptr(); //~ ERROR unused pinned `MustUsePtr` that must be used pin_box(); pin_box_must_use(); //~ ERROR unused pinned boxed `MustUse` that must be used } </ins>

<ins> error: unused pinned `MustUsePtr` that must be used --> $DIR/must_use-pin.rs:42:5 | LL |     pin_must_use_ptr(); |     ^^^^^^^^^^^^^^^^^^ | note: the lint level is defined here --> $DIR/must_use-pin.rs:1:9 | LL | #![deny(unused_must_use)] |         ^^^^^^^^^^^^^^^ error: unused pinned boxed `MustUse` that must be used --> $DIR/must_use-pin.rs:44:5 | LL |     pin_box_must_use(); |     ^^^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors </ins>