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

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

Closed
nox opened this issue May 17, 2018 · 17 comments
Closed

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

nox opened this issue May 17, 2018 · 17 comments
Assignees
Labels
C-bug Category: This is a bug. P-medium Medium priority regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Milestone

Comments

@nox
Copy link
Contributor

nox commented May 17, 2018

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

@nox nox added regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels May 17, 2018
@kennytm
Copy link
Member

kennytm commented May 17, 2018

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");
    |                                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...

@Eijebong
Copy link
Contributor

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`

@kennytm
Copy link
Member

kennytm commented May 17, 2018

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

@kennytm kennytm added the C-bug Category: This is a bug. label May 17, 2018
@nagisa
Copy link
Member

nagisa commented May 17, 2018 via email

@nikomatsakis
Copy link
Contributor

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

@matthewjasper
Copy link
Contributor

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
}

@matthewjasper
Copy link
Contributor

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.

bors added a commit that referenced this issue May 22, 2018
…atsakis

Filter global bounds from ParamEnv again.

This PR adds back the filtering of global bounds from ParamEnv as a temporary solution for #50825.

<details>

Long term, the fix seems like it should be changing the priority in `candidate_should_be_dropped_in_favor_of` so that (global) where clauses aren't considered as highly.

https://github.com/rust-lang/rust/blob/a722296b6ec17fecd3f16a7d3f9232b83e5de800/src/librustc/traits/select.rs#L2017-L2022

</details>

r? @nikomatsakis
@nikomatsakis nikomatsakis added P-medium Medium priority and removed P-high High priority labels May 24, 2018
@nikomatsakis
Copy link
Contributor

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

@Diggsey
Copy link
Contributor

Diggsey commented May 31, 2018

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

@SimonSapin
Copy link
Contributor

brotli v1.1.2 does compile in recent nightlies (presumably since #50876), so it looks like the diesel failure is different. Has it been bisected to one Rust PR?

@RalfJung
Copy link
Member

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?

@pnkfelix
Copy link
Member

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

@pnkfelix pnkfelix assigned pnkfelix and unassigned nikomatsakis May 31, 2018
@matthewjasper
Copy link
Contributor

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

@RalfJung
Copy link
Member

RalfJung commented Jun 1, 2018

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

@nikomatsakis
Copy link
Contributor

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.

@matthewjasper
Copy link
Contributor

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

bors added a commit that referenced this issue Jun 9, 2018
…atsakis

Re-enable trivial bounds

cc #50825

Remove implementations from global bounds in winnowing when there is ambiguity.

This results in the reverse of #24066 happening sometimes. I'm not sure if anything can be done about that though.

cc #48214

r? @nikomatsakis
@matthewjasper
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. P-medium Medium priority regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests