Skip to content

where bounds regression in beta+nightly #143992

Open
@mejrs

Description

@mejrs

Code

pub trait Trait {
    type Assoc<G>: OtherTrait<G>;
}

pub trait OtherTrait<R> {
    fn new(r: R) -> R {
        r
    }
}

pub fn function<T: Trait>()
where
    T::Assoc<[u32; 1]>: Clone, // comment out to let it compile
{
    let _x = T::Assoc::new(());
}

Version it worked on

It most recently worked on: Stable (1.88)

Version with regression

Beta (1.89), nightly (1.90) produces

   Compiling playground v0.0.1 (/playground)
error[E0308]: mismatched types
  --> src/lib.rs:15:28
   |
15 |     let _x = T::Assoc::new(());
   |              ------------- ^^ expected `[u32; 1]`, found `()`
   |              |
   |              arguments to this function are incorrect
   |
note: associated function defined here
  --> src/lib.rs:6:8
   |
6  |     fn new(r: R) -> R {
   |        ^^^ ----

For more information about this error, try `rustc --explain E0308`.

Originally found in https://github.com/phimuemue/openschafkopf/blob/dacfecc50338443955998a074c0901d989b7a553/lib/src/game_analysis/determine_best_card_table.rs#L51

error[E0308]: mismatched types
  --> lib/src/game_analysis/determine_best_card_table.rs:70:9
   |
70 | /         SFormatInfo {
71 | |             f_min: f32::MAX,
72 | |             f_max: f32::MIN,
73 | |             n_width: 0,
74 | |         };
   | |_________^ expected `(String, f32)`, found `SFormatInfo`
   |
   = note: expected tuple `(std::string::String, f32)`
             found struct `SFormatInfo`

@rustbot modify labels: +regression-from-stable-to-beta +regression-from-stable-to-nightly -regression-untriaged

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-trait-systemArea: Trait systemC-bugCategory: This is a bug.I-types-nominatedNominated for discussion during a types team meeting.P-highHigh priorityS-has-bisectionStatus: A bisection has been found for this issueS-has-mcveStatus: A Minimal Complete and Verifiable Example has been found for this issueT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.T-typesRelevant to the types team, which will review and decide on the PR/issue.regression-from-stable-to-betaPerformance or correctness regression from stable to beta.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions