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

Don't synthesize host effect args inside trait object types #119540

Merged
merged 1 commit into from
Jan 4, 2024

Conversation

fmease
Copy link
Member

@fmease fmease commented Jan 3, 2024

While we were indeed emitting an error for ~const & const trait bounds in trait object types, we were still synthesizing host effect args for them.

Since we don't record the original trait bound modifiers for dyn-Trait in hir::TyKind::TraitObject (unlike we do for let's say impl-Trait, hir::TyKind::OpaqueTy), AstConv just assumes ty::BoundConstness::NotConst in conv_object_ty_poly_trait_ref which given <host> dyn ~const NonConstTrait resulted in us not realizing that ~const was used on a non-const trait which lead to a failed assertion in the end.

Instead of updating hir::TyKind::TraitObject to track this kind of information, just strip the user-provided constness (similar to #119505).

Fixes #119524.

@rustbot
Copy link
Collaborator

rustbot commented Jan 3, 2024

r? @wesleywiser

(rustbot has picked a reviewer for you, use r? to override)

@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 Jan 3, 2024
@fmease fmease added the F-effects `#![feature(effects)]` label Jan 3, 2024
@compiler-errors
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Jan 3, 2024

📌 Commit 695a02e has been approved by compiler-errors

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 Jan 3, 2024
@compiler-errors
Copy link
Member

@bors rollup

@bors bors merged commit f4335a4 into rust-lang:master Jan 4, 2024
11 checks passed
@rustbot rustbot added this to the 1.77.0 milestone Jan 4, 2024
@fmease fmease deleted the no-effect-args-inside-dyn-trait branch January 4, 2024 23:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
F-effects `#![feature(effects)]` 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.

ICE: effects: assertion failed: constant == lifetime
5 participants