rust icon indicating copy to clipboard operation
rust copied to clipboard

Inconistent build failures between `cargo install` and `cargo build --release`

Open weiznich opened this issue 3 years ago • 0 comments

I tried this code to install diesel_cli via cargo install diesel_cli --version 2.0.0-rc.0 and the build failed with the following error message:

error[E0277]: the trait bound `SelectStatement<FromClause<infer_schema_internals::information_schema::information_schema::columns::table>>: SelectDsl<(infer_schema_internals::information_schema::information_schema::columns::columns::column_name, <<Conn as diesel::Connection>::Backend as UsesInformationSchema>::TypeColumn, <<Conn as diesel::Connection>::Backend as UsesInformationSchema>::TypeSchema, infer_schema_internals::information_schema::information_schema::columns::columns::__is_nullable)>` is not satisfied
   --> /home/weiznich/.cargo/registry/src/github.com-1ecc6299db9ec823/diesel_cli-2.0.0-rc.0/src/infer_schema_internals/information_schema.rs:146:1
    |
146 | / pub fn get_table_data<'a, Conn>(
147 | |     conn: &mut Conn,
148 | |     table: &'a TableName,
149 | |     column_sorting: &ColumnSorting,
...   |
209 | |             sql_types::Text,
210 | |         )> + 'static,
    | |_____________________^ the trait `SelectDsl<(infer_schema_internals::information_schema::information_schema::columns::columns::column_name, <<Conn as diesel::Connection>::Backend as UsesInformationSchema>::TypeColumn, <<Conn as diesel::Connection>::Backend as UsesInformationSchema>::TypeSchema, infer_schema_internals::information_schema::information_schema::columns::columns::__is_nullable)>` is not implemented for `SelectStatement<FromClause<infer_schema_internals::information_schema::information_schema::columns::table>>`
    |
    = note: required because of the requirements on the impl of `SelectDsl<(infer_schema_internals::information_schema::information_schema::columns::columns::column_name, <<Conn as diesel::Connection>::Backend as UsesInformationSchema>::TypeColumn, <<Conn as diesel::Connection>::Backend as UsesInformationSchema>::TypeSchema, infer_schema_internals::information_schema::information_schema::columns::columns::__is_nullable)>` for `infer_schema_internals::information_schema::information_schema::columns::table`
help: consider extending the `where` bound, but there might be an alternative better way to express this requirement
    |
210 |         )> + 'static, SelectStatement<FromClause<infer_schema_internals::information_schema::information_schema::columns::table>>: SelectDsl<(infer_schema_internals::information_schema::information_schema::columns::columns::column_name, <<Conn as diesel::Connection>::Backend as UsesInformationSchema>::TypeColumn, <<Conn as diesel::Connection>::Backend as UsesInformationSchema>::TypeSchema, infer_schema_internals::information_schema::information_schema::columns::columns::__is_nullable)>
    |                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

error[E0277]: the trait bound `SelectStatement<FromClause<infer_schema_internals::information_schema::information_schema::columns::table>>: SelectDsl<(infer_schema_internals::information_schema::information_schema::columns::columns::column_name, <<Conn as diesel::Connection>::Backend as UsesInformationSchema>::TypeColumn, <<Conn as diesel::Connection>::Backend as UsesInformationSchema>::TypeSchema, infer_schema_internals::information_schema::information_schema::columns::columns::__is_nullable)>` is not satisfied
   --> /home/weiznich/.cargo/registry/src/github.com-1ecc6299db9ec823/diesel_cli-2.0.0-rc.0/src/infer_schema_internals/information_schema.rs:146:8
    |
146 | pub fn get_table_data<'a, Conn>(
    |        ^^^^^^^^^^^^^^ the trait `SelectDsl<(infer_schema_internals::information_schema::information_schema::columns::columns::column_name, <<Conn as diesel::Connection>::Backend as UsesInformationSchema>::TypeColumn, <<Conn as diesel::Connection>::Backend as UsesInformationSchema>::TypeSchema, infer_schema_internals::information_schema::information_schema::columns::columns::__is_nullable)>` is not implemented for `SelectStatement<FromClause<infer_schema_internals::information_schema::information_schema::columns::table>>`
    |
    = note: required because of the requirements on the impl of `SelectDsl<(infer_schema_internals::information_schema::information_schema::columns::columns::column_name, <<Conn as diesel::Connection>::Backend as UsesInformationSchema>::TypeColumn, <<Conn as diesel::Connection>::Backend as UsesInformationSchema>::TypeSchema, infer_schema_internals::information_schema::information_schema::columns::columns::__is_nullable)>` for `infer_schema_internals::information_schema::information_schema::columns::table`
help: consider extending the `where` bound, but there might be an alternative better way to express this requirement
    |
210 |         )> + 'static, SelectStatement<FromClause<infer_schema_internals::information_schema::information_schema::columns::table>>: SelectDsl<(infer_schema_internals::information_schema::information_schema::columns::columns::column_name, <<Conn as diesel::Connection>::Backend as UsesInformationSchema>::TypeColumn, <<Conn as diesel::Connection>::Backend as UsesInformationSchema>::TypeSchema, infer_schema_internals::information_schema::information_schema::columns::columns::__is_nullable)>
    |                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

For more information about this error, try `rustc --explain E0277`.
error: could not compile `diesel_cli` due to 2 previous errors
error: failed to compile `diesel_cli v2.0.0-rc.0`, intermediate artifacts can be found at `/tmp/cargo-installCWg9Mk`

To debug this issue in diesel I've tried to checkout the source code locally via

git clone https://github.com/diesel-rs/diesel
cd diesel/diesel_cli
git checkout v2.0.0-rc0
cargo +1.62.1 build --release

which just builds the binary without error message. To verify that this is not dependent on the diesel workspace I've also copied the diesel_cli 2.0.0-rc.0 source code from the cargo registry to build that directly:

cp ~/.cargo/registry/src/github.com-1ecc6299db9ec823/diesel_cli-2.0.0-rc.0 . -r
cd diesel_cli-2.0.0-rc.0 
cargo +1.62.1 build --release

but again the build completed without error message. (cargo check has the same behaviour and is faster in both cases)

I fill this issue here instead of in the cargo repository as I'm not sure if that's a rustc or cargo issue. Feel free to transfer the issue if the there is a better place for this.

I expected to see this happen: Either the code compiles with both cargo build --release and cargo install or it generates error messages on both commands, as otherwise I as crate maintainer cannot really check for such issues before doing an release.

Relevant diesel issue: https://github.com/diesel-rs/diesel/issues/3263

Meta

rustc --version --verbose:

rustc 1.62.1 (e092d0b6b 2022-07-16)
binary: rustc
commit-hash: e092d0b6b43f2de967af0887873151bb1c0b18d3
commit-date: 2022-07-16
host: x86_64-unknown-linux-gnu
release: 1.62.1
LLVM version: 14.0.5

weiznich avatar Aug 05 '22 08:08 weiznich