We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I tried this code:
#![feature(type_changing_struct_update)] #[derive(Default)] struct NonGeneric { field1: usize, } #[derive(Default)] struct Generic<T, U> { field1: T, field2: U, } fn main() { let default = NonGeneric { ..Default::default() }; let default: Generic<i32, f32> = Generic { ..Default::default() }; }
I expected to see this happen: Compilation succeeds, the two variables are assigned their default values.
Instead, this happened:
error[E0308]: mismatched types --> src/main.rs:16:11 | 16 | ..Default::default() | ^^^^^^^^^^^^^^^^^^ expected struct `NonGeneric`, found inferred type | = note: expected struct `NonGeneric` found type `_` error[E0308]: mismatched types --> src/main.rs:19:11 | 19 | ..Default::default() | ^^^^^^^^^^^^^^^^^^ expected struct `Generic`, found inferred type | = note: expected struct `Generic<i32, f32>` found type `_`
rustc --version --verbose:
rustc --version --verbose
rustc 1.62.0-nightly (cb1219871 2022-05-08) binary: rustc commit-hash: cb121987158d69bb894ba1bcc21dc45d1e0a488f commit-date: 2022-05-08 host: x86_64-unknown-linux-gnu release: 1.62.0-nightly LLVM version: 14.0.1
This was originally reported in #86618 (comment). cc #86555
The text was updated successfully, but these errors were encountered:
type_changing_struct_update
e652caa
compiler-errors
Successfully merging a pull request may close this issue.
I tried this code:
I expected to see this happen: Compilation succeeds, the two variables are assigned their default values.
Instead, this happened:
Meta
rustc --version --verbose
:This was originally reported in #86618 (comment).
cc #86555
The text was updated successfully, but these errors were encountered: