diff options
| author | bors <bors@rust-lang.org> | 2024-01-21 14:17:25 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2024-01-21 14:17:25 +0000 |
| commit | d9d89fd53dd18b7eeab0cc276353209eb8b073b2 (patch) | |
| tree | da64cc2a3a4ad25c3ac193640f0b936ea953d720 /tests/coverage/overflow.cov-map | |
| parent | fa404339c9821b9c61661d63326d95e354b9753f (diff) | |
| parent | 075f2e0345a00fcb3352ac9ece8a87817b73d305 (diff) | |
| download | rust-d9d89fd53dd18b7eeab0cc276353209eb8b073b2.tar.gz rust-d9d89fd53dd18b7eeab0cc276353209eb8b073b2.zip | |
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 https://github.com/rust-lang/rust/issues/77474#issuecomment-1074480790
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(),
}
}
}
```
Diffstat (limited to 'tests/coverage/overflow.cov-map')
0 files changed, 0 insertions, 0 deletions
