mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-27 07:00:55 +00:00
don't visit any nested bodies in is_const_evaluatable
This commit is contained in:
parent
a859e5cc1c
commit
b5169aea52
2 changed files with 15 additions and 4 deletions
|
@ -316,10 +316,7 @@ pub fn is_const_evaluatable<'tcx>(cx: &LateContext<'tcx>, e: &'tcx Expr<'_>) ->
|
|||
is_const: bool,
|
||||
}
|
||||
impl<'tcx> Visitor<'tcx> for V<'_, 'tcx> {
|
||||
type NestedFilter = nested_filter::OnlyBodies;
|
||||
fn nested_visit_map(&mut self) -> Self::Map {
|
||||
self.cx.tcx.hir()
|
||||
}
|
||||
type NestedFilter = rustc_hir::intravisit::nested_filter::None;
|
||||
|
||||
fn visit_expr(&mut self, e: &'tcx Expr<'_>) {
|
||||
if !self.is_const {
|
||||
|
|
14
tests/ui/crashes/ice-11939.rs
Normal file
14
tests/ui/crashes/ice-11939.rs
Normal file
|
@ -0,0 +1,14 @@
|
|||
#![allow(clippy::unit_arg, clippy::no_effect)]
|
||||
|
||||
const fn v(_: ()) {}
|
||||
|
||||
fn main() {
|
||||
if true {
|
||||
v({
|
||||
[0; 1 + 1];
|
||||
});
|
||||
Some(())
|
||||
} else {
|
||||
None
|
||||
};
|
||||
}
|
Loading…
Reference in a new issue