This repository is used to track information about my Rust Foundation Project Grant to improve error messages emitted by rustc for trait heavy crates. As part of this work I will focus on the following points:
- Collect and categorise various examples of non-optimal error messages from the rust ecosystem. This includes error messages generated by crates like diesel, axum or nalgebra which relay heavily on complex trait bounds
- Experiment with example cases to see which error messages could be improved by
the usage of
#[rustc_on_unimplemented]
- Implement RFC-2397
- Experiment with example cases to see which error messages could be improved by
the usage of
#[do_not_recommend]
Please submit examples of bad error messages in the context of trait heavy crates as issue or PR (with minimal example) to this repository.
crate | test case | error type |
---|---|---|
uom | type_mismatch.rs | type mismatch |
typed_builder | mismatch.rs | type mismatch + missing free standing function |
easy_ml | recursion.rs | type recursion |
diesel | bad_insertable_field.rs | trait not implemented + misleading wildcard impl |
diesel | bad_sql_query.rs | trait not implemented |
diesel | invalid_query.rs | traits not implemented + "duplicated errors" |
diesel | queryable_order_mismatch.rs | trait not implemented with large types |
chumsky | json.rs | associated type mismatch |
bevy | system_mismatch.rs | trait not implemented + HRTB error |
axum | argument_not_extractor.rs | debug_handler |
axum | extract_self_mut.rs | debug_handler |
axum | extract_self_ref.rs | debug_handler |
axum | generics.rs | debug_handler |
axum | invalid_attrs.rs | debug_handler |
axum | missing_deserialize.rs | trait not implemented |
axum | multiple_body_extractors.rs | debug_handler |
axum | multiple_paths.rs | debug_handler |
axum | not_a_function.rs | debug_handler |
axum | not_async.rs | debug_handler |
axum | not_send.rs | debug_handler |
axum | request_not_last.rs | debug_handler |
axum | too_many_extractors.rs | debug_handler |
axum | wrong_return_type.rs | debug_handler |
entrait | missing_impl_deep.rs | trait not implemented |
Versions:
version | link (code) | link (error message) | change since last version |
---|---|---|---|
1 | type_mismatch.rs | type_mismatch.stderr |
Typed builder generates hidden types/deprecating messages to improve its error messages
Versions:
version | link (code) | link (error message) | change since last version |
---|---|---|---|
1 | mismatch.rs | mismatch.stderr |
Versions:
version | link (code) | link (error message) | change since last version |
---|---|---|---|
1 | missing_impl_deep.rs | missing_impl_deep.stderr |
Versions:
version | link (code) | link (error message) | change since last version |
---|---|---|---|
1 | recursion.rs | recursion.stderr |
version | link (code) | link (error message) | change since last version |
---|---|---|---|
1 | bad_insertable_field.rs | bad_insertable_field.stderr | |
2 | bad_insertable_field.rs | bad_insertable_field.stderr | diesel-rs/diesel#3228 improves the spans for certain trait bounds so that compiler errors point to the corresponding struct fields instead of the derive |
version | link (code) | link (error message) | change since last version |
---|---|---|---|
1 | bad_sql_query.rs | bad_sql_query.stderr | |
2 | bad_sql_query.rs | bad_sql_query.stderr | Add a #[rustc_on_unimplemented] on the corresponding trait. https://github.com/diesel-rs/diesel/commit/958391a3e793e409d0a925e0cc2317726c2d84b2 |
version | link (code) | link (error message) | change since last version |
---|---|---|---|
1 | invalid_query.rs | invalid_query.stderr | |
2 | invalid_query.rs | invalid_query.stderr | Add a #[rustc_on_unimplemented] on the corresponding trait. https://github.com/diesel-rs/diesel/commit/958391a3e793e409d0a925e0cc2317726c2d84b2 |
version | link (code) | link (error message) | change since last version |
---|---|---|---|
1 | queryable_order_mismatch.rs | queryable_order_mismatch.stderr |
version | link (code) | link (error message) | change since last version |
---|---|---|---|
1 | json.rs | json.stderr |
version | link (code) | link (error message) | change since last version |
---|---|---|---|
1 | system_mismatch.rs | system_mismatch.stderr | |
2 | system_mismatch.rs | system_mismatch.stderr | bevyengine/bevy#5786, which introduces #[rustc_on_unimplemented] attributes in multiple locations |
axum provides a #[debug_handler]
attribute which emits better error messages is some cases
version | link (code) | link (error message) | change since last version |
---|---|---|---|
1 | argument_not_extractor.rs | argument_not_extractor.stderr | |
2 | argument_not_extractor.rs | argument_not_extractor.stderr | Fixes to the error spans of #[debug_handler] |
3 | argument_not_extractor.rs | argument_not_extractor.stderr | Point to #[debug_handler] |
version | link (code) | link (error message) | change since last version |
---|---|---|---|
1 | extract_self_ref.rs | extract_self_ref.stderr |
version | link (code) | link (error message) | change since last version |
---|---|---|---|
1 | extract_self_mut.rs | extract_self_mut.stderr |
version | link (code) | link (error message) | change since last version |
---|---|---|---|
1 | generics.rs | generics.stderr |
version | link (code) | link (error message) | change since last version |
---|---|---|---|
1 | invalid_attrs.rs | invalid_attrs.stderr |
version | link (code) | link (error message) | change since last version |
---|---|---|---|
1 | missing_deserialize.rs | missing_deserialize.stderr | |
2 | missing_deserialize.rs | missing_deserialize.stderr | Point to #[debug_handler] |
version | link (code) | link (error message) | change since last version |
---|---|---|---|
1 | multiple_body_extractors.rs | multiple_body_extractors.stderr | |
2 | multiple_body_extractors.rs | multiple_body_extractors.stderr | Fixes to the error spans of #[debug_handler] |
3 | multiple_body_extractors.rs | multiple_body_extractors.stderr | Point to #[debug_handler] |
version | link (code) | link (error message) | change since last version |
---|---|---|---|
1 | multiple_paths.rs | multiple_paths.stderr |
version | link (code) | link (error message) | change since last version |
---|---|---|---|
1 | not_a_function.rs | not_a_function.stderr |
version | link (code) | link (error message) | change since last version |
---|---|---|---|
1 | not_async.rs | not_async.stderr |
version | link (code) | link (error message) | change since last version |
---|---|---|---|
1 | not_send.rs | not_send.stderr |
version | link (code) | link (error message) | change since last version |
---|---|---|---|
1 | request_not_last.rs | request_not_last.stderr | |
2 | request_not_last.rs | request_not_last.stderr | Fixes to the error spans of #[debug_handler] |
3 | request_not_last.rs | request_not_last.stderr | Point out as part of the error message, that Request always needs to be the last handler argument |
version | link (code) | link (error message) | change since last version |
---|---|---|---|
1 | too_many_extractors.rs | too_many_extractors.stderr |
version | link (code) | link (error message) | change since last version |
---|---|---|---|
1 | wrong_return_type.rs | wrong_return_type.stderr |