mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 12:29:21 +00:00
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:
commit
034d7c8537
36 changed files with 1529 additions and 357 deletions
|
@ -6,7 +6,7 @@ use std::{
|
|||
};
|
||||
|
||||
use chalk_ir::{
|
||||
cast::Cast, fold::Shift, DebruijnIndex, GenericArgData, Mutability, TyKind, TyVariableKind,
|
||||
cast::Cast, fold::Shift, DebruijnIndex, GenericArgData, Mutability, TyVariableKind,
|
||||
};
|
||||
use hir_def::{
|
||||
generics::TypeOrConstParamData,
|
||||
|
@ -42,7 +42,7 @@ use crate::{
|
|||
traits::FnTrait,
|
||||
utils::{generics, Generics},
|
||||
Adjust, Adjustment, AdtId, AutoBorrow, Binders, CallableDefId, FnPointer, FnSig, FnSubst,
|
||||
Interner, Rawness, Scalar, Substitution, TraitRef, Ty, TyBuilder, TyExt,
|
||||
Interner, Rawness, Scalar, Substitution, TraitRef, Ty, TyBuilder, TyExt, TyKind,
|
||||
};
|
||||
|
||||
use super::{
|
||||
|
@ -171,9 +171,10 @@ impl<'a> InferenceContext<'a> {
|
|||
Expr::Unsafe { id, statements, tail } => {
|
||||
self.infer_block(tgt_expr, *id, statements, *tail, None, expected)
|
||||
}
|
||||
Expr::Const { id, statements, tail } => {
|
||||
Expr::Const(id) => {
|
||||
self.with_breakable_ctx(BreakableKind::Border, None, None, |this| {
|
||||
this.infer_block(tgt_expr, *id, statements, *tail, None, expected)
|
||||
let (_, expr) = this.db.lookup_intern_anonymous_const(*id);
|
||||
this.infer_expr(expr, expected)
|
||||
})
|
||||
.1
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue