Skip to content
New issue

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

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

Already on GitHub? # to your account

[ICE] librustc_traits/normalize_erasing_regions.rs:46: could not fully normalize ... #49685

Closed
uhyo opened this issue Apr 5, 2018 · 5 comments
Assignees
Labels
A-impl-trait Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch. C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-high High priority regression-from-stable-to-beta Performance or correctness regression from stable to beta. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Milestone

Comments

@uhyo
Copy link

uhyo commented Apr 5, 2018

rustc version:

$ rustc --version --verbose
rustc 1.27.0-nightly (fb44b4c0e 2018-04-04)
binary: rustc
commit-hash: fb44b4c0eb1d344f84f7bb2c90f28e31a8a180be
commit-date: 2018-04-04
host: x86_64-unknown-linux-gnu
release: 1.27.0-nightly
LLVM version: 6.0

code:

fn main() {                                                                                                 
    let _ =                                                                                                 
        Some(())                                                                                            
        .into_iter()                                                                                        
        .flat_map(|_| {                                                                                     
            Some(())                                                                                        
                .into_iter()                                                                                
                .flat_map(func)                                                                             
        });                                                                                                 
}                                                                                                           
                                                                                                            
fn func(_: ()) -> impl Iterator<Item=()> {                                                                  
    Some(()).into_iter().flat_map(|_| vec![])                                                               
}  

error message:

~/rust/ice $ RUST_BACKTRACE=1 rustc test.rs 
error: internal compiler error: librustc_traits/normalize_erasing_regions.rs:46: could not fully normalize `std::iter::FlattenCompat<std::iter::Map<std::option::IntoIter<()>, [closure@test.rs:5:19: 9:10]>, <std::iter::FlatMap<std::option::IntoIter<()>, std::iter::FlatMap<std::option::IntoIter<()>, std::vec::Vec<()>, [closure@test.rs:13:35: 13:45]>, fn(()) -> impl std::iter::Iterator {func}> as std::iter::IntoIterator>::IntoIter>`

thread 'main' panicked at 'Box<Any>', librustc_errors/lib.rs:543:9
stack backtrace:
   0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
             at libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
   1: std::sys_common::backtrace::print
             at libstd/sys_common/backtrace.rs:71
             at libstd/sys_common/backtrace.rs:59
   2: std::panicking::default_hook::{{closure}}
             at libstd/panicking.rs:207
   3: std::panicking::default_hook
             at libstd/panicking.rs:223
   4: core::ops::function::Fn::call
   5: std::panicking::rust_panic_with_hook
             at libstd/panicking.rs:403
   6: std::panicking::begin_panic
   7: rustc_errors::Handler::bug
   8: rustc::session::opt_span_bug_fmt::{{closure}}
   9: rustc::ty::context::tls::with_opt::{{closure}}
  10: <std::thread::local::LocalKey<T>>::try_with
  11: <std::thread::local::LocalKey<T>>::with
  12: rustc::ty::context::tls::with
  13: rustc::ty::context::tls::with_opt
  14: rustc::session::opt_span_bug_fmt
  15: rustc::session::bug_fmt
  16: rustc::ty::context::tls::enter
  17: rustc_traits::normalize_erasing_regions::normalize_ty_after_erasing_regions
  18: rustc::ty::maps::<impl rustc::ty::maps::queries::normalize_ty_after_erasing_regions<'tcx>>::compute_result
  19: rustc::dep_graph::graph::DepGraph::with_task_impl
  20: rustc_errors::Handler::track_diagnostics
  21: rustc::ty::maps::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::cycle_check
  22: rustc::ty::maps::<impl rustc::ty::maps::queries::normalize_ty_after_erasing_regions<'tcx>>::force
  23: rustc::ty::maps::<impl rustc::ty::maps::queries::normalize_ty_after_erasing_regions<'tcx>>::try_get
  24: rustc::ty::maps::TyCtxtAt::normalize_ty_after_erasing_regions
  25: <rustc::traits::query::normalize_erasing_regions::NormalizeAfterErasingRegionsFolder<'cx, 'tcx> as rustc::ty::fold::TypeFolder<'tcx, 'tcx>>::fold_ty
  26: core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &'a mut F>::call_once
  27: <alloc::vec::Vec<T> as alloc::vec::SpecExtend<T, I>>::from_iter
  28: <rustc_mir::util::elaborate_drops::DropCtxt<'l, 'b, 'tcx, D>>::elaborate_drop
  29: rustc_mir::shim::make_shim
  30: rustc::ty::maps::<impl rustc::ty::maps::queries::mir_shims<'tcx>>::compute_result
  31: rustc::dep_graph::graph::DepGraph::with_task_impl
  32: rustc_errors::Handler::track_diagnostics
  33: rustc::ty::maps::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::cycle_check
  34: rustc::ty::maps::<impl rustc::ty::maps::queries::mir_shims<'tcx>>::force
  35: rustc::ty::maps::<impl rustc::ty::maps::queries::mir_shims<'tcx>>::try_get
  36: rustc::ty::maps::TyCtxtAt::mir_shims
  37: rustc::ty::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::instance_mir
  38: rustc_mir::monomorphize::collector::collect_items_rec
  39: rustc_mir::monomorphize::collector::collect_items_rec
  40: rustc_mir::monomorphize::collector::collect_crate_mono_items
  41: rustc::util::common::time
  42: rustc_trans::base::collect_and_partition_translation_items
  43: rustc::dep_graph::graph::DepGraph::with_task_impl
  44: rustc_errors::Handler::track_diagnostics
  45: rustc::ty::maps::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::cycle_check
  46: rustc::ty::maps::<impl rustc::ty::maps::queries::collect_and_partition_translation_items<'tcx>>::force
  47: rustc::ty::maps::<impl rustc::ty::maps::queries::collect_and_partition_translation_items<'tcx>>::try_get
  48: rustc::ty::maps::TyCtxtAt::collect_and_partition_translation_items
  49: rustc::ty::maps::<impl rustc::ty::context::TyCtxt<'a, 'tcx, 'lcx>>::collect_and_partition_translation_items
  50: rustc_trans::base::trans_crate
  51: <rustc_trans::LlvmTransCrate as rustc_trans_utils::trans_crate::TransCrate>::trans_crate
  52: rustc::util::common::time
  53: rustc_driver::driver::phase_4_translate_to_llvm
  54: rustc_driver::driver::compile_input::{{closure}}
  55: <std::thread::local::LocalKey<T>>::with
  56: <std::thread::local::LocalKey<T>>::with
  57: rustc::ty::context::TyCtxt::create_and_enter
  58: rustc_driver::driver::compile_input
  59: rustc_driver::run_compiler_impl
  60: syntax::with_globals
  61: rustc_driver::run
  62: rustc_driver::main
  63: std::rt::lang_start::{{closure}}
  64: std::panicking::try::do_call
             at libstd/rt.rs:59
             at libstd/panicking.rs:306
  65: __rust_maybe_catch_panic
             at libpanic_unwind/lib.rs:102
  66: std::rt::lang_start_internal
             at libstd/panicking.rs:285
             at libstd/panic.rs:361
             at libstd/rt.rs:58
  67: main
  68: __libc_start_main
  69: <unknown>
error: aborting due to previous error
@renato-zannon
Copy link
Contributor

renato-zannon commented Apr 9, 2018

I have hit this while using beta:

rustc 1.26.0-beta.2 (0e350672e 2018-04-05)
binary: rustc
commit-hash: 0e350672e1ffc1b046463e2267465d08c522b736
commit-date: 2018-04-05
host: x86_64-unknown-linux-gnu
release: 1.26.0-beta.2
LLVM version: 6.0

@pietroalbini pietroalbini added I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ I-nominated T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. regression-from-stable-to-beta Performance or correctness regression from stable to beta. A-impl-trait Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch. C-bug Category: This is a bug. labels Apr 17, 2018
@pietroalbini pietroalbini added this to the 1.26 milestone Apr 17, 2018
@pietroalbini
Copy link
Member

pietroalbini commented Apr 17, 2018

Thanks for reporting this! This indeed affects beta and was not present when stable cut off.

@pietroalbini
Copy link
Member

A bisect reported #48411 as the source of the regression. cc @nikomatsakis @eddyb

@pietroalbini
Copy link
Member

Ping @nikomatsakis @eddyb

@nikomatsakis
Copy link
Contributor

triage: P-high

@nikomatsakis nikomatsakis self-assigned this Apr 26, 2018
@nikomatsakis nikomatsakis added P-high High priority and removed I-nominated labels Apr 26, 2018
bors added a commit that referenced this issue Apr 26, 2018
drop elaboration should reveal all

This used to happen implicitly through the normalization function; but we now keep the param-env as is, which seems less surprising.

cc #49685

r? @eddyb
@bors bors closed this as completed in 86e9a7a Apr 27, 2018
pietroalbini pushed a commit to pietroalbini/rust that referenced this issue Apr 27, 2018
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
A-impl-trait Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch. C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-high High priority regression-from-stable-to-beta Performance or correctness regression from stable to beta. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

4 participants