Reputation: 6343
Sometimes when you have an error, e.g. about what other types implement a trait, you'll see an error message like this:
error[E0277]: the trait bound `Vec<u8>: ToHeader` is not satisfied
--> src/main.rs:3:35
|
3 | #[derive(Clone, Debug, PartialEq, NewType)]
| ^^^^^^^ the trait `ToHeader` is not implemented for `Vec<u8>`
|
= help: the following other types implement trait `ToHeader`:
&T
Arc<T>
Box<T>
HexEncodedBytes
MaybeUndefined<T>
Uri
bool
f32
and 13 others
= note: this error originates in the derive macro `NewType` (in Nightly builds, run with -Z macro-backtrace for more info)
How can I see the 13 others in the above example? I've tried -vv
to no avail, and I can't see anything else in the help message.
You can repro this with this code:
# Cargo.toml
[dependencies]
poem = "1"
poem-openapi = "2"
//! src/main.rs
use poem_openapi::NewType;
#[derive(Clone, Debug, PartialEq, NewType)]
pub struct HexEncodedBytes(Vec<u8>);
fn main() {
println!("Hello, world!");
}
Upvotes: 8
Views: 116
Reputation: 70990
There is no way to relax the check. The numbers are hardcoded into the compiler.
There might be a way by printing rustc logs (Using the tracing/logging instrumentation - rustc-dev-guide) - I haven't checked, but even then it is very likely to be at debug
level that requires a local build of rustc, so it probably doesn't help you (if you can build rustc locally, you can just change the numbers).
So, you're best following the documentation of the trait. rustdoc has sections for types implementing the trait.
Upvotes: 4