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

improve use of ErrorGuaranteed #103874

Closed
lcnr opened this issue Nov 2, 2022 · 3 comments
Closed

improve use of ErrorGuaranteed #103874

lcnr opened this issue Nov 2, 2022 · 3 comments
Assignees
Labels
C-cleanup Category: PRs that clean code up or issues documenting cleanup. E-medium Call for participation: Medium difficulty. Experience needed to fix: Intermediate. E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.

Comments

@lcnr
Copy link
Contributor

lcnr commented Nov 2, 2022

there are multiple small things to improve ErrorGuaranteed:

  • remove https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/struct.DelaySpanBugEmitted.html and always use ErrorGuaranteed directly.
  • add a way to create a ty_error and const_error by using an existing ErrorGuaranteed instead of using another delay_span_bug.
  • change uses of references_error which use delay_span_bug right after to instead use TypeVisitable::error_reported() and not emit a span_bug.
  • in TypeVisitable::error_reported(), instead of using ErrorGuaranteed::unchecked_claim_error_was_emitted(), use the tls tcx to check that tcx.sess.has_errors() is true (maybe in a #[cold] nested function for perf).
  • change error_reported to use Result<(), ErrorGuaranteed> instead of an option
  • consider merging error_reported and references_error so that there's only 1 function, using .is_ok() in the current uses of references_error. Not sure about this point, might not make stuff clearer and I can't think of a good name.
@lcnr lcnr added C-cleanup Category: PRs that clean code up or issues documenting cleanup. E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion. E-medium Call for participation: Medium difficulty. Experience needed to fix: Intermediate. labels Nov 2, 2022
@chenyukang
Copy link
Member

@rustbot claim

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Nov 4, 2022
Improve use of ErrorGuaranteed and code cleanup

Part of rust-lang#103874
Manishearth added a commit to Manishearth/rust that referenced this issue Nov 8, 2022
…y_error_with_guaranteed, r=lcnr

Add 'ty_error_with_guaranteed' and 'const_error_with_guaranteed'

Part of rust-lang#103874
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this issue Nov 8, 2022
…y_error_with_guaranteed, r=lcnr

Add 'ty_error_with_guaranteed' and 'const_error_with_guaranteed'

Part of rust-lang#103874
@chenyukang
Copy link
Member

The last sub-item didn't implemented.

@lcnr
Copy link
Contributor Author

lcnr commented Nov 11, 2022

👍

@lcnr lcnr closed this as completed Nov 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-cleanup Category: PRs that clean code up or issues documenting cleanup. E-medium Call for participation: Medium difficulty. Experience needed to fix: Intermediate. E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.
Projects
None yet
Development

No branches or pull requests

2 participants