Don't synthesize host effect args inside trait object types #119540
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 assumesty::BoundConstness::NotConst
inconv_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.