Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hide line numbers in $WORKSPACE errors #85

Merged
merged 2 commits into from
Aug 9, 2020
Merged

Hide line numbers in $WORKSPACE errors #85

merged 2 commits into from
Aug 9, 2020

Conversation

dtolnay
Copy link
Owner

@dtolnay dtolnay commented Aug 9, 2020

Closes #83.

Before:

error[E0277]: the trait bound `Ret: serde::ser::Serialize` is not satisfied
   --> $DIR/bad_endpoint6.rs:22:8
    |
22  |     Ok(HttpResponseOkObject(Ret { "Oxide".to_string(), 0x1de }))
    |        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `serde::ser::Serialize` is not implemented for `Ret`
    |
   ::: $WORKSPACE/dropshot/src/handler.rs:846:21
    |
846 |     T: JsonSchema + Serialize + Send + Sync + 'static,
    |                     --------- required by this bound in `dropshot::handler::HttpResponseOkObject`

After:

error[E0277]: the trait bound `Ret: serde::ser::Serialize` is not satisfied
   --> $DIR/bad_endpoint6.rs:22:8
    |
22  |     Ok(HttpResponseOkObject(Ret { "Oxide".to_string(), 0x1de }))
    |        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `serde::ser::Serialize` is not implemented for `Ret`
    |
   ::: $WORKSPACE/dropshot/src/handler.rs
    |
    |     T: JsonSchema + Serialize + Send + Sync + 'static,
    |                     --------- required by this bound in `dropshot::handler::HttpResponseOkObject`

I think compiletest-rs does this by subbing all line numbers with :LL:COL (https://github.com/rust-lang/rust/blob/18f3be7704a4ec7976fcd1272c728974243d29bd/src/test/ui/consts/offset_ub.stderr). I am not a fan of that since I find it breaks the immersion and makes it harder for a human reader to visually perceive the file as a user-facing compiler diagnostic that's worth critically evaluating and improving, as opposed to a test.

@dtolnay dtolnay merged commit e725fdb into master Aug 9, 2020
@dtolnay dtolnay deleted the hidelines branch August 9, 2020 23:41
@ahl
Copy link

ahl commented Aug 10, 2020

Thanks! This is great!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

way to omit line numbers?
2 participants