Rust errors / Types and traits
Rust compiler error · checked with rustc 1.99.0
Rust error E0737: `#[track_caller]` can only be used with the Rust ABI
What it means#[track_caller] requires functions to have the "Rust" ABI for implicitly receiving caller location. See [RFC 2091] for details on this and other restrictions.
What rustc prints
error[E0737]: `#[track_caller]` can only be used with the Rust ABI
--> main.rs:1:1
|
1 | #[track_caller]
| ^^^^^^^^^^^^^^^ using `#[track_caller]` here
2 | extern "C" fn foo() {}
| ---------- not using the Rust ABI because of thisReal output of rustc 1.99.0 compiling the official example below (2021 edition). Your names and line numbers will differ; the first line is the part to match.
The compiler team's explanation
#[track_caller] requires functions to have the "Rust" ABI for implicitly receiving caller location. See RFC 2091 for details on this and other restrictions.
Erroneous code example:
#[track_caller]
extern "C" fn foo() {}From rustc --explain E0737 (1.99.0), part of the Rust project, MIT or Apache-2.0. Official page.
Related errors
- E0308mismatched types
- E0277the trait bound is not satisfied
- E0599no method named X found in the current scope
- E0433failed to resolve
- E0720cannot resolve opaque type
- E0735generic parameters cannot use `Self` in their defaults
- E0740field must implement `Copy` or be wrapped in `ManuallyDrop<...>` to be used in a union
- E0741`A` must implement `ConstParamTy` to be used as the type of a const generic parameter
Up next
Often hit nextE0308: mismatched typesA related error from the same family.Read it next →Did this answer your question?