Skip to content

thread 'rustc' panicked at 'no label after fn', src/libcore/option.rs:1188:5 #72095

Closed
@Ekleog

Description

@Ekleog

Code

[edit: better minified version in the next comment]

#[async_trait::async_trait]
impl<T> Trait<T> for Struct<T> {
    fn foo_<'a>(
        &self,
    ) -> Pin<
        Box<
            dyn 'a
                + Send
                + Future<Output = Pin<Box<dyn Send + Stream<Item = Result<Res, Error>>>>>,
        >,
    > {
        async fn run(this: Struct<T>) -> Pin<Box<dyn Send + Stream<Item = Result<Res, Error>>>> {
            unimplemented!()
        }
        Box::pin(run(self.clone()))
    }
}

With, in Cargo.toml:

[package]
name = "example"
version = "0.1.0"
edition = "2018"

[dependencies]
async-trait = "0.1.30"

(If I didn't make a mistake in the process, I haven't been able to reproduce by reproducing manually what the async_trait crate does, so I'd guess it's probably related to it actually being a proc macro)

Meta

rustc --version --verbose:

rustc 1.41.0
binary: rustc
commit-hash: unknown
commit-date: unknown
host: x86_64-unknown-linux-gnu
release: 1.41.0
LLVM version: 9.0

Also failed with:

rustc 1.43.0-nightly (c20d7eecb 2020-03-11)
binary: rustc
commit-hash: c20d7eecbc0928b57da8fe30b2ef8528e2bdd5be
commit-date: 2020-03-11
host: x86_64-unknown-linux-gnu
release: 1.43.0-nightly
LLVM version: 9.0

Error output

thread 'rustc' panicked at 'no label after fn', src/libcore/option.rs:1188:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.

error: internal compiler error: unexpected panic

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

note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports

note: rustc 1.41.0 running on x86_64-unknown-linux-gnu

note: compiler flags: -C debuginfo=2 -C incremental --crate-type lib

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

error: could not compile `example`.
Backtrace

thread 'rustc' panicked at 'no label after fn', src/libcore/option.rs:1188:5
stack backtrace:
   0: <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt
   1: core::fmt::write
   2: std::io::Write::write_fmt
   3: std::panicking::default_hook::{{closure}}
   4: std::panicking::default_hook
   5: rustc_driver::report_ice
   6: <alloc::boxed::Box<F> as core::ops::function::Fn<A>>::call
             at /build/rustc-1.41.0-src/src/liballoc/boxed.rs:1036
   7: proc_macro::bridge::client::<impl proc_macro::bridge::Bridge>::enter::{{closure}}::{{closure}}
             at /build/rustc-1.41.0-src/src/libproc_macro/bridge/client.rs:305
   8: std::panicking::rust_panic_with_hook
   9: rust_begin_unwind
  10: core::panicking::panic_fmt
  11: core::option::expect_failed
  12: syntax_pos::source_map::SourceMap::generate_fn_name_span
  13: rustc_resolve::diagnostics::<impl rustc_resolve::Resolver>::into_struct_error
  14: rustc_resolve::Resolver::resolve_ident_in_lexical_scope
  15: rustc_resolve::Resolver::resolve_path_with_ribs
  16: rustc_resolve::late::LateResolutionVisitor::smart_resolve_path_fragment
  17: rustc_resolve::late::LateResolutionVisitor::smart_resolve_path
  18: <rustc_resolve::late::LateResolutionVisitor as syntax::visit::Visitor>::visit_ty
  19: syntax::visit::walk_generic_args
  20: syntax::visit::walk_ty
  21: rustc_resolve::late::LateResolutionVisitor::resolve_params
  22: <rustc_resolve::late::LateResolutionVisitor as syntax::visit::Visitor>::visit_fn
  23: syntax::visit::walk_item
  24: rustc_resolve::late::LateResolutionVisitor::resolve_item
  25: <rustc_resolve::late::LateResolutionVisitor as syntax::visit::Visitor>::visit_block
  26: <rustc_resolve::late::LateResolutionVisitor as syntax::visit::Visitor>::visit_fn
  27: syntax::visit::walk_impl_item
  28: rustc_resolve::late::LateResolutionVisitor::resolve_item
  29: syntax::visit::walk_crate
  30: rustc_resolve::Resolver::resolve_crate
  31: rustc_interface::passes::configure_and_expand::{{closure}}
  32: rustc_interface::passes::configure_and_expand
  33: rustc_interface::queries::Queries::expansion
  34: rustc_interface::interface::run_compiler_in_existing_thread_pool
  35: std::thread::local::LocalKey<T>::with
  36: scoped_tls::ScopedKey<T>::set
  37: syntax::with_globals
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

error: internal compiler error: unexpected panic

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

note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports

note: rustc 1.41.0 running on x86_64-unknown-linux-gnu

note: compiler flags: -C debuginfo=2 -C incremental --crate-type lib

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

query stack during panic:
end of query stack
error: could not compile `example`.

Metadata

Metadata

Assignees

Labels

A-async-awaitArea: Async & AwaitA-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)A-resolveArea: Name/path resolution done by `rustc_resolve` specificallyAsyncAwait-TriagedAsync-await issues that have been triaged during a working group meeting.C-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️P-highHigh priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions