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-20240112 regression: ICE: delayed span bug: inferring return types and opaque types do not mix well #119916

Closed
xxchan opened this issue Jan 13, 2024 · 1 comment · Fixed by #119975
Labels
C-bug Category: This is a bug. F-impl_trait_in_assoc_type `#![feature(impl_trait_in_assoc_type)]` I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ requires-nightly This issue requires a nightly compiler in some way. S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@xxchan
Copy link
Contributor

xxchan commented Jan 13, 2024

Code

https://github.com/risingwavelabs/risingwave

(not minimized yet)

https://github.com/risingwavelabs/risingwave/blob/7c3edb1ff2d64f9c0e50eacfca09ea5ce112ca2d/src/stream/src/executor/dispatch.rs#L382-L412

Error output

error: internal compiler error: no errors encountered even though `span_delayed_bug` issued

error: internal compiler error: inferring return types and opaque types do not mix well
   --> src/stream/src/executor/dispatch.rs:382:9
    |
382 |         #[try_stream]
    |         ^^^^^^^^^^^^^
    |
note: delayed at compiler/rustc_hir_analysis/src/collect/type_of/opaque.rs:140:43
         0: std::backtrace::Backtrace::create
         1: <rustc_errors::DiagCtxtInner>::emit_diagnostic
         2: <rustc_errors::DiagCtxt>::emit_diagnostic
         3: <rustc_errors::diagnostic_builder::DiagnosticBuilder>::emit_producing_error_guaranteed
         4: <rustc_hir_analysis::collect::type_of::opaque::TaitConstraintLocator>::check
         5: rustc_hir::intravisit::walk_expr::<rustc_hir_analysis::collect::type_of::opaque::TaitConstraintLocator>
         6: rustc_hir::intravisit::walk_impl_item::<rustc_hir_analysis::collect::type_of::opaque::TaitConstraintLocator>
         7: rustc_hir::intravisit::walk_item::<rustc_hir_analysis::collect::type_of::opaque::TaitConstraintLocator>
         8: rustc_hir_analysis::collect::type_of::opaque::find_opaque_ty_constraints_for_tait
         9: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::type_of_opaque::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 8]>>
        10: <rustc_query_impl::query_impl::type_of_opaque::dynamic_query::{closure#2} as core::ops::function::FnOnce<(rustc_middle::ty::context::TyCtxt, rustc_span::def_id::DefId)>>::call_once
        11: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::DefaultCache<rustc_span::def_id::DefId, rustc_middle::query::erase::Erased<[u8; 8]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, true>
        12: rustc_query_impl::query_impl::type_of_opaque::get_query_incr::__rust_end_short_backtrace
        13: rustc_middle::query::plumbing::query_get_at::<rustc_query_system::query::caches::DefaultCache<rustc_span::def_id::DefId, rustc_middle::query::erase::Erased<[u8; 8]>>>
        14: rustc_hir_analysis::collect::type_of::type_of
        15: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::type_of::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 8]>>
        16: <rustc_query_impl::query_impl::type_of::dynamic_query::{closure#2} as core::ops::function::FnOnce<(rustc_middle::ty::context::TyCtxt, rustc_span::def_id::DefId)>>::call_once
        17: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::DefaultCache<rustc_span::def_id::DefId, rustc_middle::query::erase::Erased<[u8; 8]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, true>
        18: rustc_query_impl::query_impl::type_of::get_query_incr::__rust_end_short_backtrace
        19: rustc_middle::query::plumbing::query_get_at::<rustc_query_system::query::caches::DefaultCache<rustc_span::def_id::DefId, rustc_middle::query::erase::Erased<[u8; 8]>>>
        20: <rustc_privacy::EmbargoVisitor as rustc_hir::intravisit::Visitor>::visit_item
        21: <rustc_middle::hir::map::Map>::visit_all_item_likes_in_crate::<rustc_privacy::EmbargoVisitor>
        22: rustc_privacy::effective_visibilities
        23: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::effective_visibilities::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 8]>>
        24: <rustc_query_impl::query_impl::effective_visibilities::dynamic_query::{closure#2} as core::ops::function::FnOnce<(rustc_middle::ty::context::TyCtxt, ())>>::call_once
        25: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<[u8; 8]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, true>
        26: rustc_query_impl::query_impl::effective_visibilities::get_query_incr::__rust_end_short_backtrace
        27: rustc_hir_analysis::check::compare_impl_item::refine::check_refining_return_position_impl_trait_in_trait
        28: rustc_hir_analysis::check::compare_impl_item::compare_impl_method
        29: rustc_hir_analysis::check::check::check_item_type
        30: rustc_hir_analysis::check::wfcheck::check_well_formed
        31: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::check_well_formed::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 1]>>
        32: <rustc_query_impl::query_impl::check_well_formed::dynamic_query::{closure#2} as core::ops::function::FnOnce<(rustc_middle::ty::context::TyCtxt, rustc_hir::hir_id::OwnerId)>>::call_once
        33: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::VecCache<rustc_hir::hir_id::OwnerId, rustc_middle::query::erase::Erased<[u8; 1]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, true>
        34: rustc_query_impl::query_impl::check_well_formed::get_query_incr::__rust_end_short_backtrace
        35: rustc_middle::query::plumbing::query_ensure_error_guaranteed::<rustc_query_system::query::caches::VecCache<rustc_hir::hir_id::OwnerId, rustc_middle::query::erase::Erased<[u8; 1]>>>
        36: <rustc_middle::hir::ModuleItems>::par_items::<rustc_hir_analysis::check::wfcheck::check_mod_type_wf::{closure#0}>
        37: rustc_hir_analysis::check::wfcheck::check_mod_type_wf
        38: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::check_mod_type_wf::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 1]>>
        39: <rustc_query_impl::query_impl::check_mod_type_wf::dynamic_query::{closure#2} as core::ops::function::FnOnce<(rustc_middle::ty::context::TyCtxt, rustc_span::def_id::LocalModDefId)>>::call_once
        40: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::DefaultCache<rustc_span::def_id::LocalModDefId, rustc_middle::query::erase::Erased<[u8; 1]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, true>
        41: rustc_query_impl::query_impl::check_mod_type_wf::get_query_incr::__rust_end_short_backtrace
        42: <rustc_middle::hir::map::Map>::try_par_for_each_module::<rustc_hir_analysis::check_crate::{closure#4}::{closure#0}>::{closure#0}
        43: rustc_hir_analysis::check_crate
        44: rustc_interface::passes::analysis
        45: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 1]>>
        46: <rustc_query_impl::query_impl::analysis::dynamic_query::{closure#2} as core::ops::function::FnOnce<(rustc_middle::ty::context::TyCtxt, ())>>::call_once
        47: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<[u8; 1]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, true>
        48: rustc_query_impl::query_impl::analysis::get_query_incr::__rust_end_short_backtrace
        49: <rustc_middle::ty::context::GlobalCtxt>::enter::<rustc_driver_impl::run_compiler::{closure#0}::{closure#0}::{closure#3}, core::result::Result<(), rustc_span::ErrorGuaranteed>>
        50: <rustc_interface::interface::Compiler>::enter::<rustc_driver_impl::run_compiler::{closure#0}::{closure#0}, core::result::Result<core::option::Option<rustc_interface::queries::Linker>, rustc_span::ErrorGuaranteed>>
        51: rustc_span::set_source_map::<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#0}>::{closure#0}::{closure#0}>
        52: <scoped_tls::ScopedKey<rustc_span::SessionGlobals>>::set::<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#0}>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>
        53: rustc_span::create_session_globals_then::<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#0}>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}>
        54: std::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#0}>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>
        55: <<std::thread::Builder>::spawn_unchecked_<rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#0}>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#1} as core::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
        56: std::sys::unix::thread::Thread::new::thread_start
        57: __pthread_joiner_wake
   --> src/stream/src/executor/dispatch.rs:382:9
    |
382 |         #[try_stream]
    |         ^^^^^^^^^^^^^
    = note: this error: internal compiler error originates in the attribute macro `try_stream` (in Nightly builds, run with -Z macro-backtrace for more info)

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: please attach the file at `/Users/xxchan/Projects/risingwave/rustc-ice-2024-01-13T06_41_26-98452.txt` to your bug report

note: compiler flags: --crate-type lib -C lto=off -C embed-bitcode=no -C debuginfo=2 -C split-debuginfo=unpacked -C incremental=[REDACTED] -C link-arg=-fuse-ld=/opt/homebrew/opt/llvm/bin/ld64.lld

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
end of query stack

Bisect

searched nightlies: from nightly-2024-01-11 to nightly-2024-01-13
regressed nightly: nightly-2024-01-12
searched commit range: a2d9d73...62d7ed4
regressed commit: 65b323b

bisected with cargo-bisect-rustc v0.6.7

Host triple: aarch64-apple-darwin
Reproduce with:

cargo bisect-rustc --start 2024-01-11 -- check -p risingwave_stream
@xxchan xxchan added C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jan 13, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Jan 13, 2024
@xxchan xxchan changed the title ICE: delayed span bug: inferring return types and opaque types do not mix well nightly-2024-01-12 regression: ICE: delayed span bug: inferring return types and opaque types do not mix well Jan 13, 2024
@xxchan xxchan changed the title nightly-2024-01-12 regression: ICE: delayed span bug: inferring return types and opaque types do not mix well nightly-20240112 regression: ICE: delayed span bug: inferring return types and opaque types do not mix well Jan 13, 2024
@compiler-errors compiler-errors added E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Jan 13, 2024
@lukas-code
Copy link
Member

MCVE:

#![feature(impl_trait_in_assoc_type)]

pub trait StreamConsumer {
    type BarrierStream;
    fn execute() -> Self::BarrierStream;
}

pub struct DispatchExecutor;

impl StreamConsumer for DispatchExecutor {
    type BarrierStream = impl Sized;
    fn execute() -> Self::BarrierStream {
        || -> _ {}
    }
}

@rustbot label -E-needs-mcve +S-has-mcve +F-impl_trait_in_assoc_type +requires-nightly

@rustbot rustbot added F-impl_trait_in_assoc_type `#![feature(impl_trait_in_assoc_type)]` requires-nightly This issue requires a nightly compiler in some way. S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue and removed E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example labels Jan 14, 2024
compiler-errors added a commit to compiler-errors/rust that referenced this issue Jan 17, 2024
…and-opaque-types-do-mix-sometimes, r=compiler-errors

Don't ICE if TAIT-defining fn contains a closure with `_` in return type

The `delay_span_bug` got added in rust-lang@0e82aae to reduce the amount of errors emitted for functions that have `_` in their return type, because inference doesn't apply to function items. But this logic shouldn't apply to closures, because their return types *can* be inferred.

Fixes rust-lang#119916.
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Jan 17, 2024
…and-opaque-types-do-mix-sometimes, r=compiler-errors

Don't ICE if TAIT-defining fn contains a closure with `_` in return type

The `delay_span_bug` got added in rust-lang@0e82aae to reduce the amount of errors emitted for functions that have `_` in their return type, because inference doesn't apply to function items. But this logic shouldn't apply to closures, because their return types *can* be inferred.

Fixes rust-lang#119916.
compiler-errors added a commit to compiler-errors/rust that referenced this issue Jan 17, 2024
…and-opaque-types-do-mix-sometimes, r=compiler-errors

Don't ICE if TAIT-defining fn contains a closure with `_` in return type

The `delay_span_bug` got added in rust-lang@0e82aae to reduce the amount of errors emitted for functions that have `_` in their return type, because inference doesn't apply to function items. But this logic shouldn't apply to closures, because their return types *can* be inferred.

Fixes rust-lang#119916.
@bors bors closed this as completed in 22f1913 Jan 18, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Jan 18, 2024
Rollup merge of rust-lang#119975 - lukas-code:inferring-return-types-and-opaque-types-do-mix-sometimes, r=compiler-errors

Don't ICE if TAIT-defining fn contains a closure with `_` in return type

The `delay_span_bug` got added in rust-lang@0e82aae to reduce the amount of errors emitted for functions that have `_` in their return type, because inference doesn't apply to function items. But this logic shouldn't apply to closures, because their return types *can* be inferred.

Fixes rust-lang#119916.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. F-impl_trait_in_assoc_type `#![feature(impl_trait_in_assoc_type)]` I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ requires-nightly This issue requires a nightly compiler in some way. S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue 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.

4 participants