Skip to content

Commit 890296b

Browse files
committed
Auto merge of #119807 - Emilgardis:track_caller_from_impl_into, r=Nilstrieb
Add `#[track_caller]` to the "From implies Into" impl This pr implements what was mentioned in rust-lang/rust#77474 (comment) This follows from my URLO https://users.rust-lang.org/t/104497 ```rust #![allow(warnings)] fn main() { // Gives a good location let _: Result<(), Loc> = dbg!(Err::<(), _>(()).map_err(|e| e.into())); // still doesn't work, gives location of `FnOnce::call_once()` let _: Result<(), Loc> = dbg!(Err::<(), _>(()).map_err(Into::into)); } #[derive(Debug)] pub struct Loc { pub l: &'static std::panic::Location<'static>, } impl From<()> for Loc { #[track_caller] fn from(_: ()) -> Self { Loc { l: std::panic::Location::caller(), } } } ```
2 parents 21fdcb8 + c368b4c commit 890296b

File tree

0 file changed

+0
-0
lines changed

    0 file changed

    +0
    -0
    lines changed

    0 commit comments

    Comments
     (0)