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

Investigate new nightly warning about a soundness hole in the type system #4035

Closed
2 of 3 tasks
weiznich opened this issue May 22, 2024 · 0 comments · Fixed by #4050
Closed
2 of 3 tasks

Investigate new nightly warning about a soundness hole in the type system #4035

weiznich opened this issue May 22, 2024 · 0 comments · Fixed by #4050
Labels
bug cli Release Blocker This issue needs to be solved before we can release a new version, it can't be punted to the next

Comments

@weiznich
Copy link
Member

weiznich commented May 22, 2024

Setup

Versions

  • Rust: 1.80 (nightly)
  • Diesel: master

Problem Description

We get the following new warning for builds of diesel-cli on rust nightly:

warning[E0210]: type parameter `Col` must be covered by another type when it appears before the first local type (`database::multi_connection_impl::backend::MultiBackend`)
   --> diesel_cli/src/database.rs:109:10
    |
109 | #[derive(diesel::MultiConnection)]
    |          ^^^^^^^^^^^^^^^^^^^^^^^ type parameter `Col` must be covered by another type when it appears before the first local type (`database::multi_connection_impl::backend::MultiBackend`)
    |
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
    = note: for more information, see issue #124559 <https://github.com/rust-lang/rust/issues/124559>
    = note: implementing a foreign trait is only possible if at least one of the types for which it is implemented is local, and no uncovered type parameters appear before that first local type
    = note: in this case, 'before' refers to the following order: `impl<..> ForeignTrait<T1, ..., Tn> for T0`, where `T0` is the first and `Tn` is the last
    = note: `#[warn(uncovered_param_in_projection)]` on by default
    = note: this warning originates in the derive macro `diesel::MultiConnection` (in Nightly builds, run with -Z macro-backtrace for more info)

What is the expected output?

Builds without warning

Related: rust-lang/rust#124559

Checklist

  • This issue can be reproduced on Rust's stable channel. (Your issue will be
    closed if this is not the case)
  • This issue can be reproduced without requiring a third party crate
@weiznich weiznich added bug cli Release Blocker This issue needs to be solved before we can release a new version, it can't be punted to the next labels May 22, 2024
weiznich added a commit to weiznich/diesel that referenced this issue May 28, 2024
This commit changes to order of generic arguments for the `InsertValues`
trait. This allows us to generate a sound impl of that trait via
`#[derive(MultiConnection)]` that will be accepted by future rust
compiler versions as well. This works as the backend type is this case
local, while the table type is generic. By having first the backend type
and then the table type we first have the local type, which is allowed
according to the rust coherence rules.

This is no breaking change as `InsertValues` is not part of the public
API: https://docs.diesel.rs/2.1.x/diesel/index.html?search=insertvalues

This fixes diesel-rs#4035
weiznich added a commit to weiznich/diesel that referenced this issue May 28, 2024
This commit changes to order of generic arguments for the `InsertValues`
trait. This allows us to generate a sound impl of that trait via
`#[derive(MultiConnection)]` that will be accepted by future rust
compiler versions as well. This works as the backend type is this case
local, while the table type is generic. By having first the backend type
and then the table type we first have the local type, which is allowed
according to the rust coherence rules.

This is no breaking change as `InsertValues` is not part of the public
API: https://docs.diesel.rs/2.1.x/diesel/index.html?search=insertvalues

This fixes diesel-rs#4035
weiznich added a commit to weiznich/diesel that referenced this issue May 28, 2024
This commit changes to order of generic arguments for the `InsertValues`
trait. This allows us to generate a sound impl of that trait via
`#[derive(MultiConnection)]` that will be accepted by future rust
compiler versions as well. This works as the backend type is this case
local, while the table type is generic. By having first the backend type
and then the table type we first have the local type, which is allowed
according to the rust coherence rules.

This is no breaking change as `InsertValues` is not part of the public
API: https://docs.diesel.rs/2.1.x/diesel/index.html?search=insertvalues

This fixes diesel-rs#4035
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug cli Release Blocker This issue needs to be solved before we can release a new version, it can't be punted to the next
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant