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

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

Closed
Ekleog opened this issue May 10, 2020 · 1 comment · Fixed by #72261
Closed

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

Ekleog opened this issue May 10, 2020 · 1 comment · Fixed by #72261
Assignees
Labels
A-async-await Area: Async & Await A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..) A-resolve Area: Name/path resolution done by `rustc_resolve` specifically AsyncAwait-Triaged Async-await issues that have been triaged during a working group meeting. C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-high High priority T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@Ekleog
Copy link

Ekleog commented May 10, 2020

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`.

@Ekleog Ekleog 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 May 10, 2020
@jonas-schievink jonas-schievink added A-async-await Area: Async & Await A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..) A-resolve Area: Name/path resolution done by `rustc_resolve` specifically labels May 10, 2020
@Ekleog
Copy link
Author

Ekleog commented May 10, 2020

I've just found a better minified version:

#[async_trait::async_trait]
impl<T> Trait<T> for Struct<T> {
    fn foo(&self) -> Pin<Box<dyn Future<Output = Res>,>> {
        async fn run(this: Struct<T>) -> Res {
            unimplemented!()
        }
        unimplemented!()
    }
}

Note that when removing the , after the dyn Future<Output = Res>, the ICE vanishes (hence my originally thinking I couldn't simplify the example more, as my auto-format would remove the comma)

@tmandry tmandry added AsyncAwait-Triaged Async-await issues that have been triaged during a working group meeting. P-high High priority labels May 12, 2020
@csmoe csmoe self-assigned this May 16, 2020
@bors bors closed this as completed in 65833dc May 17, 2020
@tmandry tmandry moved this to Done in wg-async work Dec 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-async-await Area: Async & Await A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..) A-resolve Area: Name/path resolution done by `rustc_resolve` specifically AsyncAwait-Triaged Async-await issues that have been triaged during a working group meeting. C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-high High priority T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

4 participants