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

Nightly rustc crashes with "unexpected region in query response" #57464

Closed
LegNeato opened this issue Jan 9, 2019 · 20 comments · Fixed by #60449
Closed

Nightly rustc crashes with "unexpected region in query response" #57464

LegNeato opened this issue Jan 9, 2019 · 20 comments · Fixed by #60449
Assignees
Labels
A-impl-trait Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-high High priority regression-from-stable-to-stable Performance or correctness regression from one stable version to another. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@LegNeato
Copy link
Contributor

LegNeato commented Jan 9, 2019

Update: Reduced test case in below comment


Just got this rustc crash in juniper_hyper in CI running cargo test:

error: internal compiler error: src/librustc/infer/canonical/canonicalizer.rs:194: unexpected region in query response: `ReScope(Node(238))`
2019-01-09T07:10:29.1360436Z 
2019-01-09T07:10:29.1361373Z thread 'rustc' panicked at 'Box<Any>', src/librustc_errors/lib.rs:590:9
2019-01-09T07:10:29.5952924Z note: rustc 1.33.0-nightly (d22fa2d87 2019-01-08) running on x86_64-unknown-linux-gnu
2019-01-09T07:10:29.5952971Z 
2019-01-09T07:10:29.5953221Z note: compiler flags: -C debuginfo=2 -C incremental

Full Backtrace:

2019-01-09T07:10:29.1359447Z error: internal compiler error: src/librustc/infer/canonical/canonicalizer.rs:194: unexpected region in query response: `ReScope(Node(238))` 2019-01-09T07:10:29.1360436Z 2019-01-09T07:10:29.1361373Z thread 'rustc' panicked at 'Box', src/librustc_errors/lib.rs:590:9 2019-01-09T07:10:29.1361759Z stack backtrace: 2019-01-09T07:10:29.3044175Z 0: 0x7faf81185633 - std::sys::unix::backtrace::tracing::imp::unwind_backtrace::h27fa36261e6c0e63 2019-01-09T07:10:29.3115220Z at src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:39 2019-01-09T07:10:29.3117735Z 1: 0x7faf8117dc98 - std::sys_common::backtrace::_print::h83d70a6b41e54a96 2019-01-09T07:10:29.3119788Z at src/libstd/sys_common/backtrace.rs:70 2019-01-09T07:10:29.3123029Z 2: 0x7faf811817c2 - std::panicking::default_hook::{{closure}}::h737fa74ccb8187d6 2019-01-09T07:10:29.3124252Z at src/libstd/sys_common/backtrace.rs:58 2019-01-09T07:10:29.3125927Z at src/libstd/panicking.rs:200 2019-01-09T07:10:29.3127692Z 3: 0x7faf81181534 - std::panicking::default_hook::h95b33c1859e68c42 2019-01-09T07:10:29.3129344Z at src/libstd/panicking.rs:215 2019-01-09T07:10:29.3131572Z 4: 0x7faf7cc44fbf - rustc::util::common::panic_hook::hc3b5de1afa219d3e 2019-01-09T07:10:29.3133377Z 5: 0x7faf81181fa9 - std::panicking::rust_panic_with_hook::h99028c1ffb70ec6c 2019-01-09T07:10:29.3136009Z at src/libstd/panicking.rs:482 2019-01-09T07:10:29.3139012Z 6: 0x7faf7ba5b54c - std::panicking::begin_panic::ha8fb39166559f6fc 2019-01-09T07:10:29.3142270Z 7: 0x7faf7ba7a2ee - rustc_errors::Handler::bug::h52124d7aeb9c7fd4 2019-01-09T07:10:29.3145394Z 8: 0x7faf7c97055e - rustc::util::bug::opt_span_bug_fmt::{{closure}}::h2b9fc57d0a0effa1 2019-01-09T07:10:29.3148429Z 9: 0x7faf7c96e5a9 - rustc::ty::context::tls::with_opt::{{closure}}::h876699748b23fd1a 2019-01-09T07:10:29.3151984Z 10: 0x7faf7c96e4c4 - rustc::ty::context::tls::with_context_opt::h08fd1b14b9b37bad 2019-01-09T07:10:29.3154978Z 11: 0x7faf7c96e556 - rustc::ty::context::tls::with_opt::h031bc85f74c8b5f5 2019-01-09T07:10:29.3157599Z 12: 0x7faf7c970464 - rustc::util::bug::opt_span_bug_fmt::h9ac97a87949dcc1f 2019-01-09T07:10:29.3161160Z 13: 0x7faf7c9703d6 - rustc::util::bug::bug_fmt::ha46366496e812bc3 2019-01-09T07:10:29.3165421Z 14: 0x7faf7cdb2e9e - ::canonicalize_free_region::hb20855203554b141 2019-01-09T07:10:29.3170834Z 15: 0x7faf804ae1e2 - as rustc::ty::fold::TypeFolder<'gcx, 'tcx>>::fold_binder::hc9c87ea23c310a6d 2019-01-09T07:10:29.3174012Z 16: 0x7faf804a3d3f - rustc::ty::fold::TypeFoldable::fold_with::h7e3b766f2010c13a 2019-01-09T07:10:29.3176837Z 17: 0x7faf804b6073 - rustc::infer::canonical::canonicalizer::Canonicalizer::canonicalize::h94c8b15ec82441c4 2019-01-09T07:10:29.3181331Z 18: 0x7faf8042a6d3 - rustc::infer::canonical::query_response::>::make_canonicalized_query_response::h5fd5664469b4f467 2019-01-09T07:10:29.3184298Z 19: 0x7faf80492cd7 - rustc::ty::context::GlobalCtxt::enter_local::h1f55605a2fa570c8 2019-01-09T07:10:29.3187081Z 20: 0x7faf804c5ae2 - rustc_traits::type_op::type_op_prove_predicate::hac79da90828ae7f1 2019-01-09T07:10:29.3190930Z 21: 0x7faf7c73670f - rustc::ty::query::__query_compute::type_op_prove_predicate::h7882d718114c6595 2019-01-09T07:10:29.3195724Z 22: 0x7faf7cb9d510 - rustc::ty::query:: for rustc::ty::query::queries::type_op_prove_predicate<'tcx>>::compute::ha0a22e439c583e0c 2019-01-09T07:10:29.3198480Z 23: 0x7faf7c81be7d - rustc::dep_graph::graph::DepGraph::with_task_impl::hfa60f5e02294bab2 2019-01-09T07:10:29.3203489Z 24: 0x7faf7c9c8cf2 - rustc::ty::query::plumbing::>::try_get_with::h1f97e191d0c8020c 2019-01-09T07:10:29.3207571Z 25: 0x7faf7c964b41 - as rustc::traits::query::type_op::QueryTypeOp<'gcx, 'tcx>>::perform_query::h14af7bf1a4623951 2019-01-09T07:10:29.3211249Z 26: 0x7faf7d6960cf - rustc::traits::query::type_op::QueryTypeOp::fully_perform_into::h872744c4a3994a98 2019-01-09T07:10:29.3215748Z 27: 0x7faf7d824537 - as rustc::traits::query::type_op::TypeOp<'gcx, 'tcx>>::fully_perform::h3e366726f127bd41 2019-01-09T07:10:29.3219338Z 28: 0x7faf7d6ab75c - rustc_mir::borrow_check::nll::type_check::TypeChecker::prove_predicate::hb7ef6ce272275f2e 2019-01-09T07:10:29.3222696Z 29: 0x7faf7d6aa2ce - rustc_mir::borrow_check::nll::type_check::TypeChecker::check_stmt::h1ee6c6f7393dbb48 2019-01-09T07:10:29.3225633Z 30: 0x7faf7d6abc6c - rustc_mir::borrow_check::nll::type_check::TypeChecker::typeck_mir::h29dbb0a4198dfa55 2019-01-09T07:10:29.3229142Z 31: 0x7faf7d6a1dd2 - rustc_mir::borrow_check::nll::type_check::type_check_internal::hffa4ef19a1580b02 2019-01-09T07:10:29.3232380Z 32: 0x7faf7d616bda - rustc::ty::context::GlobalCtxt::enter_local::h2a8d3ec35b4f82ce 2019-01-09T07:10:29.3235610Z 33: 0x7faf7d6af97b - ::run_pass::h2f175b6bc17f76c6 2019-01-09T07:10:29.3239999Z 34: 0x7faf7d70621a - rustc_mir::transform::run_passes::{{closure}}::h519bb7163684e841 2019-01-09T07:10:29.3243916Z 35: 0x7faf7d705ed9 - rustc_mir::transform::run_passes::ha3cc06ce83f98300 2019-01-09T07:10:29.3248221Z 36: 0x7faf7d706603 - rustc_mir::transform::mir_const::he9f9e4792f0fd52c 2019-01-09T07:10:29.3252418Z 37: 0x7faf7d7c25bc - rustc::ty::query::__query_compute::mir_const::h4a18e1bad2c2cd20 2019-01-09T07:10:29.3257572Z 38: 0x7faf7d588a9c - rustc::ty::query:: for rustc::ty::query::queries::mir_const<'tcx>>::compute::h11b8ce581ca21481 2019-01-09T07:10:29.3261743Z 39: 0x7faf7d8c7333 - rustc::dep_graph::graph::DepGraph::with_task_impl::hc2d1738bc17dffea 2019-01-09T07:10:29.3266580Z 40: 0x7faf7d5c3937 - rustc::ty::query::plumbing::>::try_get_with::h8be6d20eace6785b 2019-01-09T07:10:29.3275198Z 41: 0x7faf7d70681d - rustc_mir::transform::mir_validated::hf49c21f9e6f17ece 2019-01-09T07:10:29.3282827Z 42: 0x7faf7d7bfd3c - rustc::ty::query::__query_compute::mir_validated::h134b798c5daffd05 2019-01-09T07:10:29.3287818Z 43: 0x7faf7d588cec - rustc::ty::query:: for rustc::ty::query::queries::mir_validated<'tcx>>::compute::h35a85da1fde27e28 2019-01-09T07:10:29.3292236Z 44: 0x7faf7d8c7333 - rustc::dep_graph::graph::DepGraph::with_task_impl::hc2d1738bc17dffea 2019-01-09T07:10:29.3296618Z 45: 0x7faf7d5e08a7 - rustc::ty::query::plumbing::>::try_get_with::haa63274f42abed8b 2019-01-09T07:10:29.3300480Z 46: 0x7faf7d80e484 - rustc_mir::borrow_check::mir_borrowck::h9ccb54a927514fa9 2019-01-09T07:10:29.3304384Z 47: 0x7faf7d7bfb43 - rustc::ty::query::__query_compute::mir_borrowck::hc72c7cdf2f3ee3df 2019-01-09T07:10:29.3310471Z 48: 0x7faf7d588c94 - rustc::ty::query:: for rustc::ty::query::queries::mir_borrowck<'tcx>>::compute::h671d21d87040d722 2019-01-09T07:10:29.3314354Z 49: 0x7faf7d8cab20 - rustc::dep_graph::graph::DepGraph::with_task_impl::hf50fbb2327d62dfd 2019-01-09T07:10:29.3319379Z 50: 0x7faf7d5f1266 - rustc::ty::query::plumbing::>::try_get_with::hd2829b231b0df250 2019-01-09T07:10:29.3323594Z 51: 0x7faf7d6a7d8f - rustc_mir::borrow_check::nll::type_check::TypeChecker::check_stmt::h1ee6c6f7393dbb48 2019-01-09T07:10:29.3327074Z 52: 0x7faf7d6abc6c - rustc_mir::borrow_check::nll::type_check::TypeChecker::typeck_mir::h29dbb0a4198dfa55 2019-01-09T07:10:29.3331189Z 53: 0x7faf7d6a1dd2 - rustc_mir::borrow_check::nll::type_check::type_check_internal::hffa4ef19a1580b02 2019-01-09T07:10:29.3335299Z 54: 0x7faf7d616bda - rustc::ty::context::GlobalCtxt::enter_local::h2a8d3ec35b4f82ce 2019-01-09T07:10:29.3340076Z 55: 0x7faf7d6af97b - ::run_pass::h2f175b6bc17f76c6 2019-01-09T07:10:29.3344116Z 56: 0x7faf7d70621a - rustc_mir::transform::run_passes::{{closure}}::h519bb7163684e841 2019-01-09T07:10:29.3347311Z 57: 0x7faf7d705ed9 - rustc_mir::transform::run_passes::ha3cc06ce83f98300 2019-01-09T07:10:29.3351202Z 58: 0x7faf7d706603 - rustc_mir::transform::mir_const::he9f9e4792f0fd52c 2019-01-09T07:10:29.3354882Z 59: 0x7faf7d7c25bc - rustc::ty::query::__query_compute::mir_const::h4a18e1bad2c2cd20 2019-01-09T07:10:29.3359821Z 60: 0x7faf7d588a9c - rustc::ty::query:: for rustc::ty::query::queries::mir_const<'tcx>>::compute::h11b8ce581ca21481 2019-01-09T07:10:29.3363068Z 61: 0x7faf7d8c7333 - rustc::dep_graph::graph::DepGraph::with_task_impl::hc2d1738bc17dffea 2019-01-09T07:10:29.3366918Z 62: 0x7faf7d5c3937 - rustc::ty::query::plumbing::>::try_get_with::h8be6d20eace6785b 2019-01-09T07:10:29.3370839Z 63: 0x7faf7d70681d - rustc_mir::transform::mir_validated::hf49c21f9e6f17ece 2019-01-09T07:10:29.3373993Z 64: 0x7faf7d7bfd3c - rustc::ty::query::__query_compute::mir_validated::h134b798c5daffd05 2019-01-09T07:10:29.3378121Z 65: 0x7faf7d588cec - rustc::ty::query:: for rustc::ty::query::queries::mir_validated<'tcx>>::compute::h35a85da1fde27e28 2019-01-09T07:10:29.3381634Z 66: 0x7faf7d8c7333 - rustc::dep_graph::graph::DepGraph::with_task_impl::hc2d1738bc17dffea 2019-01-09T07:10:29.3385804Z 67: 0x7faf7d5e08a7 - rustc::ty::query::plumbing::>::try_get_with::haa63274f42abed8b 2019-01-09T07:10:29.3388374Z 68: 0x7faf7d80e484 - rustc_mir::borrow_check::mir_borrowck::h9ccb54a927514fa9 2019-01-09T07:10:29.3391777Z 69: 0x7faf7d7bfb43 - rustc::ty::query::__query_compute::mir_borrowck::hc72c7cdf2f3ee3df 2019-01-09T07:10:29.3396214Z 70: 0x7faf7d588c94 - rustc::ty::query:: for rustc::ty::query::queries::mir_borrowck<'tcx>>::compute::h671d21d87040d722 2019-01-09T07:10:29.3399705Z 71: 0x7faf7d8cab20 - rustc::dep_graph::graph::DepGraph::with_task_impl::hf50fbb2327d62dfd 2019-01-09T07:10:29.3404136Z 72: 0x7faf7d5f1266 - rustc::ty::query::plumbing::>::try_get_with::hd2829b231b0df250 2019-01-09T07:10:29.3407046Z 73: 0x7faf7d6a7d8f - rustc_mir::borrow_check::nll::type_check::TypeChecker::check_stmt::h1ee6c6f7393dbb48 2019-01-09T07:10:29.3410534Z 74: 0x7faf7d6abc6c - rustc_mir::borrow_check::nll::type_check::TypeChecker::typeck_mir::h29dbb0a4198dfa55 2019-01-09T07:10:29.3413827Z 75: 0x7faf7d6a1dd2 - rustc_mir::borrow_check::nll::type_check::type_check_internal::hffa4ef19a1580b02 2019-01-09T07:10:29.3417156Z 76: 0x7faf7d616bda - rustc::ty::context::GlobalCtxt::enter_local::h2a8d3ec35b4f82ce 2019-01-09T07:10:29.3421291Z 77: 0x7faf7d6af97b - ::run_pass::h2f175b6bc17f76c6 2019-01-09T07:10:29.3424836Z 78: 0x7faf7d70621a - rustc_mir::transform::run_passes::{{closure}}::h519bb7163684e841 2019-01-09T07:10:29.3427813Z 79: 0x7faf7d705ed9 - rustc_mir::transform::run_passes::ha3cc06ce83f98300 2019-01-09T07:10:29.3431430Z 80: 0x7faf7d706603 - rustc_mir::transform::mir_const::he9f9e4792f0fd52c 2019-01-09T07:10:29.3434507Z 81: 0x7faf7d7c25bc - rustc::ty::query::__query_compute::mir_const::h4a18e1bad2c2cd20 2019-01-09T07:10:29.3439380Z 82: 0x7faf7d588a9c - rustc::ty::query:: for rustc::ty::query::queries::mir_const<'tcx>>::compute::h11b8ce581ca21481 2019-01-09T07:10:29.3442924Z 83: 0x7faf7d8c7333 - rustc::dep_graph::graph::DepGraph::with_task_impl::hc2d1738bc17dffea 2019-01-09T07:10:29.3447408Z 84: 0x7faf7d5c3937 - rustc::ty::query::plumbing::>::try_get_with::h8be6d20eace6785b 2019-01-09T07:10:29.3451213Z 85: 0x7faf7d70681d - rustc_mir::transform::mir_validated::hf49c21f9e6f17ece 2019-01-09T07:10:29.3455845Z 86: 0x7faf7cb9bfac - rustc::ty::query:: for rustc::ty::query::queries::mir_validated<'tcx>>::compute::h35a85da1fde27e28 2019-01-09T07:10:29.3459226Z 87: 0x7faf7c7e82f6 - rustc::dep_graph::graph::DepGraph::with_task_impl::h3b820c9594b2cec0 2019-01-09T07:10:29.3463568Z 88: 0x7faf7c9b1a7b - rustc::ty::query::plumbing::>::try_get_with::h115c183808c121a5 2019-01-09T07:10:29.3467590Z 89: 0x7faf7caf16dc - rustc::ty::query::plumbing::>::ensure_query::h1eb3b1bdb1673ac8 2019-01-09T07:10:29.3471028Z 90: 0x7faf7ddb3bc5 - rustc_borrowck::borrowck::borrowck::hfe7e7029a4f8860a 2019-01-09T07:10:29.3474346Z 91: 0x7faf7dd833cc - rustc::ty::query::__query_compute::borrowck::hd756d7f12d24fe3c 2019-01-09T07:10:29.3479197Z 92: 0x7faf7dd8d37c - rustc::ty::query:: for rustc::ty::query::queries::borrowck<'tcx>>::compute::h9fdf8c53c24da732 2019-01-09T07:10:29.3482921Z 93: 0x7faf7dd85aab - rustc::dep_graph::graph::DepGraph::with_task_impl::h835f89accfc9d52d 2019-01-09T07:10:29.3487496Z 94: 0x7faf7dd8f9d4 - rustc::ty::query::plumbing::>::try_get_with::h20bbb6fc8beccebc 2019-01-09T07:10:29.3504076Z 95: 0x7faf7dd98381 - rustc::ty::>::par_body_owners::h39e78c11d92c15e8 2019-01-09T07:10:29.3509043Z 96: 0x7faf7ddb3977 - rustc_borrowck::borrowck::check_crate::hbede2c1b6a8ef496 2019-01-09T07:10:29.3511820Z 97: 0x7faf814e7f81 - rustc::util::common::time::haff8156274509ff5 2019-01-09T07:10:29.3514171Z 98: 0x7faf8152e485 - >::with::ha529ac533f89a17f 2019-01-09T07:10:29.3516396Z 99: 0x7faf814edb46 - rustc_driver::driver::compile_input::had70b272120da9cf 2019-01-09T07:10:29.3518224Z query stack during panic: 2019-01-09T07:10:29.3521356Z #0 [type_op_prove_predicate] evaluating `type_op_prove_predicate` `Canonical { max_universe: U0, variables: [], value: ParamEnvAnd { param_env: ParamEnv { caller_bounds: [], reveal: UserFacing, def_id: None }, value: ProvePredicate { predicate: Binder(TraitPredicate( as std::ops::CoerceUnsized, Error=hyper::Error> + std::marker::Send + 'static)>>>)) } } }` 2019-01-09T07:10:29.3523696Z #1 [mir_const] processing `main::{{closure}}::{{closure}}` 2019-01-09T07:10:29.3525416Z #2 [mir_validated] processing `main::{{closure}}::{{closure}}` 2019-01-09T07:10:29.3527141Z #3 [mir_borrowck] processing `main::{{closure}}::{{closure}}` 2019-01-09T07:10:29.3529430Z #4 [mir_const] processing `main::{{closure}}` 2019-01-09T07:10:29.3531436Z #5 [mir_validated] processing `main::{{closure}}` 2019-01-09T07:10:29.3533438Z #6 [mir_borrowck] processing `main::{{closure}}` 2019-01-09T07:10:29.3535150Z #7 [mir_const] processing `main` 2019-01-09T07:10:29.3536845Z #8 [mir_validated] processing `main` 2019-01-09T07:10:29.3539025Z #9 [borrowck] processing `main` 2019-01-09T07:10:29.3540875Z end of query stack 2019-01-09T07:10:29.3581342Z error: aborting due to previous error 2019-01-09T07:10:29.3583496Z 2019-01-09T07:10:29.3628291Z 2019-01-09T07:10:29.3630438Z note: the compiler unexpectedly panicked. this is a bug. 2019-01-09T07:10:29.3630666Z 2019-01-09T07:10:29.3631276Z note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports 2019-01-09T07:10:29.3631460Z 2019-01-09T07:10:29.3631907Z note: rustc 1.33.0-nightly (d22fa2d 2019-01-08) running on x86_64-unknown-linux-gnu 2019-01-09T07:10:29.3632241Z 2019-01-09T07:10:29.3632577Z note: compiler flags: -C debuginfo=2 -C incremental --crate-type bin 2019-01-09T07:10:29.3632771Z 2019-01-09T07:10:29.3632983Z note: some of the compiler flags provided by cargo are hidden 2019-01-09T07:10:29.3633054Z 2019-01-09T07:10:29.3667450Z error: Could not compile `juniper_hyper`. 2019-01-09T07:10:29.3667734Z 2019-01-09T07:10:29.3667928Z Caused by: 2019-01-09T07:10:29.3670723Z process didn't exit successfully: `rustc --crate-name hyper_server juniper_hyper/examples/hyper_server.rs --color never --crate-type bin --emit=dep-info,link -C debuginfo=2 -C metadata=6b12f7a0887e3a8d -C extra-filename=-6b12f7a0887e3a8d --out-dir /home/vsts/work/1/s/target/debug/examples -C incremental=/home/vsts/work/1/s/target/debug/incremental -L dependency=/home/vsts/work/1/s/target/debug/deps --extern futures=/home/vsts/work/1/s/target/debug/deps/libfutures-5cd4327faadf55f0.rlib --extern hyper=/home/vsts/work/1/s/target/debug/deps/libhyper-6bec956c16d964f9.rlib --extern juniper=/home/vsts/work/1/s/target/debug/deps/libjuniper-2f7cc4460538f027.rlib --extern juniper_hyper=/home/vsts/work/1/s/target/debug/deps/libjuniper_hyper-92945c3694483f62.rlib --extern pretty_env_logger=/home/vsts/work/1/s/target/debug/deps/libpretty_env_logger-182ddd40e8d0b39b.rlib --extern reqwest=/home/vsts/work/1/s/target/debug/deps/libreqwest-535d97eaa258aefe.rlib --extern serde=/home/vsts/work/1/s/target/debug/deps/libserde-79f268707972a3cf.rlib --extern serde_derive=/home/vsts/work/1/s/target/debug/deps/libserde_derive-40b3bc7312dcacaf.so --extern serde_json=/home/vsts/work/1/s/target/debug/deps/libserde_json-f22e6a35b9227ddc.rlib --extern tokio=/home/vsts/work/1/s/target/debug/deps/libtokio-4c1190750bfcadcb.rlib --extern tokio_threadpool=/home/vsts/work/1/s/target/debug/deps/libtokio_threadpool-84a88356c413a7ec.rlib --extern url=/home/vsts/work/1/s/target/debug/deps/liburl-d8efd7c34c11e8ca.rlib -L native=/home/vsts/work/1/s/target/debug/build/backtrace-sys-94691567e42eae9a/out` (exit code: 101) 2019-01-09T07:10:29.3671404Z warning: build failed, waiting for other jobs to finish... 2019-01-09T07:10:29.4097253Z error: internal compiler error: src/librustc/infer/canonical/canonicalizer.rs:194: unexpected region in query response: `ReScope(Node(238))` 2019-01-09T07:10:29.4098388Z 2019-01-09T07:10:29.4099563Z thread 'rustc' panicked at 'Box', src/librustc_errors/lib.rs:590:9 2019-01-09T07:10:29.4099927Z stack backtrace: 2019-01-09T07:10:29.5720141Z 0: 0x7fc92e77a633 - std::sys::unix::backtrace::tracing::imp::unwind_backtrace::h27fa36261e6c0e63 2019-01-09T07:10:29.5808741Z at src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:39 2019-01-09T07:10:29.5810340Z 1: 0x7fc92e772c98 - std::sys_common::backtrace::_print::h83d70a6b41e54a96 2019-01-09T07:10:29.5813335Z at src/libstd/sys_common/backtrace.rs:70 2019-01-09T07:10:29.5814094Z 2: 0x7fc92e7767c2 - std::panicking::default_hook::{{closure}}::h737fa74ccb8187d6 2019-01-09T07:10:29.5816364Z at src/libstd/sys_common/backtrace.rs:58 2019-01-09T07:10:29.5820203Z at src/libstd/panicking.rs:200 2019-01-09T07:10:29.5822572Z 3: 0x7fc92e776534 - std::panicking::default_hook::h95b33c1859e68c42 2019-01-09T07:10:29.5825233Z at src/libstd/panicking.rs:215 2019-01-09T07:10:29.5826981Z 4: 0x7fc92a239fbf - rustc::util::common::panic_hook::hc3b5de1afa219d3e 2019-01-09T07:10:29.5827746Z 5: 0x7fc92e776fa9 - std::panicking::rust_panic_with_hook::h99028c1ffb70ec6c 2019-01-09T07:10:29.5828015Z at src/libstd/panicking.rs:482 2019-01-09T07:10:29.5828880Z 6: 0x7fc92905054c - std::panicking::begin_panic::ha8fb39166559f6fc 2019-01-09T07:10:29.5829529Z 7: 0x7fc92906f2ee - rustc_errors::Handler::bug::h52124d7aeb9c7fd4 2019-01-09T07:10:29.5830056Z 8: 0x7fc929f6555e - rustc::util::bug::opt_span_bug_fmt::{{closure}}::h2b9fc57d0a0effa1 2019-01-09T07:10:29.5830570Z 9: 0x7fc929f635a9 - rustc::ty::context::tls::with_opt::{{closure}}::h876699748b23fd1a 2019-01-09T07:10:29.5831149Z 10: 0x7fc929f634c4 - rustc::ty::context::tls::with_context_opt::h08fd1b14b9b37bad 2019-01-09T07:10:29.5831649Z 11: 0x7fc929f63556 - rustc::ty::context::tls::with_opt::h031bc85f74c8b5f5 2019-01-09T07:10:29.5832281Z 12: 0x7fc929f65464 - rustc::util::bug::opt_span_bug_fmt::h9ac97a87949dcc1f 2019-01-09T07:10:29.5832750Z 13: 0x7fc929f653d6 - rustc::util::bug::bug_fmt::ha46366496e812bc3 2019-01-09T07:10:29.5833326Z 14: 0x7fc92a3a7e9e - ::canonicalize_free_region::hb20855203554b141 2019-01-09T07:10:29.5833919Z 15: 0x7fc92daa31e2 - as rustc::ty::fold::TypeFolder<'gcx, 'tcx>>::fold_binder::hc9c87ea23c310a6d 2019-01-09T07:10:29.5834408Z 16: 0x7fc92da98d3f - rustc::ty::fold::TypeFoldable::fold_with::h7e3b766f2010c13a 2019-01-09T07:10:29.5834968Z 17: 0x7fc92daab073 - rustc::infer::canonical::canonicalizer::Canonicalizer::canonicalize::h94c8b15ec82441c4 2019-01-09T07:10:29.5835515Z 18: 0x7fc92da1f6d3 - rustc::infer::canonical::query_response::>::make_canonicalized_query_response::h5fd5664469b4f467 2019-01-09T07:10:29.5836048Z 19: 0x7fc92da87cd7 - rustc::ty::context::GlobalCtxt::enter_local::h1f55605a2fa570c8 2019-01-09T07:10:29.5836530Z 20: 0x7fc92dabaae2 - rustc_traits::type_op::type_op_prove_predicate::hac79da90828ae7f1 2019-01-09T07:10:29.5837040Z 21: 0x7fc929d2b70f - rustc::ty::query::__query_compute::type_op_prove_predicate::h7882d718114c6595 2019-01-09T07:10:29.5837623Z 22: 0x7fc92a192510 - rustc::ty::query:: for rustc::ty::query::queries::type_op_prove_predicate<'tcx>>::compute::ha0a22e439c583e0c 2019-01-09T07:10:29.5838117Z 23: 0x7fc929e10e7d - rustc::dep_graph::graph::DepGraph::with_task_impl::hfa60f5e02294bab2 2019-01-09T07:10:29.5839497Z 24: 0x7fc929fbdcf2 - rustc::ty::query::plumbing::>::try_get_with::h1f97e191d0c8020c 2019-01-09T07:10:29.5840159Z 25: 0x7fc929f59b41 - as rustc::traits::query::type_op::QueryTypeOp<'gcx, 'tcx>>::perform_query::h14af7bf1a4623951 2019-01-09T07:10:29.5840914Z 26: 0x7fc92ac8b0cf - rustc::traits::query::type_op::QueryTypeOp::fully_perform_into::h872744c4a3994a98 2019-01-09T07:10:29.5841494Z 27: 0x7fc92ae19537 - as rustc::traits::query::type_op::TypeOp<'gcx, 'tcx>>::fully_perform::h3e366726f127bd41 2019-01-09T07:10:29.5842067Z 28: 0x7fc92aca075c - rustc_mir::borrow_check::nll::type_check::TypeChecker::prove_predicate::hb7ef6ce272275f2e 2019-01-09T07:10:29.5842848Z 29: 0x7fc92aca05c0 - rustc_mir::borrow_check::nll::type_check::TypeChecker::normalize_and_prove_instantiated_predicates::h255e9fb239711ae2 2019-01-09T07:10:29.5843649Z 30: 0x7fc92ac970de - as rustc::mir::visit::Visitor<'tcx>>::visit_constant::h7187d25a2e406efd 2019-01-09T07:10:29.5844157Z 31: 0x7fc92ac98217 - as rustc::mir::visit::Visitor<'tcx>>::visit_mir::ha0c0ad5513e2672a 2019-01-09T07:10:29.5844600Z 32: 0x7fc92ac96dbe - rustc_mir::borrow_check::nll::type_check::type_check_internal::hffa4ef19a1580b02 2019-01-09T07:10:29.5844988Z 33: 0x7fc92ac0bbda - rustc::ty::context::GlobalCtxt::enter_local::h2a8d3ec35b4f82ce 2019-01-09T07:10:29.5845446Z 34: 0x7fc92aca497b - ::run_pass::h2f175b6bc17f76c6 2019-01-09T07:10:29.5845833Z 35: 0x7fc92acfb21a - rustc_mir::transform::run_passes::{{closure}}::h519bb7163684e841 2019-01-09T07:10:29.5846221Z 36: 0x7fc92acfaed9 - rustc_mir::transform::run_passes::ha3cc06ce83f98300 2019-01-09T07:10:29.5846616Z 37: 0x7fc92acfb603 - rustc_mir::transform::mir_const::he9f9e4792f0fd52c 2019-01-09T07:10:29.5846996Z 38: 0x7fc92adb75bc - rustc::ty::query::__query_compute::mir_const::h4a18e1bad2c2cd20 2019-01-09T07:10:29.5847556Z 39: 0x7fc92ab7da9c - rustc::ty::query:: for rustc::ty::query::queries::mir_const<'tcx>>::compute::h11b8ce581ca21481 2019-01-09T07:10:29.5847963Z 40: 0x7fc92aebc333 - rustc::dep_graph::graph::DepGraph::with_task_impl::hc2d1738bc17dffea 2019-01-09T07:10:29.5848975Z 41: 0x7fc92abb8937 - rustc::ty::query::plumbing::>::try_get_with::h8be6d20eace6785b 2019-01-09T07:10:29.5849529Z 42: 0x7fc92acfb81d - rustc_mir::transform::mir_validated::hf49c21f9e6f17ece 2019-01-09T07:10:29.5850035Z 43: 0x7fc92a190fac - rustc::ty::query:: for rustc::ty::query::queries::mir_validated<'tcx>>::compute::h35a85da1fde27e28 2019-01-09T07:10:29.5850513Z 44: 0x7fc929ddd2f6 - rustc::dep_graph::graph::DepGraph::with_task_impl::h3b820c9594b2cec0 2019-01-09T07:10:29.5850966Z 45: 0x7fc929fa6a7b - rustc::ty::query::plumbing::>::try_get_with::h115c183808c121a5 2019-01-09T07:10:29.5851446Z 46: 0x7fc92a0e66dc - rustc::ty::query::plumbing::>::ensure_query::h1eb3b1bdb1673ac8 2019-01-09T07:10:29.5851970Z 47: 0x7fc92b3a8bc5 - rustc_borrowck::borrowck::borrowck::hfe7e7029a4f8860a 2019-01-09T07:10:29.5852365Z 48: 0x7fc92b3783cc - rustc::ty::query::__query_compute::borrowck::hd756d7f12d24fe3c 2019-01-09T07:10:29.5852821Z 49: 0x7fc92b38237c - rustc::ty::query:: for rustc::ty::query::queries::borrowck<'tcx>>::compute::h9fdf8c53c24da732 2019-01-09T07:10:29.5853214Z 50: 0x7fc92b37aaab - rustc::dep_graph::graph::DepGraph::with_task_impl::h835f89accfc9d52d 2019-01-09T07:10:29.5853854Z 51: 0x7fc92b3849d4 - rustc::ty::query::plumbing::>::try_get_with::h20bbb6fc8beccebc 2019-01-09T07:10:29.5854283Z 52: 0x7fc92b38d381 - rustc::ty::>::par_body_owners::h39e78c11d92c15e8 2019-01-09T07:10:29.5854683Z 53: 0x7fc92b3a8977 - rustc_borrowck::borrowck::check_crate::hbede2c1b6a8ef496 2019-01-09T07:10:29.5855045Z 54: 0x7fc92eadcf81 - rustc::util::common::time::haff8156274509ff5 2019-01-09T07:10:29.5855423Z 55: 0x7fc92eb23485 - >::with::ha529ac533f89a17f 2019-01-09T07:10:29.5855815Z 56: 0x7fc92eae2b46 - rustc_driver::driver::compile_input::had70b272120da9cf 2019-01-09T07:10:29.5856185Z 57: 0x7fc92ea6fbf0 - rustc_driver::run_compiler_with_pool::h9a09586d390d81f7 2019-01-09T07:10:29.5856579Z 58: 0x7fc92ea7ac95 - >::set::hde29fd112e350f04 2019-01-09T07:10:29.5857109Z 59: 0x7fc92ea6ea3a - rustc_driver::run_compiler::ha251c7865eed2337 2019-01-09T07:10:29.5857485Z 60: 0x7fc92ea7ae4a - >::set::hfc0ece120fe30385 2019-01-09T07:10:29.5857905Z 61: 0x7fc92eb4bc52 - std::sys_common::backtrace::__rust_begin_short_backtrace::h7bafd171c84cd5b6 2019-01-09T07:10:29.5858256Z 62: 0x7fc92e788539 - __rust_maybe_catch_panic 2019-01-09T07:10:29.5858802Z at src/libpanic_unwind/lib.rs:92 2019-01-09T07:10:29.5859333Z 63: 0x7fc92eb56ff0 - >::call_box::h89839b7683f86c15 2019-01-09T07:10:29.5859755Z 64: 0x7fc92e78731d - std::sys::unix::thread::Thread::new::thread_start::hf3d97e1814c21dcd 2019-01-09T07:10:29.5859954Z at /rustc/d22fa2d87d03d19fdb1359faab9ec5e74eff26b3/src/liballoc/boxed.rs:744 2019-01-09T07:10:29.5860096Z at src/libstd/sys_common/thread.rs:14 2019-01-09T07:10:29.5860274Z at src/libstd/sys/unix/thread.rs:81 2019-01-09T07:10:29.5860627Z 65: 0x7fc92e4fc6b9 - start_thread 2019-01-09T07:10:29.5860980Z 66: 0x7fc92de2641c - clone 2019-01-09T07:10:29.5861344Z 67: 0x0 - 2019-01-09T07:10:29.5861508Z query stack during panic: 2019-01-09T07:10:29.5863064Z #0 [type_op_prove_predicate] evaluating `type_op_prove_predicate` `Canonical { max_universe: U0, variables: [], value: ParamEnvAnd { param_env: ParamEnv { caller_bounds: [], reveal: UserFacing, def_id: None }, value: ProvePredicate { predicate: Binder(TraitPredicate(, juniper::EmptyMutation>>, ctx:std::sync::Arc], hyper::Body>, hyper::common::never::Never>, hyper::service::service::ServiceFn<[closure@juniper_hyper/src/lib.rs:368:24: 385:14 root_node:std::sync::Arc, juniper::EmptyMutation>>, ctx:std::sync::Arc], hyper::Body>, hyper::common::exec::Exec, hyper::server::conn::spawn_all::NoopWatcher>>)) } } }` 2019-01-09T07:10:29.5863415Z #1 [mir_const] processing `tests::test_hyper_integration` 2019-01-09T07:10:29.5863552Z #2 [mir_validated] processing `tests::test_hyper_integration` 2019-01-09T07:10:29.5863710Z #3 [borrowck] processing `tests::test_hyper_integration` 2019-01-09T07:10:29.5863864Z end of query stack 2019-01-09T07:10:29.5898930Z error: aborting due to previous error 2019-01-09T07:10:29.5899185Z 2019-01-09T07:10:29.5949635Z 2019-01-09T07:10:29.5950076Z note: the compiler unexpectedly panicked. this is a bug. 2019-01-09T07:10:29.5950277Z 2019-01-09T07:10:29.5951163Z note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports 2019-01-09T07:10:29.5952442Z 2019-01-09T07:10:29.5952924Z note: rustc 1.33.0-nightly (d22fa2d 2019-01-08) running on x86_64-unknown-linux-gnu 2019-01-09T07:10:29.5952971Z 2019-01-09T07:10:29.5953221Z note: compiler flags: -C debuginfo=2 -C incremental 2019-01-09T07:10:29.5953260Z 2019-01-09T07:10:29.5953331Z note: some of the compiler flags provided by cargo are hidden 2019-01-09T07:10:29.5953367Z 2019-01-09T07:10:29.6146618Z error: Could not compile `juniper_hyper`. 2019-01-09T07:10:29.6146725Z 2019-01-09T07:10:29.6146778Z Caused by: 2019-01-09T07:10:29.6149419Z process didn't exit successfully: `rustc --crate-name juniper_hyper juniper_hyper/src/lib.rs --color never --emit=dep-info,link -C debuginfo=2 --test -C metadata=3807ac3ed6b94625 -C extra-filename=-3807ac3ed6b94625 --out-dir /home/vsts/work/1/s/target/debug/deps -C incremental=/home/vsts/work/1/s/target/debug/incremental -L dependency=/home/vsts/work/1/s/target/debug/deps --extern futures=/home/vsts/work/1/s/target/debug/deps/libfutures-5cd4327faadf55f0.rlib --extern hyper=/home/vsts/work/1/s/target/debug/deps/libhyper-6bec956c16d964f9.rlib --extern juniper=/home/vsts/work/1/s/target/debug/deps/libjuniper-2f7cc4460538f027.rlib --extern pretty_env_logger=/home/vsts/work/1/s/target/debug/deps/libpretty_env_logger-182ddd40e8d0b39b.rlib --extern reqwest=/home/vsts/work/1/s/target/debug/deps/libreqwest-535d97eaa258aefe.rlib --extern serde=/home/vsts/work/1/s/target/debug/deps/libserde-79f268707972a3cf.rlib --extern serde_derive=/home/vsts/work/1/s/target/debug/deps/libserde_derive-40b3bc7312dcacaf.so --extern serde_json=/home/vsts/work/1/s/target/debug/deps/libserde_json-f22e6a35b9227ddc.rlib --extern tokio=/home/vsts/work/1/s/target/debug/deps/libtokio-4c1190750bfcadcb.rlib --extern tokio_threadpool=/home/vsts/work/1/s/target/debug/deps/libtokio_threadpool-84a88356c413a7ec.rlib --extern url=/home/vsts/work/1/s/target/debug/deps/liburl-d8efd7c34c11e8ca.rlib -L native=/home/vsts/work/1/s/target/debug/build/backtrace-sys-94691567e42eae9a/out` (exit code: 101)
@LegNeato
Copy link
Contributor Author

LegNeato commented Jan 9, 2019

Works fine with stable and rustc 1.33.0-nightly (b2b7a063a 2019-01-01), fails with 1.33.0-nightly (f381a9625 2019-01-04) and later.

Steps to repro:

git clone https://github.com/graphql-rust/juniper.git;
cd juniper/juniper_hyper;
cargo test;

@LegNeato LegNeato changed the title Nightly (d22fa2d87 2019-01-08) rustc crashes with "unexpected region in query response" Nightly rustc crashes with "unexpected region in query response" Jan 9, 2019
@matthewjasper matthewjasper added the I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ label Jan 9, 2019
@LegNeato
Copy link
Contributor Author

LegNeato commented Jan 28, 2019

I bisected:

$ cargo-bisect-rustc --test-dir=./juniper/juniper_hyper/ --start=b2b7a063af39455d7362524da3123c34c3f4842e --end=f381a9625 --script ./juniper/juniper_hyper/test.sh
regression in c0bbc3927e28c22edefe6a1353b5ecc95ea9a104

So the regression was caused by c0bbc39.

@LegNeato
Copy link
Contributor Author

Which was this PR: #55517. /cc @nikomatsakis

@Mark-Simulacrum Mark-Simulacrum added I-nominated regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jan 28, 2019
@pnkfelix
Copy link
Member

triage: P-high. assigning to self for initial investigation.

@pnkfelix pnkfelix added the P-high High priority label Jan 31, 2019
@pnkfelix pnkfelix self-assigned this Jan 31, 2019
@nikomatsakis nikomatsakis self-assigned this Jan 31, 2019
@nikomatsakis
Copy link
Contributor

@LegNeato thanks for bisecting

@theduke
Copy link
Contributor

theduke commented Feb 18, 2019

@nikomatsakis friendly ping since this is now a regression-from-stable-to-beta.

@pnkfelix
Copy link
Member

I have narrowed this down to a single file test case that depends solely on extern crate futures;, which means we can at least demo on the playpen.

Code (play):

#![allow(unreachable_code)]
extern crate futures;

use futures::future::{join_all, poll_fn, done, ok};
use futures::future::Future;
use futures::future::Either;
use futures::Async;

fn main() {
    let _b: Box<Future<Item = _, Error = _> + Send>;
    _b = Box::new(graphql());
}

struct BlockingError;
struct Request;
struct RequestError;
struct RootNode2<'a> { _schema: &'a (), }

fn graphql() -> impl Future<Item = Vec<()>, Error = BlockingError>
{
    match () {
        _ if false => Either::A(done(Err(RequestError)).or_else(|_| ok(vec![]))),
        _ => Either::B(
            done(Err(RequestError))
                .and_then(|_: Request| join_all(Some(&unimplemented!()).into_iter()
                                                .map(|root_node: &RootNode2<'static>| {
                                                    poll_fn(|| {
                                                        &root_node;
                                                        Ok(Async::Ready(()))
                                                    })
                                                })))
                .or_else(|_| ok(vec![]))),
    }
}

@pnkfelix
Copy link
Member

(my planned next step is to remove the dependence on the futures crate, so that we can really dive in from the viewpoint of rustc itself without worrying about that other code.)

@pnkfelix
Copy link
Member

Okay I've now reduced it to a single file that only depends on std.

Code (play):

pub struct AndThen<B, F>(B, F);
fn and_then<F, B>(_: F) -> AndThen<B, F> where F: FnOnce() -> B { unimplemented!() }

pub trait Trait { }
impl<B, F> Trait for AndThen<B, F> { }

pub struct JoinAll<I> where I: Iterator { _elem: std::marker::PhantomData<I::Item> }
pub fn join_all<I>(_i: I) -> JoinAll<I> where I: Iterator { unimplemented!() }

pub struct PollFn<F, T>(F, std::marker::PhantomData<fn () -> T>);
pub fn poll_fn<T, F>(_f: F) -> PollFn<F, T> where F: FnMut() -> T { unimplemented!() }

impl<B, I: Iterator, F> Iterator for Map<I, F> where F: FnMut(I::Item) -> B {
    type Item = B;
    fn next(&mut self) -> Option<B> { unimplemented!() }
}

struct Map<I, F> { iter: I, f: F }

fn main() { let _b: Box<Trait + Send> = Box::new(graphql()); }

fn graphql() -> impl Trait
{
    let local = ();
    let m = |_: ()| poll_fn(|| { local; });
    let v = Map { iter: std::iter::once(()), f: m };
    let f = || join_all(v);
    and_then(f)
}

Its pretty hard to reduce it past this point though.

There's a lot of inter-depedencies; I assume the bug is arising from some nasty interactions between normalizing the various associated items above along with the impl Trait (and of course the lifetime introduced by the borrow in the closure).

But in any case a standalone file gives us a much better place to work from now.

@pnkfelix
Copy link
Member

There is a comment above the ICE in question:

// Other than `'static` or `'empty`, the query
// response should be executing in a fully
// canonicalized environment, so there shouldn't be
// any other region names it can come up.
bug!("unexpected region in query response: `{:?}`", r)

Looking at the RUST_LOG output here, I wonder if there are any obvious counter-examples to that claim that we should never see any names apart from 'static or 'empty.

In particular, I see:

DEBUG 2019-02-21T14:05:41Z: rustc::infer::region_constraints: RegionConstraintCollector: add_constraint(VarSubReg('_#2r, ReScope(CallSite(16))))

Does the presence of that constraint provide a hint as to how not-exactly-named regions are leaking into the canonicalization...

(or maybe we should be cleaning out such regions before they leak out into the impl Trait itself...)

bors added a commit that referenced this issue Feb 25, 2019
…aks-into-impl-trait, r=pnkfelix

avoid ICE when region sneaks into impl trait

Addresses non-NLL instances of #57464
@pnkfelix
Copy link
Member

Note that this bug remains open because even thought PR #58649 side-steps the problem under AST-borrowck, it still arises under NLL and the 2018 edition. (The play link above still works since 2018 is the default.)

@pnkfelix
Copy link
Member

pnkfelix commented Feb 28, 2019

Update: I have a generalization of PR #58649 that fixes this with and without NLL.

Update 2: The aforementioned generalization has been posted as PR #58839

@LegNeato
Copy link
Contributor Author

LegNeato commented Mar 2, 2019

With the latest nightly I now get:

thread 'rustc' panicked at 'no errors encountered even though `delay_span_bug` issued', src/librustc_errors/lib.rs:354:17

Which seems suspect as the first fix for this was adding delay_span_bug.

Config:

rustc 1.34.0-nightly (c1d2d83ca 2019-03-01)
binary: rustc
commit-hash: c1d2d83ca3b5155468ab96b09a7c54568449b137
commit-date: 2019-03-01
host: x86_64-unknown-linux-gnu
release: 1.34.0-nightly
LLVM version: 8.0
cargo 1.34.0-nightly (5c6aa46e6 2019-02-22)

Will that be fixed with the newest PR?

@matthewjasper
Copy link
Contributor

Self contained example that still ICEs with AST borrowck on nightly:

use std::{iter, slice};

struct A<T>(T);

unsafe impl<'a, 'b, F, G> Send for A<iter::Map<iter::Map<slice::Iter<'_, usize>, F>, G>>
where
    F: FnOnce(&'a usize) -> &'b usize
{}

fn iter<'a>(data: &'a [usize]) -> impl Sized + 'a {
    A(data.iter()
        .map(
            |x| x // FnMut(&'a usize) -> &'(ReScope) usize
        )
        .map(
            |x| *x // FnMut(&'(ReScope) usize) -> usize
        ))
}

fn main() {
    let x: Box<dyn Send> = Box::new(iter(&[1, 2, 3]));
}

@matthewjasper
Copy link
Contributor

matthewjasper commented Mar 3, 2019

A smaller case:

struct A<F>(F);

unsafe impl <'a, 'b, F: Fn(&'a i32) -> &'b i32> Send for A<F> {}

fn wrapped_closure() -> impl Sized {
    let z = 0;
    let f = |x| x;
    f(&z);
    A(f)
}

fn main() {
    let x: Box<dyn Send> = Box::new(wrapped_closure());
}

@pnkfelix
Copy link
Member

(I've closed PR #58839 since @matthewjasper found cases that it did not address. I will attempt to look into the root problem.)

@pnkfelix pnkfelix added regression-from-stable-to-stable Performance or correctness regression from one stable version to another. and removed regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. labels Mar 18, 2019
@pnkfelix pnkfelix added the A-impl-trait Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch. label Apr 4, 2019
bors added a commit that referenced this issue Apr 27, 2019
[DO NOT MERGE] Forbid closures that outlive their signature

* This prevents the AST borrow checker from incorrectly accepting
closures that return references to local variables and that are never
called. Note: NLL already fixes this.
* This also ensures that existential types don't end up containing
any `ReScope`s. This is the principled solution to #57464.

Opening this for a crater run to see how much code this affects.

The second issue occurs twice in this repo:
* `src/librustc_metadata/decoder.rs`
*  `src/test/run-pass/regions/regions-relate-bound-regions-on-closures-to-inference-variables.rs`
Centril added a commit to Centril/rust that referenced this issue May 2, 2019
…r=pnkfelix

Constrain all regions in the concrete type for an opaque type

`push_outlives_components` skips some regions in a type, notably the signature
of a closure is ignored. Most of the time this is OK, but for opaque types the
concrete type is used when checking auto-trait bounds in other functions.

cc @nikomatsakis @pnkfelix

Closes rust-lang#57464
Closes rust-lang#60127
Centril added a commit to Centril/rust that referenced this issue May 3, 2019
…r=pnkfelix

Constrain all regions in the concrete type for an opaque type

`push_outlives_components` skips some regions in a type, notably the signature
of a closure is ignored. Most of the time this is OK, but for opaque types the
concrete type is used when checking auto-trait bounds in other functions.

cc @nikomatsakis @pnkfelix

Closes rust-lang#57464
Closes rust-lang#60127
Centril added a commit to Centril/rust that referenced this issue May 3, 2019
…r=pnkfelix

Constrain all regions in the concrete type for an opaque type

`push_outlives_components` skips some regions in a type, notably the signature
of a closure is ignored. Most of the time this is OK, but for opaque types the
concrete type is used when checking auto-trait bounds in other functions.

cc @nikomatsakis @pnkfelix

Closes rust-lang#57464
Closes rust-lang#60127
Centril added a commit to Centril/rust that referenced this issue May 4, 2019
…r=pnkfelix

Constrain all regions in the concrete type for an opaque type

`push_outlives_components` skips some regions in a type, notably the signature
of a closure is ignored. Most of the time this is OK, but for opaque types the
concrete type is used when checking auto-trait bounds in other functions.

cc @nikomatsakis @pnkfelix

Closes rust-lang#57464
Closes rust-lang#60127
@sylvain101010
Copy link

Hi,
Will a 'fix release' land on stable ?

I really need this fix to compile an actix-web project on stable (which compiles on nightly).

@pnkfelix
Copy link
Member

@z0mbie42 I don't think anyone felt the bug was widespread enough to justify a backport of PR #60449 to the beta/stable channels. Or at least, no one nominated it for such.

PR #60449 landed on nightly 13 days ago, and the beta->stable and nightly->beta rollovers will occur next week. We do not have enough time between now and next week to backport PR #60449 to beta before the beta->stable rollover.

But I also don't want to dismiss the idea of trying to get the fix backported all the way to the stable channel. (I don't think a backport is terribly likely, but the team should at least discuss it at the meeting next Thursday.)

I'll go ahead and nominate PR #60449 for the backport.

@theduke
Copy link
Contributor

theduke commented May 17, 2019

I'm voicing my support for backporting to beta.

This has broken juniper_hyper for many months on stable.

With a beta backport at least it will be fixed quite a bit earlier.

@sylvain101010
Copy link

@pnkfelix thank you for the explanation!

If I understand correctly, if #60449 is not backported to beta during the next week, we will not have the fix on stable at least before 1.36 ? (sorry I'm new to Rust release system)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-impl-trait Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-high High priority regression-from-stable-to-stable Performance or correctness regression from one stable version to another. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants