-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Labels
C-bugCategory: This is a bug.Category: This is a bug.F-track_caller`#![feature(track_caller)]``#![feature(track_caller)]`T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
I was playing around with function pointers to track_caller
methods (which doesn't seem entirely implemented yet) and arrived at the following testcase:
fn call_it<T>(f: fn(T), x: T) {
f(x);
}
fn main() {
call_it(Result::unwrap, Err(0));
}
On stable, this behaves as expected:
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: 0', src/libcore/result.rs:1165:5
On the latest nightly though, the message is different:
thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', src/libstd/panicking.rs:369:15
The line number points at this:
Line 369 in af95804
let loc = info.location().unwrap(); // The current implementation always returns Some |
Two things seem odd here for me:
- I am actually surprised that this does not ICE, given that the
ReifyShim
stuff does not seem entirely implemented (at least this test still ICEs). - But the actual main bug here is that the comment about "always returns Some" seems wrong, so this panics at the wrong place. Clearly, the message shouldn't talk about
Option::unwrap()
when the actual panic is caused by aResult::unwrap
.
Cc @anp
Metadata
Metadata
Assignees
Labels
C-bugCategory: This is a bug.Category: This is a bug.F-track_caller`#![feature(track_caller)]``#![feature(track_caller)]`T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.