weiznich / rust-foundation-community-grant

20 stars 6 forks source link

Rust Foundation Project Grant 2022

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:

  1. 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
  2. Experiment with example cases to see which error messages could be improved by the usage of #[rustc_on_unimplemented]
  3. Implement RFC-2397
  4. Experiment with example cases to see which error messages could be improved by the usage of #[do_not_recommend]

Call for participation

Please submit examples of bad error messages in the context of trait heavy crates as issue or PR (with minimal example) to this repository.

Test cases

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

uom

type_mismatch.rs <a name="uom_type_mismatch>

Versions:

version link (code) link (error message) change since last version
1 type_mismatch.rs type_mismatch.stderr

typed_builder

Typed builder generates hidden types/deprecating messages to improve its error messages

mismatch.rs

Versions:

version link (code) link (error message) change since last version
1 mismatch.rs mismatch.stderr

entrait

missing_impl_deep.rs

Versions:

version link (code) link (error message) change since last version
1 missing_impl_deep.rs missing_impl_deep.stderr

easy_ml

recursion.rs

Versions:

version link (code) link (error message) change since last version
1 recursion.rs recursion.stderr

diesel

bad_insertable_field.rs

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 https://github.com/diesel-rs/diesel/pull/3228 improves the spans for certain trait bounds so that compiler errors point to the corresponding struct fields instead of the derive

bad_sql_query.rs

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

invalid_query.rs

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

queryable_order_mismatch.rs

version link (code) link (error message) change since last version
1 queryable_order_mismatch.rs queryable_order_mismatch.stderr

chumsky

json.rs

version link (code) link (error message) change since last version
1 json.rs json.stderr

bevy

system_mismatch.rs

version link (code) link (error message) change since last version
1 system_mismatch.rs system_mismatch.stderr
2 system_mismatch.rs system_mismatch.stderr https://github.com/bevyengine/bevy/pull/5786, which introduces #[rustc_on_unimplemented] attributes in multiple locations

axum

axum provides a #[debug_handler] attribute which emits better error messages is some cases

argument_not_extractor.rs

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]

extract_self_ref

version link (code) link (error message) change since last version
1 extract_self_ref.rs extract_self_ref.stderr

extract_self_mut

version link (code) link (error message) change since last version
1 extract_self_mut.rs extract_self_mut.stderr

generics

version link (code) link (error message) change since last version
1 generics.rs generics.stderr

invalid_attrs

version link (code) link (error message) change since last version
1 invalid_attrs.rs invalid_attrs.stderr

missing_deserialize.rs

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]

multiple_body_extractors

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]

multiple_paths

version link (code) link (error message) change since last version
1 multiple_paths.rs multiple_paths.stderr

not_a_function

version link (code) link (error message) change since last version
1 not_a_function.rs not_a_function.stderr

not_async

version link (code) link (error message) change since last version
1 not_async.rs not_async.stderr

not_send

version link (code) link (error message) change since last version
1 not_send.rs not_send.stderr

request_not_last

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

too_many_extractors

version link (code) link (error message) change since last version
1 too_many_extractors.rs too_many_extractors.stderr

wrong_return_type.rs

version link (code) link (error message) change since last version
1 wrong_return_type.rs wrong_return_type.stderr