Skip to content
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

Exercise const trait interaction with default fields #134136

Merged
merged 2 commits into from
Dec 11, 2024

Conversation

estebank
Copy link
Contributor

Add a test case for using the result of a fn call of an associated function of a const trait in a struct default field.

struct X;
trait Trait {
    fn value() -> Self;
}
impl const Trait for X {
    fn value() -> Self { X }
}
struct S<T: const Trait> {
    a: T = T::value(),
}

Add a test case for using the result of a fn call of an associated
function of a `const` trait in a struct default field.

```rust
struct X;
trait Trait {
    fn value() -> Self;
}
impl const Trait for X {
    fn value() -> Self { X }
}
struct S<T: const Trait> {
    a: T = T::value(),
}
```
@rustbot
Copy link
Collaborator

rustbot commented Dec 10, 2024

r? @petrochenkov

rustbot has assigned @petrochenkov.
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 Dec 10, 2024
Copy link
Member

@jieyouxu jieyouxu left a comment

Choose a reason for hiding this comment

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

Thanks, one comment nit, feel free to r=me after PR CI is green with or without the nit.

@jieyouxu jieyouxu assigned jieyouxu and unassigned petrochenkov Dec 10, 2024
@jieyouxu jieyouxu added the A-testsuite Area: The testsuite used to check the correctness of rustc label Dec 10, 2024
@estebank
Copy link
Contributor Author

@bors r=jieyouxu

@bors
Copy link
Contributor

bors commented Dec 10, 2024

📌 Commit 979eb4e has been approved by jieyouxu

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 Dec 10, 2024
@estebank estebank changed the title Excercise const trait interaction with default fields Exercise const trait interaction with default fields Dec 10, 2024
@estebank estebank added the F-default_field_values `#![feature(default_field_values)]` label Dec 10, 2024
bors added a commit to rust-lang-ci/rust that referenced this pull request Dec 11, 2024
Rollup of 8 pull requests

Successful merges:

 - rust-lang#134079 (Add a note saying that `{u8,i8}::from_{be,le,ne}_bytes` is meaningless)
 - rust-lang#134105 (Validate self in host predicates correctly)
 - rust-lang#134136 (Exercise const trait interaction with default fields)
 - rust-lang#134139 ([AIX] keep profile-rt symbol alive)
 - rust-lang#134141 (Remove more traces of anonymous ADTs)
 - rust-lang#134142 (Rudimentary heuristic to insert parentheses when needed for RPIT overcaptures lint)
 - rust-lang#134158 (Rename `projection_def_id` to `item_def_id`)
 - rust-lang#134160 (Add vacation entry for myself in triagebot.toml)

r? `@ghost`
`@rustbot` modify labels: rollup
@compiler-errors
Copy link
Member

@bors rollup

bors added a commit to rust-lang-ci/rust that referenced this pull request Dec 11, 2024
Rollup of 8 pull requests

Successful merges:

 - rust-lang#134079 (Add a note saying that `{u8,i8}::from_{be,le,ne}_bytes` is meaningless)
 - rust-lang#134105 (Validate self in host predicates correctly)
 - rust-lang#134136 (Exercise const trait interaction with default fields)
 - rust-lang#134139 ([AIX] keep profile-rt symbol alive)
 - rust-lang#134141 (Remove more traces of anonymous ADTs)
 - rust-lang#134142 (Rudimentary heuristic to insert parentheses when needed for RPIT overcaptures lint)
 - rust-lang#134158 (Rename `projection_def_id` to `item_def_id`)
 - rust-lang#134160 (Add vacation entry for myself in triagebot.toml)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit fe7fc76 into rust-lang:master Dec 11, 2024
6 checks passed
@rustbot rustbot added this to the 1.85.0 milestone Dec 11, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Dec 11, 2024
Rollup merge of rust-lang#134136 - estebank:const-trait-default-field-test, r=jieyouxu

Exercise const trait interaction with default fields

Add a test case for using the result of a fn call of an associated function of a `const` trait in a struct default field.

```rust
struct X;
trait Trait {
    fn value() -> Self;
}
impl const Trait for X {
    fn value() -> Self { X }
}
struct S<T: const Trait> {
    a: T = T::value(),
}
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-testsuite Area: The testsuite used to check the correctness of rustc F-default_field_values `#![feature(default_field_values)]` 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