Skip to content

Add test for default_field_values and const_default #143649

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

estebank
Copy link
Contributor

@estebank estebank commented Jul 8, 2025

Add a test showing #![feature(default_field_values)] using #[const_trait] trait Default (#![feature(const_default)] + #![feature(const_trait_impl)]).

CC #132162

@rustbot
Copy link
Collaborator

rustbot commented Jul 8, 2025

r? @oli-obk

rustbot has assigned @oli-obk.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jul 8, 2025
@rust-log-analyzer

This comment has been minimized.

@estebank estebank force-pushed the const-trait-default-field-value branch from 1e61f8a to 6b7845f Compare July 8, 2025 19:12
Add a test showing `#![feature(default_field_values)]` using `#[const_trait] trait Default` (`#![feature(const_default)]` + `#![feature(const_trait_impl)]`).
@estebank estebank force-pushed the const-trait-default-field-value branch from 6b7845f to 01c88e8 Compare July 8, 2025 19:12
// Ensure that `default_field_values` and `const_default` interact properly.

#![feature(default_field_values)]
#![feature(const_trait_impl)]
Copy link
Member

@fmease fmease Jul 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think it would be worthwhile to also test default field values (set to a Default::default() like here) where the struct init is at comptime (e.g., using const { ... } a const item (for pre-mono)) (it could utilize #[derive_const]) or is this already covered somewhere else?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants