Auto merge of #6189 - ebroto:rustup, r=ebroto

Rustup

changelog: none

r? `@ghost`
This commit is contained in:
bors 2020-10-17 20:13:34 +00:00
commit 01dd31fa60
6 changed files with 17 additions and 1 deletions

View File

@ -741,6 +741,7 @@ fn never_loop_expr(expr: &Expr<'_>, main_loop_id: HirId) -> NeverLoopResult {
| ExprKind::Closure(_, _, _, _, _)
| ExprKind::LlvmInlineAsm(_)
| ExprKind::Path(_)
| ExprKind::ConstBlock(_)
| ExprKind::Lit(_)
| ExprKind::Err => NeverLoopResult::Otherwise,
}

View File

@ -506,6 +506,11 @@ fn visit_expr(&mut self, expr: &Expr<'_>) {
println!(" if {}.len() == {};", fields_pat, fields.len());
println!(" // unimplemented: field checks");
},
ExprKind::ConstBlock(_) => {
let value_pat = self.next("value");
println!("Const({})", value_pat);
self.current = value_pat;
},
// FIXME: compute length (needs type info)
ExprKind::Repeat(ref value, _) => {
let value_pat = self.next("value");

View File

@ -23,7 +23,7 @@
/// This function is named so to stress that it isn't exhaustive and returns FNs.
fn identify_some_pure_patterns(expr: &Expr<'_>) -> bool {
match expr.kind {
ExprKind::Lit(..) | ExprKind::Path(..) | ExprKind::Field(..) => true,
ExprKind::Lit(..) | ExprKind::ConstBlock(..) | ExprKind::Path(..) | ExprKind::Field(..) => true,
ExprKind::AddrOf(_, _, addr_of_expr) => identify_some_pure_patterns(addr_of_expr),
ExprKind::Tup(tup_exprs) => tup_exprs.iter().all(|expr| identify_some_pure_patterns(expr)),
ExprKind::Struct(_, fields, expr) => {

View File

@ -559,6 +559,9 @@ pub fn hash_expr(&mut self, e: &Expr<'_>) {
self.hash_name(path.ident.name);
self.hash_exprs(args);
},
ExprKind::ConstBlock(ref l_id) => {
self.hash_body(l_id.body);
},
ExprKind::Repeat(ref e, ref l_id) => {
self.hash_expr(e);
self.hash_body(l_id.body);

View File

@ -338,6 +338,11 @@ fn print_expr(cx: &LateContext<'_>, expr: &hir::Expr<'_>, indent: usize) {
print_expr(cx, base, indent + 1);
}
},
hir::ExprKind::ConstBlock(ref anon_const) => {
println!("{}ConstBlock", ind);
println!("{}anon_const:", ind);
print_expr(cx, &cx.tcx.hir().body(anon_const.body).value, indent + 1);
},
hir::ExprKind::Repeat(ref val, ref anon_const) => {
println!("{}Repeat", ind);
println!("{}value:", ind);

View File

@ -116,6 +116,7 @@ fn hir_from_snippet(expr: &hir::Expr<'_>, snippet: Cow<'a, str>) -> Self {
| hir::ExprKind::Index(..)
| hir::ExprKind::InlineAsm(..)
| hir::ExprKind::LlvmInlineAsm(..)
| hir::ExprKind::ConstBlock(..)
| hir::ExprKind::Lit(..)
| hir::ExprKind::Loop(..)
| hir::ExprKind::MethodCall(..)
@ -163,6 +164,7 @@ pub fn ast(cx: &EarlyContext<'_>, expr: &ast::Expr, default: &'a str) -> Self {
| ast::ExprKind::Index(..)
| ast::ExprKind::InlineAsm(..)
| ast::ExprKind::LlvmInlineAsm(..)
| ast::ExprKind::ConstBlock(..)
| ast::ExprKind::Lit(..)
| ast::ExprKind::Loop(..)
| ast::ExprKind::MacCall(..)