Closed
Description
Code in question:
trait BufMut {}
struct Bytes;
struct BytesMut;
pub trait Future {
type Item;
}
pub trait Service {
type Response;
type Future: Future<Item = Self::Response>;
}
pub trait ThriftService<F>:
Service<
Response = FramingEncoded<F>,
Future = Box<Future<Item = FramingEncodedFinal<F>>>,
>
where
F: Framing,
{
fn get_service(
&self,
) -> &Service<
Response = Self::Response,
Future = Self::Future,
>;
}
pub trait BufMutExt: BufMut {
type Final;
}
impl BufMutExt for BytesMut {
type Final = Bytes;
}
pub type FramingEncoded<F> = <F as Framing>::EncBuf;
pub type FramingEncodedFinal<F> = <<F as Framing>::EncBuf as BufMutExt>::Final;
pub trait Framing {
type EncBuf: BufMut;
}
pub struct SRHeaderTransport;
impl Framing for SRHeaderTransport {
type EncBuf = BytesMut;
}
pub type BoxService<H> = Box<
ThriftService<
SRHeaderTransport,
Response = Bytes,
Future = Box<Future<Item = Bytes>>,
>,
>;
fn with_factory<H>(self, factory: BoxService<H>) {}
Backtrace:
error: internal compiler error: src/librustc_traits/normalize_erasing_regions.rs:43: could not fully normalize `&dyn ThriftService<F, Future=<Self as Service>::Future, Response=<Self as Service>::Response>`
thread 'rustc' panicked at 'Box<Any>', src/librustc_errors/lib.rs:588:9
stack backtrace:
0: 0x10ac060c3 - std::sys::unix::backtrace::tracing::imp::unwind_backtrace::h9a87463918f2aff9
1: 0x10abfec8c - std::sys_common::backtrace::_print::h54740e69908f9100
2: 0x10ac02671 - std::panicking::default_hook::{{closure}}::h519f1fd4b67636f1
3: 0x10ac02377 - std::panicking::default_hook::h5442e3ae9abda811
4: 0x109372e21 - rustc::util::common::panic_hook::he77624544de4249c
5: 0x10ac02ed1 - std::panicking::rust_panic_with_hook::h4a3495c63f64f755
6: 0x10a7d5db0 - std::panicking::begin_panic::h39822d9e7784ad14
7: 0x10a7d10fd - rustc_errors::Handler::bug::h12485ae4ffb29a65
8: 0x108f0b315 - rustc::util::bug::opt_span_bug_fmt::{{closure}}::hab4de751350b061f
9: 0x108f0aa89 - rustc::ty::context::tls::with_opt::{{closure}}::hf9789a4ca7b4602d
10: 0x108f0a9e8 - rustc::ty::context::tls::with_context_opt::h31a8f07b2eede9b0
11: 0x108f0aa41 - rustc::ty::context::tls::with_opt::he5de36b9ad0ca1ee
12: 0x108f0b224 - rustc::util::bug::opt_span_bug_fmt::hc498b6667031b6cf
13: 0x108f0b171 - rustc::util::bug::bug_fmt::hfd92ab0e6a89baed
14: 0x107066d1a - rustc::ty::context::GlobalCtxt::enter_local::he69b2fd5601780c2
15: 0x107082f92 - rustc_traits::normalize_erasing_regions::normalize_ty_after_erasing_regions::heeb9b350e0788a77
16: 0x108e79413 - rustc::ty::query::__query_compute::normalize_ty_after_erasing_regions::h25ba473c2cbb5f91
17: 0x1092d33b7 - rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors<'tcx> for rustc::ty::query::queries::normalize_ty_after_erasing_regions<'tcx>>::compute::h2797662c3f7cd8ca
18: 0x108f8d9d9 - rustc::dep_graph::graph::DepGraph::with_task_impl::hb4afe1ce8de4db34
19: 0x1091ad643 - rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::try_get_with::hcbee305efcaa1bba
20: 0x1090ae382 - rustc::traits::query::normalize_erasing_regions::<impl rustc::ty::context::TyCtxt<'cx, 'tcx, 'tcx>>::normalize_erasing_regions::h8eed36f061225c09
21: 0x108def9dc - <rustc::ty::layout::LayoutCx<'tcx, rustc::ty::context::TyCtxt<'a, 'tcx, 'tcx>> as rustc_target::abi::LayoutOf>::layout_of::hd36f8200723655af
22: 0x1090ad061 - rustc::traits::object_safety::<impl rustc::ty::context::TyCtxt<'a, 'tcx, 'tcx>>::virtual_call_violation_for_method::{{closure}}::hd2ac69f0d9a1de87
23: 0x1090acbef - rustc::traits::object_safety::<impl rustc::ty::context::TyCtxt<'a, 'tcx, 'tcx>>::virtual_call_violation_for_method::h2a58375166f4e054
24: 0x1093d92f4 - <&mut I as core::iter::iterator::Iterator>::next::he0bf81af26a02fce
25: 0x108ecf08f - <core::iter::Filter<I, P> as core::iter::iterator::Iterator>::next::h68285655d9a4baec
26: 0x108eb1472 - <alloc::vec::Vec<T> as alloc::vec::SpecExtend<T, I>>::from_iter::h5e09d24ca7caf142
27: 0x1090aaeb9 - rustc::traits::object_safety::<impl rustc::ty::context::TyCtxt<'a, 'tcx, 'tcx>>::object_safety_violations_for_trait::h9b70c1ec6104dc4d
28: 0x108ed21d2 - <core::iter::FlatMap<I, U, F> as core::iter::iterator::Iterator>::next::he27bf259c97aab58
29: 0x108ecc432 - <alloc::vec::Vec<T> as alloc::vec::SpecExtend<T, I>>::from_iter::heff850c665c480a5
30: 0x1090aae00 - rustc::traits::object_safety::<impl rustc::ty::context::TyCtxt<'a, 'tcx, 'tcx>>::object_safety_violations::h5bb04376b4c7b528
31: 0x108eff58c - rustc::traits::object_safety::is_object_safe_provider::haa0bdc41c58ad6d1
32: 0x1092d24ce - rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors<'tcx> for rustc::ty::query::queries::is_object_safe<'tcx>>::compute::h58b2e0228812b227
33: 0x108f8a3f3 - rustc::dep_graph::graph::DepGraph::with_task_impl::habb294a3f110f69f
34: 0x109173719 - rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::try_get_with::ha215776756165dc2
35: 0x108ee7d89 - <rustc_data_structures::obligation_forest::ObligationForest<O>>::process_obligations::h18e34c1d2183a498
36: 0x109416998 - <rustc::traits::fulfill::FulfillmentContext<'tcx> as rustc::traits::engine::TraitEngine<'tcx>>::select_where_possible::ha343b6d09c00920f
37: 0x1094167c9 - <rustc::traits::fulfill::FulfillmentContext<'tcx> as rustc::traits::engine::TraitEngine<'tcx>>::select_all_or_error::h924ffcd70a9300b1
38: 0x1077faabf - rustc_typeck::check::FnCtxt::select_all_obligations_or_error::h10c087ab0783cfa1
39: 0x10791984e - rustc::ty::context::GlobalCtxt::enter_local::hef928fdb11480ce7
40: 0x1076e0c90 - rustc_typeck::check::wfcheck::check_item_well_formed::h3aad6c12ef56eb4e
41: 0x1092d294e - rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors<'tcx> for rustc::ty::query::queries::check_item_well_formed<'tcx>>::compute::ha06e4513acb77bfd
42: 0x108f6c0c9 - rustc::dep_graph::graph::DepGraph::with_task_impl::h480b354c98ca5efa
43: 0x1091dc607 - rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::try_get_with::hf022e8627d4138c2
44: 0x10921aebe - rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::ensure_query::hab13579af1de0c0c
45: 0x10785fe7b - rustc::session::Session::track_errors::h29dcb128525f6054
46: 0x1076d6029 - rustc::util::common::time::h005ff4051c9b56e1
47: 0x107888aa9 - rustc_typeck::check_crate::h4e459dc26a3dd042
48: 0x106dc2eb9 - <std::thread::local::LocalKey<T>>::with::h2d81d3d20e7fbeba
49: 0x106d5185f - rustc::ty::context::TyCtxt::create_and_enter::hfd77cec70a307209
50: 0x106df1e4f - rustc_driver::driver::compile_input::h0a81d2a90aae52be
51: 0x106d6251e - rustc_driver::run_compiler_with_pool::h762933062fd399ae
52: 0x106d6e2ae - <scoped_tls::ScopedKey<T>>::set::hbad459430e7ff417
53: 0x106d61488 - rustc_driver::run_compiler::ha1900917d325f169
54: 0x106d6e46b - <scoped_tls::ScopedKey<T>>::set::hf6e550156f6dc0f3
55: 0x106dcf78d - std::sys_common::backtrace::__rust_begin_short_backtrace::hb4db181f859dd41a
56: 0x10ac127ce - __rust_maybe_catch_panic
57: 0x106de662d - <F as alloc::boxed::FnBox<A>>::call_box::h54bd2886afe0d20a
58: 0x10ac1171b - std::sys::unix::thread::Thread::new::thread_start::h2ccd51efe09a6d88
59: 0x7fff7f2bb304 - _pthread_body
60: 0x7fff7f2be26e - _pthread_start
query stack during panic:
#0 [normalize_ty_after_erasing_regions] normalizing `ParamEnvAnd { param_env: ParamEnv { caller_bounds: [Binder(TraitPredicate(<Self as ThriftService<F>>)), Binder(TraitPredicate(<F as Framing>)), Binder(TraitPredicate(<F as std::marker::Sized>)), Binder(ProjectionPredicate(ProjectionTy { substs: [Self], item_def_id: DefId(0/0:10 ~ type_resolution[ec0b]::Service[0]::Future[0]) }, std::boxed::Box<(dyn Future<Item=<<F as Framing>::EncBuf as BufMutExt>::Final> + 'static)>)), Binder(ProjectionPredicate(ProjectionTy { substs: [Self], item_def_id: DefId(0/0:9 ~ type_resolution[ec0b]::Service[0]::Response[0]) }, <F as Framing>::EncBuf)), Binder(TraitPredicate(<Self as Service>))], reveal: All, def_id: None }, value: &dyn ThriftService<F, Future=<Self as Service>::Future, Response=<Self as Service>::Response> }`
#1 [is_object_safe] determine object safety of trait `ThriftService`
#2 [check_item_well_formed] processing `with_factory`
end of query stack
error: aborting due to 8 previous errors
Rust Playground (stable): https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=3e221e437eac9599c6914a1b203c7ce4
Godbolt (1.32.0): https://godbolt.org/z/ycFBK7 <- regression here
Godbolt (1.31.0): https://godbolt.org/z/pMryL_
This might be related to #56870.
Metadata
Metadata
Assignees
Labels
Area: Associated items (types, constants & functions)Category: This is a bug.Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Medium priorityRelevant to the compiler team, which will review and decide on the PR/issue.ICE tracked in rust-lang/glacier.Performance or correctness regression from one stable version to another.