Skip to content

Don't look for non-type-level assoc consts when checking trait object types#153906

Closed
ViewWay wants to merge 1 commit intorust-lang:mainfrom
ViewWay:fix/ice-153731
Closed

Don't look for non-type-level assoc consts when checking trait object types#153906
ViewWay wants to merge 1 commit intorust-lang:mainfrom
ViewWay:fix/ice-153731

Conversation

@ViewWay
Copy link

@ViewWay ViewWay commented Mar 15, 2026

Fixes #153731.

This is a cherry-pick of PR #153738.

Problem

PR #150843 introduced a regression where eager type aliases containing dyn Trait (with associated consts) would incorrectly report 'trait is not dyn compatible' errors. This affected 254 crates depending on old bitvec versions.

Root Cause

When checking for unspecified assoc items in trait object types, we were filtering for all associated consts (is_const()). But eager type aliases don't get wfchecked at definition site, which broke the assumption that dyn-incompatible traits would be rejected early.

Fix

Changed is_const() to is_type_const() to only check type-level associated consts, not regular associated consts. Regular associated consts cannot be bound in trait object types anyway, so checking them was unnecessary.

… types

This is a cherry-pick of PR #153738

Problem:
- PR #150843 introduced a regression where eager type aliases containing
  dyn Trait (with associated consts) would incorrectly report
  'trait is not dyn compatible' errors
- This affected 254 crates depending on old bitvec versions

Root cause:
- When checking for unspecified assoc items in trait object types,
  we were filtering for all associated consts (is_const())
- But eager type aliases don't get wfchecked at definition site
- This broke the assumption that dyn-incompatible traits would be
  rejected early

Fix:
- Changed is_const() to is_type_const() to only check type-level
  associated consts, not regular associated consts
- Regular associated consts cannot be bound in trait object types
  anyway, so checking them was unnecessary
@rustbot
Copy link
Collaborator

rustbot commented Mar 15, 2026

HIR ty lowering was modified

cc @fmease

Some changes occurred in compiler/rustc_sanitizers

cc @rcvalle

@rustbot rustbot added PG-exploit-mitigations Project group: Exploit mitigations 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 Mar 15, 2026
@rustbot
Copy link
Collaborator

rustbot commented Mar 15, 2026

r? @chenyukang

rustbot has assigned @chenyukang.
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

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: compiler
  • compiler expanded to 69 candidates
  • Random selection from 15 candidates

@rustbot
Copy link
Collaborator

rustbot commented Mar 15, 2026

⚠️ Warning ⚠️

  • There are issue links (such as #123) in the commit messages of the following commits.
    Please move them to the PR description, to avoid spamming the issues with references to the commit, and so this bot can automatically canonicalize them to avoid issues with subtree.

@fmease fmease closed this Mar 15, 2026
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Mar 15, 2026
@fmease
Copy link
Member

fmease commented Mar 15, 2026

@ViewWay I have no idea what you're trying to accomplish here but it makes no sense whatsoever for you to to cherry-pick / copy the commit I authored in open PR RUST-153906. Please cease this behavior immediately!

@rust-log-analyzer
Copy link
Collaborator

The job pr-check-1 failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)


# RECOMMENDATIONS

* Fix missing copyright/licensing information: For one or more files, the tool
  cannot find copyright and/or licensing information. You typically do this by
  adding 'SPDX-FileCopyrightText' and 'SPDX-License-Identifier' tags to each
  file. The tutorial explains additional ways to do this:
  <https://reuse.software/tutorial/>

  local time: Sun Mar 15 05:36:19 UTC 2026
  network time: Sun, 15 Mar 2026 05:36:19 GMT
##[error]Process completed with exit code 1.
##[group]Run echo "disk usage:"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

PG-exploit-mitigations Project group: Exploit mitigations 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.

1.95 beta regression affecting old versions of bitvec: "... is not dyn compatible"

5 participants