Skip to content

More robustly deal with relaxed bounds and improve their diagnostics - #142693

Merged
bors merged 8 commits into
rust-lang:masterfrom
fmease:unbound-bettering
Jul 19, 2025
Merged

More robustly deal with relaxed bounds and improve their diagnostics#142693
bors merged 8 commits into
rust-lang:masterfrom
fmease:unbound-bettering

Conversation

@fmease

@fmeasefmease commented Jun 18, 2025

Copy link
Copy Markdown
Member

Scaffolding for #135229 (CC #135331)

Fixes#136944 (6th commit).
Fixes#142718 (8th commit).

@rustbotrustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Jun 18, 2025
@fmease
fmeaseforce-pushed the unbound-bettering branch from 8d31700 to 4634541CompareJune 18, 2025 20:27
@fmeasefmease changed the title [WIP] unbound bettering (refactoring)[WIP] unbound betteringJun 18, 2025
@fmease
fmeaseforce-pushed the unbound-bettering branch 2 times, most recently from 69e237d to 03d01faCompareJune 19, 2025 02:46
@fmeasefmease added the rla-silenced Silences rust-log-analyzer postings to the PR it's added on. label Jun 19, 2025
@fmease
fmeaseforce-pushed the unbound-bettering branch 3 times, most recently from 8a6f65d to 04dad4eCompareJune 20, 2025 21:17
@fmeasefmease changed the title [WIP] unbound betteringMore robustly deal with relaxed bounds and improve their diagnosticsJun 20, 2025
@rust-langrust-lang deleted a comment from rust-borsBotJun 20, 2025
@fmease

Copy link
Copy Markdown
MemberAuthor

@bors2 try @rust-timer queue

@rust-timer

This comment has been minimized.

@rust-bors

rust-borsBot commented Jun 20, 2025

Copy link
Copy Markdown
Contributor

⌛ Trying commit 04dad4e with merge bfa10de

To cancel the try build, run the command @bors2 try cancel.

rust-borsBot added a commit that referenced this pull request Jun 20, 2025
More robustly deal with relaxed bounds and improve their diagnostics
Scaffolding for #135229 (CC #135331)
Fixes#136944.
Fixes#142718.
@rustbotrustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jun 20, 2025
@rust-bors

rust-borsBot commented Jun 20, 2025

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: bfa10de (bfa10de6407128926b18c60d51c9f19df73e336c, parent: 9c4ff566babe632af5e30281a822d1ae9972873b)

@rust-timer

This comment has been minimized.

@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (bfa10de): comparison URL.

Overall result: ❌ regressions - please read the text below

Benchmarking this pull request means it may be perf-sensitive – we'll automatically label it not fit for rolling up. You can override this, but we strongly advise not to, due to possible changes in compiler perf.

Next Steps: If you can justify the regressions found in this try perf run, please do so in sufficient writing along with @rustbot label: +perf-regression-triaged. If not, please fix the regressions and do another perf run. If its results are neutral or positive, the label will be automatically removed.

@bors rollup=never
@rustbot label: -S-waiting-on-perf +perf-regression

Instruction count

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

meanrangecount
Regressions ❌
(primary)
3.0%[3.0%, 3.0%]1
Regressions ❌
(secondary)
--0
Improvements ✅
(primary)
--0
Improvements ✅
(secondary)
--0
All ❌✅ (primary)3.0%[3.0%, 3.0%]1

Max RSS (memory usage)

Results (secondary -2.7%)

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

meanrangecount
Regressions ❌
(primary)
--0
Regressions ❌
(secondary)
2.4%[2.4%, 2.4%]1
Improvements ✅
(primary)
--0
Improvements ✅
(secondary)
-3.5%[-5.8%, -1.8%]6
All ❌✅ (primary)--0

Cycles

Results (primary 2.9%, secondary 4.4%)

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

meanrangecount
Regressions ❌
(primary)
2.9%[2.9%, 2.9%]1
Regressions ❌
(secondary)
4.4%[2.8%, 7.6%]10
Improvements ✅
(primary)
--0
Improvements ✅
(secondary)
--0
All ❌✅ (primary)2.9%[2.9%, 2.9%]1

Binary size

Results (primary 1.1%)

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

meanrangecount
Regressions ❌
(primary)
1.1%[1.1%, 1.1%]1
Regressions ❌
(secondary)
--0
Improvements ✅
(primary)
--0
Improvements ✅
(secondary)
--0
All ❌✅ (primary)1.1%[1.1%, 1.1%]1

Bootstrap: 692.606s -> 692.191s (-0.06%)
Artifact size: 372.01 MiB -> 371.99 MiB (-0.01%)

@rustbotrustbot added perf-regression Performance regression. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Jun 21, 2025
@bors

bors commented Jun 27, 2025

Copy link
Copy Markdown
Collaborator

☔ The latest upstream changes (presumably #143091) made this pull request unmergeable. Please resolve the merge conflicts.

@borsbors added the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Jun 27, 2025
@fmease

Copy link
Copy Markdown
MemberAuthor

#142693 (comment)

Looks spurious?

@fmease

Copy link
Copy Markdown
MemberAuthor

@bors rollup- alleviate pressure

@fmeasefmease removed the rla-silenced Silences rust-log-analyzer postings to the PR it's added on. label Jul 18, 2025
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Jul 18, 2025
…er-errors
More robustly deal with relaxed bounds and improve their diagnostics
Scaffolding for rust-lang#135229 (CC rust-lang#135331)
Fixesrust-lang#136944 (6th commit).
Fixesrust-lang#142718 (8th commit).
This was referenced Jul 18, 2025
bors added a commit that referenced this pull request Jul 18, 2025
Rollup of 9 pull requests
Successful merges:
- #138554 (Distinguish delim kind to decide whether to emit unexpected closing delimiter)
- #142673 (Show the offset, length and memory of uninit read errors)
- #142693 (More robustly deal with relaxed bounds and improve their diagnostics)
- #143382 (stabilize `const_slice_reverse`)
- #143928 (opt-dist: make llvm builds optional)
- #143961 (Correct which exploit mitigations are enabled by default)
- #144050 (Fix encoding of link_section and no_mangle cross crate)
- #144059 (Refactor `CrateLoader` into the `CStore`)
- #144123 (Generalize `unsize` and `unsize_into` destinations)
r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit that referenced this pull request Jul 19, 2025
Rollup of 9 pull requests
Successful merges:
- #138554 (Distinguish delim kind to decide whether to emit unexpected closing delimiter)
- #142673 (Show the offset, length and memory of uninit read errors)
- #142693 (More robustly deal with relaxed bounds and improve their diagnostics)
- #143382 (stabilize `const_slice_reverse`)
- #143928 (opt-dist: make llvm builds optional)
- #143961 (Correct which exploit mitigations are enabled by default)
- #144050 (Fix encoding of link_section and no_mangle cross crate)
- #144059 (Refactor `CrateLoader` into the `CStore`)
- #144123 (Generalize `unsize` and `unsize_into` destinations)
r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit that referenced this pull request Jul 19, 2025
Rollup of 9 pull requests
Successful merges:
- #138554 (Distinguish delim kind to decide whether to emit unexpected closing delimiter)
- #142673 (Show the offset, length and memory of uninit read errors)
- #142693 (More robustly deal with relaxed bounds and improve their diagnostics)
- #143382 (stabilize `const_slice_reverse`)
- #143928 (opt-dist: make llvm builds optional)
- #143961 (Correct which exploit mitigations are enabled by default)
- #144050 (Fix encoding of link_section and no_mangle cross crate)
- #144059 (Refactor `CrateLoader` into the `CStore`)
- #144123 (Generalize `unsize` and `unsize_into` destinations)
r? `@ghost`
`@rustbot` modify labels: rollup
@bors
bors merged commit f38891e into rust-lang:masterJul 19, 2025
11 checks passed
@rustbotrustbot added this to the 1.90.0 milestone Jul 19, 2025
rust-timer added a commit that referenced this pull request Jul 19, 2025
Rollup merge of #142693 - fmease:unbound-bettering, r=compiler-errors
More robustly deal with relaxed bounds and improve their diagnostics
Scaffolding for #135229 (CC #135331)
Fixes#136944 (6th commit).
Fixes#142718 (8th commit).
@fmease
fmease deleted the unbound-bettering branch July 19, 2025 10:07
github-actionsBot pushed a commit to rust-lang/miri that referenced this pull request Jul 20, 2025
Rollup of 9 pull requests
Successful merges:
- rust-lang/rust#138554 (Distinguish delim kind to decide whether to emit unexpected closing delimiter)
- rust-lang/rust#142673 (Show the offset, length and memory of uninit read errors)
- rust-lang/rust#142693 (More robustly deal with relaxed bounds and improve their diagnostics)
- rust-lang/rust#143382 (stabilize `const_slice_reverse`)
- rust-lang/rust#143928 (opt-dist: make llvm builds optional)
- rust-lang/rust#143961 (Correct which exploit mitigations are enabled by default)
- rust-lang/rust#144050 (Fix encoding of link_section and no_mangle cross crate)
- rust-lang/rust#144059 (Refactor `CrateLoader` into the `CStore`)
- rust-lang/rust#144123 (Generalize `unsize` and `unsize_into` destinations)
r? `@ghost`
`@rustbot` modify labels: rollup
@matthiaskrgrmatthiaskrgr mentioned this pull request Jul 21, 2025
Muscraft pushed a commit to Muscraft/rust that referenced this pull request Jul 21, 2025
…er-errors
More robustly deal with relaxed bounds and improve their diagnostics
Scaffolding for rust-lang#135229 (CC rust-lang#135331)
Fixesrust-lang#136944 (6th commit).
Fixesrust-lang#142718 (8th commit).
Muscraft pushed a commit to Muscraft/rust that referenced this pull request Jul 21, 2025
…iaskrgr
Rollup of 9 pull requests
Successful merges:
- rust-lang#138554 (Distinguish delim kind to decide whether to emit unexpected closing delimiter)
- rust-lang#142673 (Show the offset, length and memory of uninit read errors)
- rust-lang#142693 (More robustly deal with relaxed bounds and improve their diagnostics)
- rust-lang#143382 (stabilize `const_slice_reverse`)
- rust-lang#143928 (opt-dist: make llvm builds optional)
- rust-lang#143961 (Correct which exploit mitigations are enabled by default)
- rust-lang#144050 (Fix encoding of link_section and no_mangle cross crate)
- rust-lang#144059 (Refactor `CrateLoader` into the `CStore`)
- rust-lang#144123 (Generalize `unsize` and `unsize_into` destinations)
r? `@ghost`
`@rustbot` modify labels: rollup
@davidtwcodavidtwco mentioned this pull request Jul 24, 2025
22 tasks
bors added a commit that referenced this pull request Oct 20, 2025
Further tighten up relaxed bounds
Follow-up to #142693, #135331 and #135841.
Fixes#143122.
* Reject relaxed bounds `?Trait` in the bounds of trait aliases.
Just like `trait Trait {}` doesn't mean `trait Trait: Sized {}` and we therefore reject `trait Trait: ?Sized {}`, `trait Trait =;` (sic!) doesn't mean `trait Trait = Sized;` (never did!) and as a logical consequence `trait Trait = ?Sized;` is meaningless and should be forbidden.
* Don't permit `?Sized` in more places (e.g., supertrait bounds, trait object types) if feature `more_maybe_bounds` is enabled.
That internal feature is only meant to allow the user to define & use *new* default traits (that have fewer rules to follow for now to ease experimentation).
* Unconditionally check that the `Trait` in `?Trait` is a default trait.
Previously, we would only perform this check in selected places which was very brittle and led to bugs slipping through.
* Slightly improve diagnostics.
Zalathar added a commit to Zalathar/rust that referenced this pull request Oct 20, 2025
Further tighten up relaxed bounds
Follow-up to rust-lang#142693, rust-lang#135331 and rust-lang#135841.
Fixesrust-lang#143122.
* Reject relaxed bounds `?Trait` in the bounds of trait aliases.
Just like `trait Trait {}` doesn't mean `trait Trait: Sized {}` and we therefore reject `trait Trait: ?Sized {}`, `trait Trait =;` (sic!) doesn't mean `trait Trait = Sized;` (never did!) and as a logical consequence `trait Trait = ?Sized;` is meaningless and should be forbidden.
* Don't permit `?Sized` in more places (e.g., supertrait bounds, trait object types) if feature `more_maybe_bounds` is enabled.
That internal feature is only meant to allow the user to define & use *new* default traits (that have fewer rules to follow for now to ease experimentation).
* Unconditionally check that the `Trait` in `?Trait` is a default trait.
Previously, we would only perform this check in selected places which was very brittle and led to bugs slipping through.
* Slightly improve diagnostics.
rust-timer added a commit that referenced this pull request Oct 20, 2025
Rollup merge of #147734 - fmease:tighten-relaxed, r=lcnr
Further tighten up relaxed bounds
Follow-up to #142693, #135331 and #135841.
Fixes#143122.
* Reject relaxed bounds `?Trait` in the bounds of trait aliases.
Just like `trait Trait {}` doesn't mean `trait Trait: Sized {}` and we therefore reject `trait Trait: ?Sized {}`, `trait Trait =;` (sic!) doesn't mean `trait Trait = Sized;` (never did!) and as a logical consequence `trait Trait = ?Sized;` is meaningless and should be forbidden.
* Don't permit `?Sized` in more places (e.g., supertrait bounds, trait object types) if feature `more_maybe_bounds` is enabled.
That internal feature is only meant to allow the user to define & use *new* default traits (that have fewer rules to follow for now to ease experimentation).
* Unconditionally check that the `Trait` in `?Trait` is a default trait.
Previously, we would only perform this check in selected places which was very brittle and led to bugs slipping through.
* Slightly improve diagnostics.
github-actionsBot pushed a commit to rust-lang/rustc-dev-guide that referenced this pull request Oct 20, 2025
Further tighten up relaxed bounds
Follow-up to rust-lang/rust#142693, rust-lang/rust#135331 and rust-lang/rust#135841.
Fixesrust-lang/rust#143122.
* Reject relaxed bounds `?Trait` in the bounds of trait aliases.
Just like `trait Trait {}` doesn't mean `trait Trait: Sized {}` and we therefore reject `trait Trait: ?Sized {}`, `trait Trait =;` (sic!) doesn't mean `trait Trait = Sized;` (never did!) and as a logical consequence `trait Trait = ?Sized;` is meaningless and should be forbidden.
* Don't permit `?Sized` in more places (e.g., supertrait bounds, trait object types) if feature `more_maybe_bounds` is enabled.
That internal feature is only meant to allow the user to define & use *new* default traits (that have fewer rules to follow for now to ease experimentation).
* Unconditionally check that the `Trait` in `?Trait` is a default trait.
Previously, we would only perform this check in selected places which was very brittle and led to bugs slipping through.
* Slightly improve diagnostics.
Kobzol pushed a commit to Kobzol/rustc_codegen_gcc that referenced this pull request Dec 21, 2025
Rollup of 9 pull requests
Successful merges:
- rust-lang/rust#138554 (Distinguish delim kind to decide whether to emit unexpected closing delimiter)
- rust-lang/rust#142673 (Show the offset, length and memory of uninit read errors)
- rust-lang/rust#142693 (More robustly deal with relaxed bounds and improve their diagnostics)
- rust-lang/rust#143382 (stabilize `const_slice_reverse`)
- rust-lang/rust#143928 (opt-dist: make llvm builds optional)
- rust-lang/rust#143961 (Correct which exploit mitigations are enabled by default)
- rust-lang/rust#144050 (Fix encoding of link_section and no_mangle cross crate)
- rust-lang/rust#144059 (Refactor `CrateLoader` into the `CStore`)
- rust-lang/rust#144123 (Generalize `unsize` and `unsize_into` destinations)
r? `@ghost`
`@rustbot` modify labels: rollup
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Jun 4, 2026
…ease
Eagerly decide whether relaxed bounds are allowed or not
r? @davidtwco or @fmease
Previously introduced in rust-lang#142693 by @fmease
I am trying to resolve https://github.com/rust-lang/rust/blob/d7986943e496ccb07987f4ad83c6f7033d725861/compiler/rustc_hir_analysis/src/hir_ty_lowering/bounds.rs#L196, but then got into a rabbit hole somehwere.
I think this PR further unblocks resolving that FIXME, because it makes it easier to reason about whether we should be reporting an error about duplicate bounds or about relaxed bounds in general
rust-timer added a commit that referenced this pull request Jun 4, 2026
Rollup merge of #157305 - oli-obk:relaxed-bounds-maybe, r=fmease
Eagerly decide whether relaxed bounds are allowed or not
r? @davidtwco or @fmease
Previously introduced in #142693 by @fmease
I am trying to resolve https://github.com/rust-lang/rust/blob/d7986943e496ccb07987f4ad83c6f7033d725861/compiler/rustc_hir_analysis/src/hir_ty_lowering/bounds.rs#L196, but then got into a rabbit hole somehwere.
I think this PR further unblocks resolving that FIXME, because it makes it easier to reason about whether we should be reporting an error about duplicate bounds or about relaxed bounds in general
github-actionsBot pushed a commit to rust-lang/rustc-dev-guide that referenced this pull request Jun 20, 2026
Eagerly decide whether relaxed bounds are allowed or not
r? @davidtwco or @fmease
Previously introduced in rust-lang/rust#142693 by @fmease
I am trying to resolve https://github.com/rust-lang/rust/blob/d7986943e496ccb07987f4ad83c6f7033d725861/compiler/rustc_hir_analysis/src/hir_ty_lowering/bounds.rs#L196, but then got into a rabbit hole somehwere.
I think this PR further unblocks resolving that FIXME, because it makes it easier to reason about whether we should be reporting an error about duplicate bounds or about relaxed bounds in general
Kobzol pushed a commit to Kobzol/rust that referenced this pull request Jun 21, 2026
…ease
Eagerly decide whether relaxed bounds are allowed or not
r? @davidtwco or @fmease
Previously introduced in rust-lang#142693 by @fmease
I am trying to resolve https://github.com/rust-lang/rust/blob/d7986943e496ccb07987f4ad83c6f7033d725861/compiler/rustc_hir_analysis/src/hir_ty_lowering/bounds.rs#L196, but then got into a rabbit hole somehwere.
I think this PR further unblocks resolving that FIXME, because it makes it easier to reason about whether we should be reporting an error about duplicate bounds or about relaxed bounds in general
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-borsStatus: Waiting on bors to run and complete tests. Bors will change the label on completion.T-compilerRelevant 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.

Sized hierarchy: PointeeSized bounds aren't fully validated during HIR ty lowering Reword ?Trait bound diagnostic

6 participants

@fmease@rust-timer@bors@rust-log-analyzer@compiler-errors@rustbot