1
Fork 0

Auto merge of #120381 - fee1-dead-contrib:reconstify-add, r=compiler-errors

Reconstify `Add`

r? project-const-traits

I'm not happy with the ui test changes (or failures because I did not bless them and include the diffs in this PR). There is at least some bugs I need to look and try fix:

1. A third duplicated diagnostic when a consumer crate that does not have `effects` enabled has a trait selection error for an upstream const_trait trait. See tests/ui/ufcs/ufcs-qpath-self-mismatch.rs.
2. For some reason, making `Add` a const trait would stop us from suggesting `T: Add` when we try to add two `T`s without that bound. See tests/ui/suggestions/issue-97677.rs
This commit is contained in:
bors 2024-02-08 00:04:14 +00:00
commit 6894f435d3
4 changed files with 24 additions and 14 deletions

View file

@ -98,6 +98,7 @@ impl<'tcx, T> IsSuggestable<'tcx> for T
where
T: TypeVisitable<TyCtxt<'tcx>> + TypeFoldable<TyCtxt<'tcx>>,
{
#[tracing::instrument(level = "debug", skip(tcx))]
fn is_suggestable(self, tcx: TyCtxt<'tcx>, infer_suggestable: bool) -> bool {
self.visit_with(&mut IsSuggestableVisitor { tcx, infer_suggestable }).is_continue()
}
@ -533,6 +534,9 @@ impl<'tcx> TypeVisitor<TyCtxt<'tcx>> for IsSuggestableVisitor<'tcx> {
match c.kind() {
ConstKind::Infer(InferConst::Var(_)) if self.infer_suggestable => {}
// effect variables are always suggestable, because they are not visible
ConstKind::Infer(InferConst::EffectVar(_)) => {}
ConstKind::Infer(..)
| ConstKind::Bound(..)
| ConstKind::Placeholder(..)