Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ice: no enclosing scope found: feature-gate-const-if-match.rs #8245

Closed
matthiaskrgr opened this issue Jan 8, 2022 · 1 comment
Closed

ice: no enclosing scope found: feature-gate-const-if-match.rs #8245

matthiaskrgr opened this issue Jan 8, 2022 · 1 comment
Labels
C-bug Category: Clippy is not doing the correct thing I-ICE Issue: Clippy panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@matthiaskrgr
Copy link
Member

Summary

code reduced from rustc ./src/test/ui/consts/control-flow/feature-gate-const-if-match.rs

fn main() {
    let _ = [0; {
        let x = 0;
        if let Some(x) = Some(x) { x } else { 1 }
    }];
}

found as part of #3142

Version

rustc 1.59.0-nightly (e012a191d 2022-01-06)
binary: rustc
commit-hash: e012a191d768adeda1ee36a99ef8b92d51920154
commit-date: 2022-01-06
host: x86_64-unknown-linux-gnu
release: 1.59.0-nightly
LLVM version: 13.0.0
clippy 0.1.59 (e012a19 2022-01-06)

Error output

clippy-driver ./src/test/ui/consts/control-flow/feature-gate-const-if-match.rs

Backtrace

error: internal compiler error: compiler/rustc_middle/src/middle/region.rs:371:32: no enclosing scope for id 7

thread 'rustc' panicked at 'Box<dyn Any>', compiler/rustc_errors/src/lib.rs:1169:9
stack backtrace:
 0:     0x7fcf9fa90b4c - std::backtrace_rs::backtrace::libunwind::trace::hac89ae696ab31153
                             at /rustc/e012a191d768adeda1ee36a99ef8b92d51920154/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
 1:     0x7fcf9fa90b4c - std::backtrace_rs::backtrace::trace_unsynchronized::he0e34c1ffcd1fd95
                             at /rustc/e012a191d768adeda1ee36a99ef8b92d51920154/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
 2:     0x7fcf9fa90b4c - std::sys_common::backtrace::_print_fmt::hbbcd6534ff2cdaab
                             at /rustc/e012a191d768adeda1ee36a99ef8b92d51920154/library/std/src/sys_common/backtrace.rs:67:5
 3:     0x7fcf9fa90b4c - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hca373cbf95c63dfd
                             at /rustc/e012a191d768adeda1ee36a99ef8b92d51920154/library/std/src/sys_common/backtrace.rs:46:22
 4:     0x7fcf9faf168c - core::fmt::write::hf1bd4152e956a546
                             at /rustc/e012a191d768adeda1ee36a99ef8b92d51920154/library/core/src/fmt/mod.rs:1168:17
 5:     0x7fcf9fa7fec3 - std::io::Write::write_fmt::h2f14a980b941fea5
                             at /rustc/e012a191d768adeda1ee36a99ef8b92d51920154/library/std/src/io/mod.rs:1660:15
 6:     0x7fcf9fa95012 - std::sys_common::backtrace::_print::hc99e12058f69fd7f
                             at /rustc/e012a191d768adeda1ee36a99ef8b92d51920154/library/std/src/sys_common/backtrace.rs:49:5
 7:     0x7fcf9fa95012 - std::sys_common::backtrace::print::h28ddbd216cc47c63
                             at /rustc/e012a191d768adeda1ee36a99ef8b92d51920154/library/std/src/sys_common/backtrace.rs:36:9
 8:     0x7fcf9fa95012 - std::panicking::default_hook::{{closure}}::h91763e160bca83d2
                             at /rustc/e012a191d768adeda1ee36a99ef8b92d51920154/library/std/src/panicking.rs:211:50
 9:     0x7fcf9fa94bf5 - std::panicking::default_hook::h04e711875c06f41e
                             at /rustc/e012a191d768adeda1ee36a99ef8b92d51920154/library/std/src/panicking.rs:228:9
10:     0x56532ff1fa01 - clippy_driver[de939f5069ad0877]::ICE_HOOK::{closure#0}::{closure#0}
11:     0x7fcf9fa957c5 - std::panicking::rust_panic_with_hook::h7d6693789c82cfe4
                             at /rustc/e012a191d768adeda1ee36a99ef8b92d51920154/library/std/src/panicking.rs:610:17
12:     0x7fcfa13b3cbb - std[e740e8867e95a171]::panicking::begin_panic::<rustc_errors[62a5cc7b06393f71]::ExplicitBug>::{closure#0}
13:     0x7fcfa13b34e6 - std[e740e8867e95a171]::sys_common::backtrace::__rust_end_short_backtrace::<std[e740e8867e95a171]::panicking::begin_panic<rustc_errors[62a5cc7b06393f71]::ExplicitBug>::{closure#0}, !>
14:     0x7fcfa13b3c5f - std[e740e8867e95a171]::panicking::begin_panic::<rustc_errors[62a5cc7b06393f71]::ExplicitBug>
15:     0x7fcfa13be9cd - std[e740e8867e95a171]::panic::panic_any::<rustc_errors[62a5cc7b06393f71]::ExplicitBug>
16:     0x7fcfa13bdc5d - <rustc_errors[62a5cc7b06393f71]::HandlerInner>::bug
17:     0x7fcfa13bd740 - <rustc_errors[62a5cc7b06393f71]::Handler>::bug
18:     0x7fcfa124a049 - rustc_middle[6a5313df6756a06b]::ty::context::tls::with_opt::<rustc_middle[6a5313df6756a06b]::util::bug::opt_span_bug_fmt<rustc_span[5840c952fc6dfb1f]::span_encoding::Span>::{closure#0}, ()>
19:     0x7fcfa124abd0 - rustc_middle[6a5313df6756a06b]::util::bug::opt_span_bug_fmt::<rustc_span[5840c952fc6dfb1f]::span_encoding::Span>
20:     0x7fcfa124ab46 - rustc_middle[6a5313df6756a06b]::util::bug::bug_fmt
21:     0x7fcfa2027764 - <rustc_middle[6a5313df6756a06b]::middle::region::ScopeTree>::var_scope
22:     0x5653301e88b8 - <clippy_lints[3e536fcc5bfc7607]::shadow::Shadow as rustc_lint[791f8e2cef40682b]::passes::LateLintPass>::check_pat
23:     0x7fcfa10702d4 - <rustc_lint[791f8e2cef40682b]::late::LateLintPassObjects as rustc_lint[791f8e2cef40682b]::passes::LateLintPass>::check_pat
24:     0x7fcfa0374dba - <rustc_lint[791f8e2cef40682b]::late::LateContextAndPass<rustc_lint[791f8e2cef40682b]::late::LateLintPassObjects> as rustc_hir[b6231e5dfc545669]::intravisit::Visitor>::visit_pat
25:     0x7fcfa0311b5c - rustc_hir[b6231e5dfc545669]::intravisit::walk_pat::<rustc_lint[791f8e2cef40682b]::late::LateContextAndPass<rustc_lint[791f8e2cef40682b]::late::LateLintPassObjects>>
26:     0x7fcfa03126ee - rustc_hir[b6231e5dfc545669]::intravisit::walk_let_expr::<rustc_lint[791f8e2cef40682b]::late::LateContextAndPass<rustc_lint[791f8e2cef40682b]::late::LateLintPassObjects>>
27:     0x7fcfa0374e47 - <rustc_lint[791f8e2cef40682b]::late::LateContextAndPass<rustc_lint[791f8e2cef40682b]::late::LateLintPassObjects> as rustc_hir[b6231e5dfc545669]::intravisit::Visitor>::visit_expr
28:     0x7fcfa031288b - rustc_hir[b6231e5dfc545669]::intravisit::walk_expr::<rustc_lint[791f8e2cef40682b]::late::LateContextAndPass<rustc_lint[791f8e2cef40682b]::late::LateLintPassObjects>>
29:     0x7fcfa0374e47 - <rustc_lint[791f8e2cef40682b]::late::LateContextAndPass<rustc_lint[791f8e2cef40682b]::late::LateLintPassObjects> as rustc_hir[b6231e5dfc545669]::intravisit::Visitor>::visit_expr
30:     0x7fcfa03755c9 - <rustc_lint[791f8e2cef40682b]::late::LateContextAndPass<rustc_lint[791f8e2cef40682b]::late::LateLintPassObjects> as rustc_hir[b6231e5dfc545669]::intravisit::Visitor>::visit_block
31:     0x7fcfa0374e47 - <rustc_lint[791f8e2cef40682b]::late::LateContextAndPass<rustc_lint[791f8e2cef40682b]::late::LateLintPassObjects> as rustc_hir[b6231e5dfc545669]::intravisit::Visitor>::visit_expr
32:     0x7fcfa0374b7c - <rustc_lint[791f8e2cef40682b]::late::LateContextAndPass<rustc_lint[791f8e2cef40682b]::late::LateLintPassObjects> as rustc_hir[b6231e5dfc545669]::intravisit::Visitor>::visit_nested_body
33:     0x7fcfa0374e47 - <rustc_lint[791f8e2cef40682b]::late::LateContextAndPass<rustc_lint[791f8e2cef40682b]::late::LateLintPassObjects> as rustc_hir[b6231e5dfc545669]::intravisit::Visitor>::visit_expr
34:     0x7fcfa0310c3b - rustc_hir[b6231e5dfc545669]::intravisit::walk_local::<rustc_lint[791f8e2cef40682b]::late::LateContextAndPass<rustc_lint[791f8e2cef40682b]::late::LateLintPassObjects>>
35:     0x7fcfa0375487 - <rustc_lint[791f8e2cef40682b]::late::LateContextAndPass<rustc_lint[791f8e2cef40682b]::late::LateLintPassObjects> as rustc_hir[b6231e5dfc545669]::intravisit::Visitor>::visit_local
36:     0x7fcfa0374f12 - <rustc_lint[791f8e2cef40682b]::late::LateContextAndPass<rustc_lint[791f8e2cef40682b]::late::LateLintPassObjects> as rustc_hir[b6231e5dfc545669]::intravisit::Visitor>::visit_stmt
37:     0x7fcfa0312577 - rustc_hir[b6231e5dfc545669]::intravisit::walk_block::<rustc_lint[791f8e2cef40682b]::late::LateContextAndPass<rustc_lint[791f8e2cef40682b]::late::LateLintPassObjects>>
38:     0x7fcfa03755c9 - <rustc_lint[791f8e2cef40682b]::late::LateContextAndPass<rustc_lint[791f8e2cef40682b]::late::LateLintPassObjects> as rustc_hir[b6231e5dfc545669]::intravisit::Visitor>::visit_block
39:     0x7fcfa0374e47 - <rustc_lint[791f8e2cef40682b]::late::LateContextAndPass<rustc_lint[791f8e2cef40682b]::late::LateLintPassObjects> as rustc_hir[b6231e5dfc545669]::intravisit::Visitor>::visit_expr
40:     0x7fcfa0374b7c - <rustc_lint[791f8e2cef40682b]::late::LateContextAndPass<rustc_lint[791f8e2cef40682b]::late::LateLintPassObjects> as rustc_hir[b6231e5dfc545669]::intravisit::Visitor>::visit_nested_body
41:     0x7fcfa037503a - <rustc_lint[791f8e2cef40682b]::late::LateContextAndPass<rustc_lint[791f8e2cef40682b]::late::LateLintPassObjects> as rustc_hir[b6231e5dfc545669]::intravisit::Visitor>::visit_fn
42:     0x7fcfa0310f92 - rustc_hir[b6231e5dfc545669]::intravisit::walk_item::<rustc_lint[791f8e2cef40682b]::late::LateContextAndPass<rustc_lint[791f8e2cef40682b]::late::LateLintPassObjects>>
43:     0x7fcfa0373ce9 - <rustc_lint[791f8e2cef40682b]::late::LateContextAndPass<rustc_lint[791f8e2cef40682b]::late::LateLintPassObjects> as rustc_hir[b6231e5dfc545669]::intravisit::Visitor>::visit_nested_item
44:     0x7fcfa0310bb7 - rustc_hir[b6231e5dfc545669]::intravisit::walk_mod::<rustc_lint[791f8e2cef40682b]::late::LateContextAndPass<rustc_lint[791f8e2cef40682b]::late::LateLintPassObjects>>
45:     0x7fcfa03753dc - <rustc_lint[791f8e2cef40682b]::late::LateContextAndPass<rustc_lint[791f8e2cef40682b]::late::LateLintPassObjects> as rustc_hir[b6231e5dfc545669]::intravisit::Visitor>::visit_mod
46:     0x7fcfa0375b04 - rustc_lint[791f8e2cef40682b]::late::late_lint_pass_crate::<rustc_lint[791f8e2cef40682b]::late::LateLintPassObjects>
47:     0x7fcfa14f06f7 - <rustc_session[c20293ac279aad06]::session::Session>::time::<(), rustc_lint[791f8e2cef40682b]::late::check_crate<rustc_lint[791f8e2cef40682b]::BuiltinCombinedLateLintPass, rustc_interface[947fac54d3fe2868]::passes::analysis::{closure#5}::{closure#0}::{closure#3}::{closure#0}::{closure#0}>::{closure#0}::{closure#0}>
48:     0x7fcfa2159ae6 - <core[24291291a921b533]::panic::unwind_safe::AssertUnwindSafe<rustc_interface[947fac54d3fe2868]::passes::analysis::{closure#5}::{closure#0}::{closure#3}> as core[24291291a921b533]::ops::function::FnOnce<()>>::call_once
49:     0x7fcfa215b53e - <core[24291291a921b533]::panic::unwind_safe::AssertUnwindSafe<rustc_interface[947fac54d3fe2868]::passes::analysis::{closure#5}::{closure#0}> as core[24291291a921b533]::ops::function::FnOnce<()>>::call_once
50:     0x7fcfa2157948 - <rustc_session[c20293ac279aad06]::session::Session>::time::<(), rustc_interface[947fac54d3fe2868]::passes::analysis::{closure#5}>
51:     0x7fcfa2131ffc - rustc_interface[947fac54d3fe2868]::passes::analysis
52:     0x7fcfa25d6c05 - rustc_query_system[1b2734a6ce8acad3]::query::plumbing::try_execute_query::<rustc_query_impl[e097f5d713df899a]::plumbing::QueryCtxt, rustc_query_system[1b2734a6ce8acad3]::query::caches::DefaultCache<(), core[24291291a921b533]::result::Result<(), rustc_errors[62a5cc7b06393f71]::ErrorReported>>>
53:     0x7fcfa262fcf5 - rustc_query_system[1b2734a6ce8acad3]::query::plumbing::get_query::<rustc_query_impl[e097f5d713df899a]::queries::analysis, rustc_query_impl[e097f5d713df899a]::plumbing::QueryCtxt>
54:     0x7fcfa2112f30 - <rustc_interface[947fac54d3fe2868]::interface::Compiler>::enter::<rustc_driver[aab467f4c82ed6ad]::run_compiler::{closure#1}::{closure#2}, core[24291291a921b533]::result::Result<core[24291291a921b533]::option::Option<rustc_interface[947fac54d3fe2868]::queries::Linker>, rustc_errors[62a5cc7b06393f71]::ErrorReported>>
55:     0x7fcfa20f4c3c - rustc_span[5840c952fc6dfb1f]::with_source_map::<core[24291291a921b533]::result::Result<(), rustc_errors[62a5cc7b06393f71]::ErrorReported>, rustc_interface[947fac54d3fe2868]::interface::create_compiler_and_run<core[24291291a921b533]::result::Result<(), rustc_errors[62a5cc7b06393f71]::ErrorReported>, rustc_driver[aab467f4c82ed6ad]::run_compiler::{closure#1}>::{closure#1}>
56:     0x7fcfa211230e - rustc_interface[947fac54d3fe2868]::interface::create_compiler_and_run::<core[24291291a921b533]::result::Result<(), rustc_errors[62a5cc7b06393f71]::ErrorReported>, rustc_driver[aab467f4c82ed6ad]::run_compiler::{closure#1}>
57:     0x7fcfa20f619b - <scoped_tls[ec1705c99dfa8720]::ScopedKey<rustc_span[5840c952fc6dfb1f]::SessionGlobals>>::set::<rustc_interface[947fac54d3fe2868]::util::setup_callbacks_and_run_in_thread_pool_with_globals<rustc_interface[947fac54d3fe2868]::interface::run_compiler<core[24291291a921b533]::result::Result<(), rustc_errors[62a5cc7b06393f71]::ErrorReported>, rustc_driver[aab467f4c82ed6ad]::run_compiler::{closure#1}>::{closure#0}, core[24291291a921b533]::result::Result<(), rustc_errors[62a5cc7b06393f71]::ErrorReported>>::{closure#0}::{closure#0}, core[24291291a921b533]::result::Result<(), rustc_errors[62a5cc7b06393f71]::ErrorReported>>
58:     0x7fcfa20f5f95 - std[e740e8867e95a171]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[947fac54d3fe2868]::util::setup_callbacks_and_run_in_thread_pool_with_globals<rustc_interface[947fac54d3fe2868]::interface::run_compiler<core[24291291a921b533]::result::Result<(), rustc_errors[62a5cc7b06393f71]::ErrorReported>, rustc_driver[aab467f4c82ed6ad]::run_compiler::{closure#1}>::{closure#0}, core[24291291a921b533]::result::Result<(), rustc_errors[62a5cc7b06393f71]::ErrorReported>>::{closure#0}, core[24291291a921b533]::result::Result<(), rustc_errors[62a5cc7b06393f71]::ErrorReported>>
59:     0x7fcfa21228a9 - <<std[e740e8867e95a171]::thread::Builder>::spawn_unchecked<rustc_interface[947fac54d3fe2868]::util::setup_callbacks_and_run_in_thread_pool_with_globals<rustc_interface[947fac54d3fe2868]::interface::run_compiler<core[24291291a921b533]::result::Result<(), rustc_errors[62a5cc7b06393f71]::ErrorReported>, rustc_driver[aab467f4c82ed6ad]::run_compiler::{closure#1}>::{closure#0}, core[24291291a921b533]::result::Result<(), rustc_errors[62a5cc7b06393f71]::ErrorReported>>::{closure#0}, core[24291291a921b533]::result::Result<(), rustc_errors[62a5cc7b06393f71]::ErrorReported>>::{closure#1} as core[24291291a921b533]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
60:     0x7fcf9faa0cf3 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h9a9713b5d2e24fc2
                             at /rustc/e012a191d768adeda1ee36a99ef8b92d51920154/library/alloc/src/boxed.rs:1854:9
61:     0x7fcf9faa0cf3 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h9651309876a3c2bf
                             at /rustc/e012a191d768adeda1ee36a99ef8b92d51920154/library/alloc/src/boxed.rs:1854:9
62:     0x7fcf9faa0cf3 - std::sys::unix::thread::Thread::new::thread_start::h8f346e0de1984669
                             at /rustc/e012a191d768adeda1ee36a99ef8b92d51920154/library/std/src/sys/unix/thread.rs:108:17
63:     0x7fcf9f993259 - start_thread
64:     0x7fcf9f7765e3 - __GI___clone
65:                0x0 - <unknown>

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust-clippy/issues/new

note: Clippy version: clippy 0.1.59 (e012a19 2022-01-06)

query stack during panic:
#0 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to previous error

@matthiaskrgr matthiaskrgr added C-bug Category: Clippy is not doing the correct thing I-ICE Issue: Clippy panicked, giving an Internal Compilation Error (ICE) ❄️ labels Jan 8, 2022
matthiaskrgr added a commit to matthiaskrgr/rust-clippy that referenced this issue Jul 10, 2022
@matthiaskrgr
Copy link
Member Author

Fixed by #8913

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: Clippy is not doing the correct thing I-ICE Issue: Clippy panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant