1 //! In general, there are a number of things for which it's convenient
2 //! to just call `builder.into` and have it emit its result into a
3 //! given location. This is basically for expressions or things that can be
4 //! wrapped up as expressions (e.g., blocks). To make this ergonomic, we use this
5 //! latter `EvalInto` trait.
7 use crate::build::{BlockAnd, Builder};
11 pub(in crate::build) trait EvalInto<'tcx> {
14 builder: &mut Builder<'_, 'tcx>,
15 destination: &Place<'tcx>,
20 impl<'a, 'tcx> Builder<'a, 'tcx> {
23 destination: &Place<'tcx>,
30 expr.eval_into(self, destination, block)
34 impl<'tcx> EvalInto<'tcx> for ExprRef<'tcx> {
37 builder: &mut Builder<'_, 'tcx>,
38 destination: &Place<'tcx>,
41 let expr = builder.hir.mirror(self);
42 builder.into_expr(destination, block, expr)
46 impl<'tcx> EvalInto<'tcx> for Expr<'tcx> {
49 builder: &mut Builder<'_, 'tcx>,
50 destination: &Place<'tcx>,
53 builder.into_expr(destination, block, self)