Skip to content

mismatched types on beta/nightly #143991

@phimuemue

Description

@phimuemue

Code

I tried to compile https://github.com/phimuemue/openschafkopf/tree/dacfecc50338443955998a074c0901d989b7a553/lib 1 with these versions of rust (stable/beta/nightly as of 2025-07-15):

cargo --version --verbose
cargo 1.88.0 (873a06493 2025-05-10)
release: 1.88.0
commit-hash: 873a0649350c486caf67be772828a4f36bb4734c
commit-date: 2025-05-10
host: x86_64-unknown-linux-gnu
libgit2: 1.9.0 (sys:0.20.0 vendored)
libcurl: 8.12.1-DEV (sys:0.4.80+curl-8.12.1 vendored ssl:OpenSSL/3.4.1)
ssl: OpenSSL 3.4.1 11 Feb 2025
os: Ubuntu 20.4.0 (focal) [64-bit]

cargo +beta --version --verbose
cargo 1.89.0-beta.5 (c24e10642 2025-06-23)
release: 1.89.0-beta.5
commit-hash: c24e1064277fe51ab72011e2612e556ac56addf7
commit-date: 2025-06-23
host: x86_64-unknown-linux-gnu
libgit2: 1.9.0 (sys:0.20.2 vendored)
libcurl: 8.12.1-DEV (sys:0.4.80+curl-8.12.1 vendored ssl:OpenSSL/3.5.0)
ssl: OpenSSL 3.5.0 8 Apr 2025
os: Ubuntu 20.4.0 (focal) [64-bit]

cargo +nightly --version --verbose
cargo 1.90.0-nightly (eabb4cd92 2025-07-09)
release: 1.90.0-nightly
commit-hash: eabb4cd923deb73e714f7ad3f5234d68ca284dbe
commit-date: 2025-07-09
host: x86_64-unknown-linux-gnu
libgit2: 1.9.1 (sys:0.20.2 vendored)
libcurl: 8.14.1-DEV (sys:0.4.82+curl-8.14.1 vendored ssl:OpenSSL/3.5.0)
ssl: OpenSSL 3.5.0 8 Apr 2025
os: Ubuntu 20.4.0 (focal) [64-bit]

Version it worked on

cargo 1.88.0 (873a06493 2025-05-10)
release: 1.88.0
commit-hash: 873a0649350c486caf67be772828a4f36bb4734c
commit-date: 2025-05-10
host: x86_64-unknown-linux-gnu
libgit2: 1.9.0 (sys:0.20.0 vendored)
libcurl: 8.12.1-DEV (sys:0.4.80+curl-8.12.1 vendored ssl:OpenSSL/3.4.1)
ssl: OpenSSL 3.4.1 11 Feb 2025
os: Ubuntu 20.4.0 (focal) [64-bit]

Versions with regression

cargo 1.89.0-beta.5 (c24e10642 2025-06-23)
release: 1.89.0-beta.5
commit-hash: c24e1064277fe51ab72011e2612e556ac56addf7
commit-date: 2025-06-23
host: x86_64-unknown-linux-gnu
libgit2: 1.9.0 (sys:0.20.2 vendored)
libcurl: 8.12.1-DEV (sys:0.4.80+curl-8.12.1 vendored ssl:OpenSSL/3.5.0)
ssl: OpenSSL 3.5.0 8 Apr 2025
os: Ubuntu 20.4.0 (focal) [64-bit]

and

cargo 1.90.0-nightly (eabb4cd92 2025-07-09)
release: 1.90.0-nightly
commit-hash: eabb4cd923deb73e714f7ad3f5234d68ca284dbe
commit-date: 2025-07-09
host: x86_64-unknown-linux-gnu
libgit2: 1.9.1 (sys:0.20.2 vendored)
libcurl: 8.14.1-DEV (sys:0.4.82+curl-8.14.1 vendored ssl:OpenSSL/3.5.0)
ssl: OpenSSL 3.5.0 8 Apr 2025
os: Ubuntu 20.4.0 (focal) [64-bit]

The error for cargo +beta check/cargo +nightly check reads:

    Checking openschafkopf_lib v0.1.0 (/home/philipp/Documents/projekte/openschafkopf/lib)
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`

error[E0609]: no field `n_width` on type `&mut (std::string::String, f32)`
   --> lib/src/game_analysis/determine_best_card_table.rs:141:28
    |
141 |                 formatinfo.n_width = formatinfo.n_width.max(str_val.len());
    |                            ^^^^^^^ unknown field

error[E0609]: no field `n_width` on type `&mut (std::string::String, f32)`
   --> lib/src/game_analysis/determine_best_card_table.rs:141:49
    |
141 |                 formatinfo.n_width = formatinfo.n_width.max(str_val.len());
    |                                                 ^^^^^^^ unknown field

error[E0609]: no field `f_min` on type `&mut (std::string::String, f32)`
   --> lib/src/game_analysis/determine_best_card_table.rs:142:55
    |
142 |                 assign_lt_partial_ord(&mut formatinfo.f_min, *f_val);
    |                                                       ^^^^^ unknown field

error[E0609]: no field `f_max` on type `&mut (std::string::String, f32)`
   --> lib/src/game_analysis/determine_best_card_table.rs:143:55
    |
143 |                 assign_gt_partial_ord(&mut formatinfo.f_max, *f_val);
    |                                                       ^^^^^ unknown field

error[E0308]: mismatched types
   --> lib/src/game_analysis/determine_best_card_table.rs:155:9
    |
155 |         perminmaxstrategyaformatinfo,
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `SFormatInfo`, found `(std::string::String, f32)`
    |
    = note: expected associated type `<MinMaxStrategiesHK as gametree::TMinMaxStrategiesHigherKinded>::Type<[SFormatInfo; 4]>`
               found associated type `<MinMaxStrategiesHK as gametree::TMinMaxStrategiesHigherKinded>::Type<[(std::string::String, f32); 4]>`
    = note: an associated type was expected, but a different one was found

error[E0277]: the trait bound `std::string::String: std::marker::Copy` is not satisfied in `(std::string::String, f32)`
  --> 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 | |         };
   | |_________^ within `(std::string::String, f32)`, the trait `std::marker::Copy` is not implemented for `std::string::String`
   |
   = note: required because it appears within the type `(std::string::String, f32)`
   = note: the `Copy` trait is required because this value will be copied for each element of the array
   = help: consider using `core::array::from_fn` to initialize the array
   = help: see https://doc.rust-lang.org/stable/std/array/fn.from_fn.html for more information

Some errors have detailed explanations: E0277, E0308, E0609.
For more information about an error, try `rustc --explain E0277`.
error: could not compile `openschafkopf_lib` (lib) due to 7 previous errors

Footnotes

  1. Unfortunately, I do not have enough spare time to distill the problem into a simpler form - sorry for that.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.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