Skip to content

Commit 01dd31f

Browse files
committed
Auto merge of #6189 - ebroto:rustup, r=ebroto
Rustup changelog: none r? `@ghost`
2 parents 4e83a38 + bc43862 commit 01dd31f

File tree

6 files changed

+17
-1
lines changed

6 files changed

+17
-1
lines changed

clippy_lints/src/loops.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -741,6 +741,7 @@ fn never_loop_expr(expr: &Expr<'_>, main_loop_id: HirId) -> NeverLoopResult {
741741
| ExprKind::Closure(_, _, _, _, _)
742742
| ExprKind::LlvmInlineAsm(_)
743743
| ExprKind::Path(_)
744+
| ExprKind::ConstBlock(_)
744745
| ExprKind::Lit(_)
745746
| ExprKind::Err => NeverLoopResult::Otherwise,
746747
}

clippy_lints/src/utils/author.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -506,6 +506,11 @@ impl<'tcx> Visitor<'tcx> for PrintVisitor {
506506
println!(" if {}.len() == {};", fields_pat, fields.len());
507507
println!(" // unimplemented: field checks");
508508
},
509+
ExprKind::ConstBlock(_) => {
510+
let value_pat = self.next("value");
511+
println!("Const({})", value_pat);
512+
self.current = value_pat;
513+
},
509514
// FIXME: compute length (needs type info)
510515
ExprKind::Repeat(ref value, _) => {
511516
let value_pat = self.next("value");

clippy_lints/src/utils/eager_or_lazy.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ use rustc_middle::hir::map::Map;
2323
/// This function is named so to stress that it isn't exhaustive and returns FNs.
2424
fn identify_some_pure_patterns(expr: &Expr<'_>) -> bool {
2525
match expr.kind {
26-
ExprKind::Lit(..) | ExprKind::Path(..) | ExprKind::Field(..) => true,
26+
ExprKind::Lit(..) | ExprKind::ConstBlock(..) | ExprKind::Path(..) | ExprKind::Field(..) => true,
2727
ExprKind::AddrOf(_, _, addr_of_expr) => identify_some_pure_patterns(addr_of_expr),
2828
ExprKind::Tup(tup_exprs) => tup_exprs.iter().all(|expr| identify_some_pure_patterns(expr)),
2929
ExprKind::Struct(_, fields, expr) => {

clippy_lints/src/utils/hir_utils.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -559,6 +559,9 @@ impl<'a, 'tcx> SpanlessHash<'a, 'tcx> {
559559
self.hash_name(path.ident.name);
560560
self.hash_exprs(args);
561561
},
562+
ExprKind::ConstBlock(ref l_id) => {
563+
self.hash_body(l_id.body);
564+
},
562565
ExprKind::Repeat(ref e, ref l_id) => {
563566
self.hash_expr(e);
564567
self.hash_body(l_id.body);

clippy_lints/src/utils/inspector.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,11 @@ fn print_expr(cx: &LateContext<'_>, expr: &hir::Expr<'_>, indent: usize) {
338338
print_expr(cx, base, indent + 1);
339339
}
340340
},
341+
hir::ExprKind::ConstBlock(ref anon_const) => {
342+
println!("{}ConstBlock", ind);
343+
println!("{}anon_const:", ind);
344+
print_expr(cx, &cx.tcx.hir().body(anon_const.body).value, indent + 1);
345+
},
341346
hir::ExprKind::Repeat(ref val, ref anon_const) => {
342347
println!("{}Repeat", ind);
343348
println!("{}value:", ind);

clippy_lints/src/utils/sugg.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ impl<'a> Sugg<'a> {
116116
| hir::ExprKind::Index(..)
117117
| hir::ExprKind::InlineAsm(..)
118118
| hir::ExprKind::LlvmInlineAsm(..)
119+
| hir::ExprKind::ConstBlock(..)
119120
| hir::ExprKind::Lit(..)
120121
| hir::ExprKind::Loop(..)
121122
| hir::ExprKind::MethodCall(..)
@@ -163,6 +164,7 @@ impl<'a> Sugg<'a> {
163164
| ast::ExprKind::Index(..)
164165
| ast::ExprKind::InlineAsm(..)
165166
| ast::ExprKind::LlvmInlineAsm(..)
167+
| ast::ExprKind::ConstBlock(..)
166168
| ast::ExprKind::Lit(..)
167169
| ast::ExprKind::Loop(..)
168170
| ast::ExprKind::MacCall(..)

0 commit comments

Comments
 (0)