Rollup merge of #109749 - compiler-errors:new-solver-float-var, r=lcnr

Canonicalize float var as float in new solver

Typo in new canonicalizer -- we should be canonicalizing float vars as `CanonicalTyVarKind::Float`, not `CanonicalTyVarKind::Int`.

Fixes compiler-errors/next-solver-hir-issues#9
This commit is contained in:
Yuki Okushi 2023-03-30 21:07:02 +09:00 committed by GitHub
commit e1f4ddfdd9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 1 deletions

View File

@ -291,7 +291,7 @@ impl<'tcx> TypeFolder<TyCtxt<'tcx>> for Canonicalizer<'_, 'tcx> {
if nt != t {
return self.fold_ty(nt);
} else {
CanonicalVarKind::Ty(CanonicalTyVarKind::Int)
CanonicalVarKind::Ty(CanonicalTyVarKind::Float)
}
}
ty::Infer(ty::FreshTy(_) | ty::FreshIntTy(_) | ty::FreshFloatTy(_)) => {

View File

@ -0,0 +1,8 @@
// compile-flags: -Ztrait-solver=next
// check-pass
fn foo(x: f64) {
let y = x + 1.0;
}
fn main() {}