idanarye / rust-typed-builder

Compile-time type-checked builder derive
https://crates.io/crates/typed-builder
Apache License 2.0
904 stars 52 forks source link

Add a compile_fail test for mandatory fields #147

Closed sunsided closed 2 months ago

sunsided commented 2 months ago

This adds an additional compile_fail test to ensure the following does not work:

use typed_builder::TypedBuilder;

#[derive(TypedBuilder)]
struct Foo {
    x: i8,
}

let _ = Foo::builder().build();

The functionality already worked as expected, it simply didn't seem to be covered by a test.