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

Merged
merged 1 commit into from
Jul 18, 2025

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 2 times, most recently 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?

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 01c88e8 to c375244 Compare July 17, 2025 19:26
@oli-obk
Copy link
Contributor

oli-obk commented Jul 17, 2025

@bors r+ rollup

@bors
Copy link
Collaborator

bors commented Jul 17, 2025

📌 Commit c375244 has been approved by oli-obk

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jul 17, 2025
Kobzol added a commit to Kobzol/rust that referenced this pull request Jul 17, 2025
…-value, r=oli-obk

Add test for `default_field_values` and `const_default`

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

CC rust-lang#132162
bors added a commit that referenced this pull request Jul 18, 2025
Rollup of 10 pull requests

Successful merges:

 - #142300 (Disable `tests/run-make/mte-ffi` because no CI runners have MTE extensions enabled)
 - #143649 (Add test for `default_field_values` and `const_default`)
 - #144010 (Boostrap: add warning on `optimize = false`)
 - #144029 (Fix wrong messages from methods with the same name from different traits)
 - #144049 (rustc-dev-guide subtree update)
 - #144053 (Remove install Rust script from CI)
 - #144056 (Copy GCC sources into the build directory even outside CI)
 - #144063 (Add myself to the `infra-ci` reviewer group and adjust some infra auto-labels)
 - #144069 (ci: use windows 22 for all free runners)
 - #144083 (miri sleep tests: increase slack)

r? `@ghost`
`@rustbot` modify labels: rollup
jhpratt added a commit to jhpratt/rust that referenced this pull request Jul 18, 2025
…-value, r=oli-obk

Add test for `default_field_values` and `const_default`

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

CC rust-lang#132162
bors added a commit that referenced this pull request Jul 18, 2025
Rollup of 12 pull requests

Successful merges:

 - #142300 (Disable `tests/run-make/mte-ffi` because no CI runners have MTE extensions enabled)
 - #143271 (Store the type of each GVN value)
 - #143280 (Remove duplicate error about raw underscore lifetime)
 - #143649 (Add test for `default_field_values` and `const_default`)
 - #143699 (Make `AsyncDrop` check that it's being implemented on a local ADT)
 - #143719 (Emit warning when there is no space between `-o` and arg)
 - #143833 (Ban projecting into SIMD types [MCP838])
 - #143891 (Port `#[coverage]` to the new attribute system)
 - #143908 (`tests/ui`: A New Order [0/28] )
 - #143909 (docs(alloc::fmt): Make type optional, instead of matching empty string)
 - #143925 (Make slice comparisons const)
 - #143997 (Use $crate in macros for rustc_public (aka stable_mir))

r? `@ghost`
`@rustbot` modify labels: rollup
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Jul 18, 2025
…-value, r=oli-obk

Add test for `default_field_values` and `const_default`

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

CC rust-lang#132162
bors added a commit that referenced this pull request Jul 18, 2025
Rollup of 12 pull requests

Successful merges:

 - #143280 (Remove duplicate error about raw underscore lifetime)
 - #143649 (Add test for `default_field_values` and `const_default`)
 - #143699 (Make `AsyncDrop` check that it's being implemented on a local ADT)
 - #143704 (Be a bit more careful around exotic cycles in in the inliner)
 - #143908 (`tests/ui`: A New Order [0/28] )
 - #143909 (docs(alloc::fmt): Make type optional, instead of matching empty string)
 - #143925 (Make slice comparisons const)
 - #143997 (Use $crate in macros for rustc_public (aka stable_mir))
 - #144013 (resolve: Make disambiguators for underscore bindings module-local)
 - #144029 (Fix wrong messages from methods with the same name from different traits)
 - #144063 (Add myself to the `infra-ci` reviewer group and adjust some infra auto-labels)
 - #144069 (ci: use windows 22 for all free runners)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit that referenced this pull request Jul 18, 2025
Rollup of 11 pull requests

Successful merges:

 - #143280 (Remove duplicate error about raw underscore lifetime)
 - #143649 (Add test for `default_field_values` and `const_default`)
 - #143699 (Make `AsyncDrop` check that it's being implemented on a local ADT)
 - #143908 (`tests/ui`: A New Order [0/28] )
 - #143909 (docs(alloc::fmt): Make type optional, instead of matching empty string)
 - #143925 (Make slice comparisons const)
 - #143997 (Use $crate in macros for rustc_public (aka stable_mir))
 - #144013 (resolve: Make disambiguators for underscore bindings module-local)
 - #144029 (Fix wrong messages from methods with the same name from different traits)
 - #144063 (Add myself to the `infra-ci` reviewer group and adjust some infra auto-labels)
 - #144069 (ci: use windows 22 for all free runners)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 7b6e2f9 into rust-lang:master Jul 18, 2025
11 checks passed
@rustbot rustbot added this to the 1.90.0 milestone Jul 18, 2025
rust-timer added a commit that referenced this pull request Jul 18, 2025
Rollup merge of #143649 - estebank:const-trait-default-field-value, r=oli-obk

Add test for `default_field_values` and `const_default`

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

CC #132162
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. 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.

6 participants