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

remove unnecessary trait bound #1

Closed
wants to merge 1 commit into from
Closed

remove unnecessary trait bound #1

wants to merge 1 commit into from

Conversation

lcnr
Copy link

@lcnr lcnr commented Mar 5, 2024

This is necessary to continue to compile in future Rust versions as this previously only compiled due to an underspecified part of the type system. It will stop compiling once rust-lang/rust#119820 lands.

The where bound F: MakeWriter<'a> is weaker than the required bound of BunyanFormattingLayer which requires for<'a> F: MakeWriter<'a>, i.e. F implements MakeWriter<'a> for all lifetimes 'a, not just the lifetime 'a used when calling the function. This bound does hold because of an implementation of MakeWriter for all types which implement Fn() -> W. However, we generally prefer where-bounds over impls when proving trait bounds, causing us to get a higher-ranked region error.

This error was previously detected more eagerly, causing the compiler to discard this where-bound, proving the requirement by using the impl instead. This now stops being the case, causing your code to error.

Please ask for clarification if you would like further information. I apologize for the inconvenience.

this is necessary to continue to compile in
future Rust versions as this previously only
compiled due to an underspecified part of
the type system. It will stop compiling once
rust-lang/rust#119820
lands.
@lcnr
Copy link
Author

lcnr commented Jul 10, 2024

We ended up reverting the change to the compiler in rust-lang/rust#127568 for now, causing this change to no longer be necessary.

@lcnr lcnr closed this Jul 10, 2024
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.

1 participant