Skip to content

Mismatch between comment and actual code about when paths are made relative #715

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
bjorn3 opened this issue May 30, 2025 · 1 comment

Comments

@bjorn3
Copy link
Member

bjorn3 commented May 30, 2025

The comment says it is done only for the short format:

backtrace-rs/src/capture.rs

Lines 493 to 496 in 57c7529

// When printing paths we try to strip the cwd if it exists, otherwise
// we just print the path as-is. Note that we also only do this for the
// short format, because if it's full we presumably want to print
// everything.
Which matches the printing code in libstd. The actual code however does it for the full format:

backtrace-rs/src/capture.rs

Lines 501 to 507 in 57c7529

if style == PrintFmt::Full {
if let Ok(cwd) = &cwd {
if let Ok(suffix) = path.strip_prefix(cwd) {
return fmt::Display::fmt(&suffix.display(), fmt);
}
}
}

@philipc
Copy link
Contributor

philipc commented May 31, 2025

Looks like a regression in #526 which did a few changes to impl fmt::Debug for Backtrace which look unrelated to the issue the PR was addressing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants