Auto merge of #14787 - HKalbasi:mir2, r=HKalbasi

MIR episode 5

This PR inits drop support (it is very broken at this stage, some things are dropped multiple time, drop scopes are wrong, ...) and adds stdout support (`println!` doesn't work since its expansion is dummy, but `stdout().write(b"hello world\n")` works if you use `RA_SYSROOT_HACK`) for interpreting. There is no useful unit test that it can interpret yet, but it is a good sign that it didn't hit a major road block yet.

In MIR lowering, it adds support for slice pattern and anonymous const blocks, and some fixes so that we can evaluate `SmolStr::new_inline` in const eval. With these changes, 57 failed mir body remains.
This commit is contained in:
bors 2023-05-18 09:44:26 +00:00
commit 034d7c8537
36 changed files with 1529 additions and 357 deletions

View file

@ -420,13 +420,8 @@ impl HirDisplay for Const {
ConstValue::Concrete(c) => match &c.interned {
ConstScalar::Bytes(b, m) => render_const_scalar(f, &b, m, &data.ty),
ConstScalar::UnevaluatedConst(c, parameters) => {
let const_data = f.db.const_data(*c);
write!(
f,
"{}",
const_data.name.as_ref().and_then(|x| x.as_str()).unwrap_or("_")
)?;
hir_fmt_generics(f, parameters, Some((*c).into()))?;
write!(f, "{}", c.name(f.db.upcast()))?;
hir_fmt_generics(f, parameters, c.generic_def(f.db.upcast()))?;
Ok(())
}
ConstScalar::Unknown => f.write_char('_'),