Skip to content

make RustaceansAreAwesome satisfy projection clauses - #164624

Merged
rust-bors[bot] merged 2 commits into
rust-lang:mainfrom
dianne:fix-rustaceansareawesome-take-2-complete
Oct 23, 2026
Merged

rust-bors[bot] merged 2 commits into
rust-lang:mainfrom
dianne:fix-rustaceansareawesome-take-2-complete

Conversation

@dianne

@dianne dianne commented Oct 20, 2026

Copy link
Copy Markdown
Member

Followup to #163958 that restores the functionality it removed it removed from #163200 and clarifies/fixes some of their comments. The following variant of #161621 is now accepted again:

trait HasAssoc {
    type Assoc;
}

trait Parent<T> {}

// We need to assume `<(RustaceansAreAwesome,) as HasAssoc>::Assoc == str`
// in order to prove `<(RustaceansAreAwesome,) as HasAssoc>::Assoc: ToOwned`

trait NeedProjectionNotInExpansion
where
    // The projection clause `<(Self,) as HasAssoc>::Assoc == str` isn't written
    // as part of a supertrait bound, so the expansion of `RustaceansAreAwesome:
    // NeedProjectionNotInExpansion` done by param-env normalization won't
    // include a version of it for `RustaceansAreAwesome`.
    (Self,): HasAssoc<Assoc = str>,
    Self: Parent<<<(Self,) as HasAssoc>::Assoc as ToOwned>::Owned>,
{
    fn f(&self);
}

It's unfortunate how tightly coupled this all is to particulars of param-env normalization. I'd love to remove these hacks eventually.

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Oct 20, 2026
@dianne

dianne commented Oct 20, 2026

Copy link
Copy Markdown
Member Author

there's some room for optimization at the expense of clarity, but hopefully this isn't enough of a perf bottleneck that it's needed. let's see: @bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Oct 20, 2026
@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Oct 20, 2026
…te, r=<try>

make `RustaceansAreAwesome` satisfy projection clauses
@rust-bors

rust-bors Bot commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: 13ec746 (13ec7465f912c616165d45f16011ea5ae0af17d0)
Base parent: 39b126b (39b126b8e227197c688fed9f9962658bdd89a761)

@rust-timer

This comment has been minimized.

@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (13ec746): comparison URL.

Overall result: no relevant changes - no action needed

Benchmarking means the PR may be perf-sensitive. Consider adding rollup=never if this change is not fit for rolling up.

@rustbot label: -S-waiting-on-perf -perf-regression

Instruction count

This perf run didn't have relevant results for this metric.

Max RSS (memory usage)

This perf run didn't have relevant results for this metric.

Cycles

Results (primary -1.2%, secondary -1.3%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
1.6% [1.6%, 1.6%] 1
Regressions ❌
(secondary)
1.0% [0.5%, 2.1%] 5
Improvements ✅
(primary)
-2.2% [-2.3%, -2.1%] 3
Improvements ✅
(secondary)
-2.5% [-6.6%, -0.4%] 9
All ❌✅ (primary) -1.2% [-2.3%, 1.6%] 4

Binary size

Results (primary -0.0%, secondary -0.0%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-0.0% [-0.0%, -0.0%] 1
Improvements ✅
(secondary)
-0.0% [-0.0%, -0.0%] 1
All ❌✅ (primary) -0.0% [-0.0%, -0.0%] 1

Bootstrap: 488.638s -> 489.098s (0.09%)
Artifact size: 409.06 MiB -> 409.11 MiB (0.01%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Oct 20, 2026
@dianne

dianne commented Oct 20, 2026

Copy link
Copy Markdown
Member Author

r? oli-obk or reassign

@dianne
dianne marked this pull request as ready for review October 20, 2026 12:09
@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Oct 20, 2026

@oli-obk oli-obk left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@rust-bors

rust-bors Bot commented Oct 23, 2026

Copy link
Copy Markdown
Contributor

📌 Commit e712498 has been approved by oli-obk

It is now in the queue for this repository.

@rust-bors rust-bors Bot 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 Oct 23, 2026
rust-bors Bot pushed a commit that referenced this pull request Oct 23, 2026
…uwer

Rollup of 5 pull requests

Successful merges:

 - #162395 (Make more float intrinsics generic)
 - #164636 (Remove `record_*` macros from the metadata encoder)
 - #164624 (make `RustaceansAreAwesome` satisfy projection clauses)
 - #164695 ([tiny] Include trait definition line when pointing at assoc function in E0308)
 - #164744 (some `Attribute`/`AttributeExt` cleanups)
@rust-bors
rust-bors Bot merged commit ec4833c into rust-lang:main Oct 23, 2026
15 checks passed
@rustbot rustbot added this to the 1.101.0 milestone Oct 23, 2026
rust-bors Bot pushed a commit that referenced this pull request Oct 23, 2026
Rollup merge of #164624 - dianne:fix-rustaceansareawesome-take-2-complete, r=oli-obk

make `RustaceansAreAwesome` satisfy projection clauses

Followup to #163958 that restores the functionality it removed it removed from #163200 and clarifies/fixes some of their comments. The following variant of #161621 is now accepted again:

```rust
trait HasAssoc {
    type Assoc;
}

trait Parent<T> {}

// We need to assume `<(RustaceansAreAwesome,) as HasAssoc>::Assoc == str`
// in order to prove `<(RustaceansAreAwesome,) as HasAssoc>::Assoc: ToOwned`

trait NeedProjectionNotInExpansion
where
    // The projection clause `<(Self,) as HasAssoc>::Assoc == str` isn't written
    // as part of a supertrait bound, so the expansion of `RustaceansAreAwesome:
    // NeedProjectionNotInExpansion` done by param-env normalization won't
    // include a version of it for `RustaceansAreAwesome`.
    (Self,): HasAssoc<Assoc = str>,
    Self: Parent<<<(Self,) as HasAssoc>::Assoc as ToOwned>::Owned>,
{
    fn f(&self);
}
```

It's unfortunate how tightly coupled this all is to particulars of param-env normalization. I'd love to remove these hacks eventually.
@rust-timer

Copy link
Copy Markdown
Collaborator

Note

This PR was benchmarked as part of triage of its containing rollup: triage URL.

Finished benchmarking commit (f98307f): comparison URL.

Overall result: ❌ regressions - please read:

Our benchmarks found a performance regression caused by this PR.
This might be an actual regression, but it can also be just noise.

Next Steps:

  • If the regression was expected or you think it can be justified,
    please write a comment with sufficient written justification, and add
    @rustbot label: +perf-regression-triaged to it, to mark the regression as triaged.
  • If you think that you know of a way to resolve the regression, try to create
    a new PR with a fix for the regression.
  • If you do not understand the regression or you think that it is just noise,
    you can ask the @rust-lang/wg-compiler-performance working group for help (members of this group
    were already notified of this PR).

@rustbot label: +perf-regression
cc @rust-lang/wg-compiler-performance

Instruction count

Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
0.3% [0.0%, 0.5%] 11
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) - - 0

Max RSS (memory usage)

Results (secondary -3.8%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-3.8% [-5.9%, -1.8%] 2
All ❌✅ (primary) - - 0

Cycles

This perf run didn't have relevant results for this metric.

Binary size

This perf run didn't have relevant results for this metric.

Artifact size: 406.42 MiB -> 406.60 MiB (0.05%)

@rustbot rustbot added the perf-regression Performance regression. label Oct 23, 2026
programskillforverification pushed a commit to programskillforverification/miri that referenced this pull request Oct 24, 2026
…uwer

Rollup of 5 pull requests

Successful merges:

 - rust-lang/rust#162395 (Make more float intrinsics generic)
 - rust-lang/rust#164636 (Remove `record_*` macros from the metadata encoder)
 - rust-lang/rust#164624 (make `RustaceansAreAwesome` satisfy projection clauses)
 - rust-lang/rust#164695 ([tiny] Include trait definition line when pointing at assoc function in E0308)
 - rust-lang/rust#164744 (some `Attribute`/`AttributeExt` cleanups)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

perf-regression Performance regression. 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.

4 participants