Rust: Can't compile brotli with rustc 1.27.0-nightly (2f2a11dfc 2018-05-16)

Created on 17 May 2018  Â·  17Comments  Â·  Source: rust-lang/rust

error[E0277]: the trait bound `u64: core::slice::SliceIndex<[HistogramType]>` is not satisfied
   --> /Users/nox/.cargo/registry/src/github.com-1ecc6299db9ec823/brotli-1.1.2/src/enc/block_splitter.rs:271:26
    |
271 |   let data_size: usize = histograms[0].slice().len();
    |                          ^^^^^^^^^^^^^ slice indices are of type `usize` or ranges of `usize`
    |
    = help: the trait `core::slice::SliceIndex<[HistogramType]>` is not implemented for `u64`
    = note: required because of the requirements on the impl of `core::ops::Index<u64>` for `[HistogramType]`

error[E0277]: the trait bound `u64: core::slice::SliceIndex<[f32]>` is not satisfied
   --> /Users/nox/.cargo/registry/src/github.com-1ecc6299db9ec823/brotli-1.1.2/src/enc/block_splitter.rs:341:13
    |
341 |             (*cost_iter).0[sub_index] += local_insert_cost[sub_index];
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^ slice indices are of type `usize` or ranges of `usize`
    |
    = help: the trait `core::slice::SliceIndex<[f32]>` is not implemented for `u64`
    = note: required because of the requirements on the impl of `core::ops::Index<u64>` for `[f32]`

error[E0277]: the trait bound `u64: core::slice::SliceIndex<[f32]>` is not satisfied
   --> /Users/nox/.cargo/registry/src/github.com-1ecc6299db9ec823/brotli-1.1.2/src/enc/block_splitter.rs:341:42
    |
341 |             (*cost_iter).0[sub_index] += local_insert_cost[sub_index];
    |                                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ slice indices are of type `usize` or ranges of `usize`
    |
    = help: the trait `core::slice::SliceIndex<[f32]>` is not implemented for `u64`
    = note: required because of the requirements on the impl of `core::ops::Index<u64>` for `[f32]`

error[E0277]: the trait bound `u64: core::slice::SliceIndex<[f32]>` is not satisfied
   --> /Users/nox/.cargo/registry/src/github.com-1ecc6299db9ec823/brotli-1.1.2/src/enc/block_splitter.rs:342:30
    |
342 |             let final_cost = (*cost_iter).0[sub_index];
    |                              ^^^^^^^^^^^^^^^^^^^^^^^^^ slice indices are of type `usize` or ranges of `usize`
    |
    = help: the trait `core::slice::SliceIndex<[f32]>` is not implemented for `u64`
    = note: required because of the requirements on the impl of `core::ops::Index<u64>` for `[f32]`

error[E0308]: mismatched types
   --> /Users/nox/.cargo/registry/src/github.com-1ecc6299db9ec823/brotli-1.1.2/src/enc/block_splitter.rs:345:45
    |
345 |               *block_id_ptr = (base_index + sub_index) as u8;
    |                                             ^^^^^^^^^ expected usize, found u64

error[E0277]: cannot add `u64` to `usize`
   --> /Users/nox/.cargo/registry/src/github.com-1ecc6299db9ec823/brotli-1.1.2/src/enc/block_splitter.rs:345:43
    |
345 |               *block_id_ptr = (base_index + sub_index) as u8;
    |                                           ^ no implementation for `usize + u64`
    |
    = help: the trait `core::ops::Add<u64>` is not implemented for `usize`

Cc @rust-lang/compiler

C-bug P-medium T-compiler regression-from-stable-to-nightly

Most helpful comment

Minified diesel issue:

trait X {
    type T;
}

trait Y<U>: X {
    fn foo(x: &Self::T);
}

impl X for () {
    type T = ();
}

impl<T> Y<Vec<T>> for () where (): Y<T> {
    fn foo(_x: &()) {}
}

I'll try to get a patch to either fix this or roll back some of the changes in #48557 (more likely) ready tomorrow.

All 17 comments

This seems to be related to #47832.

Note that the report mentioned brotli 1.1.2, but latest versions are brotli 2.1.0, 1.2.0 and 1.1.4.

No repro on brotli 2.1.0 with rustc 1.27.0-nightly (f0fdaba04 2018-05-15), let me rustup update and try again.

Edit: Repro on brotli 2.1.0 with rustc 1.27.0-nightly (2f2a11dfc 2018-05-16), bisecting...


Note: brotli isn't fully cratered because its Cargo.toml has this line:

[package]
name = "brotli"
# ...
exclude = ["src/bin/testdata/*"]
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

but then the tests cannot be compiled because it relies on those testdata 😒

   Compiling brotli v2.1.0 (file:///$DIR/brotli)
error: couldn't read src/bin/testdata/random_then_unicode: No such file or directory (os error 2)
   --> src/bin/integration_tests.rs:335:46
    |
335 | static RANDOM_THEN_UNICODE : &'static [u8] = include_bytes!("testdata/random_then_unicode");
    |                                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...

Diesel is affected too

error[E0053]: method `metadata` has an incompatible type for trait
   --> diesel/src/pg/types/array.rs:14:25
    |
14  |     fn metadata(lookup: &PgMetadataLookup) -> PgTypeMetadata {
    |                         ^^^^^^^^^^^^^^^^^ expected associated type, found struct `pg::metadata_lookup::PgMetadataLookup`
    | 
   ::: diesel/src/sql_types/mod.rs:402:25
    |
402 |     fn metadata(lookup: &Self::MetadataLookup) -> Self::TypeMetadata;
    |                         --------------------- type in trait
    |
    = note: expected type `fn(&<pg::backend::Pg as sql_types::TypeMetadata>::MetadataLookup) -> <pg::backend::Pg as sql_types::TypeMetadata>::TypeMetadata`
               found type `fn(&pg::metadata_lookup::PgMetadataLookup) -> pg::backend::PgTypeMetadata`

Bisection gives #48557 as the regression PR cc @matthewjasper @nikomatsakis

Diesel issue seems unrelated.

On Thu, May 17, 2018, 12:02 Bastien Orivel notifications@github.com wrote:

Diesel is affected too

error[E0053]: method metadata has an incompatible type for trait
--> diesel/src/pg/types/array.rs:14:25
|
14 | fn metadata(lookup: &PgMetadataLookup) -> PgTypeMetadata {
| ^^^^^^^^^^^^^^^^^ expected associated type, found struct pg::metadata_lookup::PgMetadataLookup
|
::: diesel/src/sql_types/mod.rs:402:25
|
402 | fn metadata(lookup: &Self::MetadataLookup) -> Self::TypeMetadata;
| --------------------- type in trait
|
= note: expected type fn(&<pg::backend::Pg as sql_types::TypeMetadata>::MetadataLookup) -> <pg::backend::Pg as sql_types::TypeMetadata>::TypeMetadata
found type fn(&pg::metadata_lookup::PgMetadataLookup) -> pg::backend::PgTypeMetadata

—
You are receiving this because you are on a team that was mentioned.
Reply to this email directly, view it on GitHub
https://github.com/rust-lang/rust/issues/50825#issuecomment-389796962,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AApc0nd9guDe4-d0KtEu2_xxXzZNa1PKks5tzTyhgaJpZM4UClUv
.

Can we verify if the Diesel regression is related or not? cc @sgrif

I'm looking at this.

Minified brotli issue:

fn foo(y: &[()]) where u64: Copy // or From<u64>
{
    let x = y[0]; // u64: std::slice::SliceIndex<[()]>` is not satisfied
}

Minified diesel issue:

trait X {
    type T;
}

trait Y<U>: X {
    fn foo(x: &Self::T);
}

impl X for () {
    type T = ();
}

impl<T> Y<Vec<T>> for () where (): Y<T> {
    fn foo(_x: &()) {}
}

I'll try to get a patch to either fix this or roll back some of the changes in #48557 (more likely) ready tomorrow.

Reclassifying bug as P-medium since we reverted the PR and hence breakage should be fixed (right @matthewjasper @nox ?)

I'm still unable to build diesel as of nightly-2018-05-30 - shouldn't the breaking change be reverted now?

brotli v1.1.2 does compile in recent nightlies (presumably since https://github.com/rust-lang/rust/pull/50876), so it looks like the diesel failure is different. Has it been bisected to one Rust PR?

Diesel v1.2.2 compiles fine for me on rustc 1.28.0-nightly (990d8aa74 2018-05-25), so seems a new issues has crept in?

assigning to self to determine what status is for each of brotli and diesel, and to potentially file distinct issue for diesel if necessary.

There is still #51044 which is fixed in #51042.

Diesel v1.2.2 still works fine with latest nightly but v1.3.0 is indeed broken.

Can somebody (@RalfJung?) file an issue describing the problem with diesel v1.3.0? (cc @sgrif)

Evidently the minimization from @matthewjasper [here] is not correct, because that [seems to work].

The issue with 1.3.0 looks like #51044

error[E0277]: the trait bound `<expression::count::CountStar as expression::Expression>::SqlType: sql_types::ops::Add` is not satisfied
  --> /home/matthew/.cargo/registry/src/github.com-1ecc6299db9ec823/diesel-1.3.0/src/expression/count.rs:58:39
   |
58 | #[derive(Debug, Clone, Copy, QueryId, DieselNumericOps)]
   |                                       ^^^^^^^^^^^^^^^^ the trait `sql_types::ops::Add` is not implemented for `<expression::count::CountStar as expression::Expression>::SqlType`
   |
   = help: consider adding a `where <expression::count::CountStar as expression::Expression>::SqlType: sql_types::ops::Add` bound
   = help: see issue #48214
   = help: add #![feature(trivial_bounds)] to the crate attributes to enable

error[E0277]: the trait bound `<expression::count::CountStar as expression::Expression>::SqlType: sql_types::ops::Sub` is not satisfied
  --> /home/matthew/.cargo/registry/src/github.com-1ecc6299db9ec823/diesel-1.3.0/src/expression/count.rs:58:39
   |
58 | #[derive(Debug, Clone, Copy, QueryId, DieselNumericOps)]
   |                                       ^^^^^^^^^^^^^^^^ the trait `sql_types::ops::Sub` is not implemented for `<expression::count::CountStar as expression::Expression>::SqlType`
   |
   = help: consider adding a `where <expression::count::CountStar as expression::Expression>::SqlType: sql_types::ops::Sub` bound
   = help: see issue #48214
   = help: add #![feature(trivial_bounds)] to the crate attributes to enable

error[E0277]: the trait bound `<expression::count::CountStar as expression::Expression>::SqlType: sql_types::ops::Mul` is not satisfied
  --> /home/matthew/.cargo/registry/src/github.com-1ecc6299db9ec823/diesel-1.3.0/src/expression/count.rs:58:39
   |
58 | #[derive(Debug, Clone, Copy, QueryId, DieselNumericOps)]
   |                                       ^^^^^^^^^^^^^^^^ the trait `sql_types::ops::Mul` is not implemented for `<expression::count::CountStar as expression::Expression>::SqlType`
   |
   = help: consider adding a `where <expression::count::CountStar as expression::Expression>::SqlType: sql_types::ops::Mul` bound
   = help: see issue #48214
   = help: add #![feature(trivial_bounds)] to the crate attributes to enable

error[E0277]: the trait bound `<expression::count::CountStar as expression::Expression>::SqlType: sql_types::ops::Div` is not satisfied
  --> /home/matthew/.cargo/registry/src/github.com-1ecc6299db9ec823/diesel-1.3.0/src/expression/count.rs:58:39
   |
58 | #[derive(Debug, Clone, Copy, QueryId, DieselNumericOps)]
   |                                       ^^^^^^^^^^^^^^^^ the trait `sql_types::ops::Div` is not implemented for `<expression::count::CountStar as expression::Expression>::SqlType`
   |
   = help: consider adding a `where <expression::count::CountStar as expression::Expression>::SqlType: sql_types::ops::Div` bound
   = help: see issue #48214
   = help: add #![feature(trivial_bounds)] to the crate attributes to enable

error: aborting due to 4 previous errors

Brotli (1.2.0 and 1.1.2) and diesel (1.3.0 and 1.2.2) both compile on the latest nightly (as of #51042). Closing.

Was this page helpful?
0 / 5 - 0 ratings