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

async fn ICEs in macro on stable #67778

Open
XAMPPRocky opened this issue Jan 1, 2020 · 5 comments
Open

async fn ICEs in macro on stable #67778

XAMPPRocky opened this issue Jan 1, 2020 · 5 comments

Comments

@XAMPPRocky
Copy link
Contributor

@XAMPPRocky XAMPPRocky commented Jan 1, 2020

I was migrating my library (Mammut) to use reqwest 0.10 and be async, and the compiler ICEd. I don't know how to reduce it further than this.

I tried this code:

XAMPPRocky/Mammut@f30bdec#diff-b4aea3e418ccdb71239b96952d9cddb6

I expected to see this happen: A successful build or another compile error

Instead, this happened: thread 'rustc' panicked at 'no entry found for key', src/libcore/option.rs:1188:5

Meta

I also tried this on the latest nightly and it emits the same error.
rustc --version --verbose:

rustc 1.40.0 (73528e339 2019-12-16)
binary: rustc
commit-hash: 73528e339aae0f17a15ffa49a8ac608f50c6cf14
commit-date: 2019-12-16
host: x86_64-apple-darwin
release: 1.40.0
LLVM version: 9.0

Backtrace:

       Fresh cfg-if v0.1.9
       Fresh lazy_static v1.4.0
       Fresh fnv v1.0.6
       Fresh itoa v0.4.4
       Fresh unicode-xid v0.2.0
       Fresh version_check v0.1.5
       Fresh bytes v0.5.3
       Fresh ppv-lite86 v0.2.5
       Fresh slab v0.4.2
       Fresh pin-project-lite v0.1.1
       Fresh smallvec v0.6.10
       Fresh matches v0.1.8
       Fresh autocfg v0.1.6
       Fresh futures-core v0.3.1
       Fresh pin-utils v0.1.0-alpha.4
       Fresh futures-sink v0.3.1
       Fresh futures-task v0.3.1
       Fresh remove_dir_all v0.5.2
       Fresh try-lock v0.2.2
       Fresh indexmap v1.1.0
       Fresh tower-service v0.3.0
       Fresh percent-encoding v2.1.0
       Fresh dtoa v0.4.4
       Fresh percent-encoding v1.0.1
       Fresh base64 v0.11.0
       Fresh language-tags v0.2.2
       Fresh c2-chacha v0.2.2
       Fresh http v0.2.0
       Fresh unicode-normalization v0.1.8
       Fresh unicode-bidi v0.3.4
       Fresh futures-channel v0.3.1
       Fresh futures-util v0.3.1
       Fresh libc v0.2.66
       Fresh log v0.4.8
       Fresh proc-macro2 v1.0.1
       Fresh memchr v2.2.1
       Fresh core-foundation-sys v0.6.2
       Fresh byteorder v1.3.2
       Fresh httparse v1.3.4
       Fresh serde v1.0.99
       Fresh http-body v0.3.1
       Fresh idna v0.2.0
       Fresh idna v0.1.5
       Fresh ryu v1.0.0
       Fresh encoding_rs v0.8.17
       Fresh doc-comment v0.3.1
       Fresh iovec v0.1.4
       Fresh getrandom v0.1.11
       Fresh net2 v0.2.33
       Fresh quote v1.0.2
       Fresh unicase v2.4.0
       Fresh core-foundation v0.6.4
       Fresh security-framework-sys v0.3.1
       Fresh time v0.1.42
       Fresh want v0.3.0
       Fresh base64 v0.10.1
       Fresh num-traits v0.2.8
       Fresh url v2.1.0
       Fresh url v1.7.2
       Fresh serde_json v1.0.40
       Fresh rand_core v0.5.1
       Fresh mio v0.6.21
       Fresh syn v1.0.5
       Fresh security-framework v0.3.1
       Fresh mime v0.3.13
       Fresh bytes v0.4.12
       Fresh rand_chacha v0.2.1
       Fresh serde_urlencoded v0.6.1
       Fresh num-integer v0.1.41
       Fresh tokio v0.2.6
       Fresh rand v0.7.0
       Fresh pin-project-internal v0.4.6
       Fresh http v0.1.18
       Fresh serde_derive v1.0.99
       Fresh tokio-util v0.2.0
       Fresh tempfile v3.1.0
       Fresh pin-project v0.4.6
       Fresh mime_guess v2.0.1
       Fresh hyperx v0.15.1
       Fresh chrono v0.4.7
       Fresh h2 v0.2.1
       Fresh native-tls v0.2.3
       Fresh hyper v0.13.1
       Fresh tokio-tls v0.3.0
       Fresh hyper-tls v0.4.0
       Fresh reqwest v0.10.0
   Compiling mammut v0.13.0 (/Users/ep/src/rust/mammut)
     Running `rustc --edition=2018 --crate-name mammut src/lib.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type lib --emit=dep-info,metadata,link -C debuginfo=2 -C metadata=c809cf0fdf8620be -C extra-filename=-c809cf0fdf8620be --out-dir /Users/ep/src/rust/mammut/target/debug/deps -C incremental=/Users/ep/src/rust/mammut/target/debug/incremental -L dependency=/Users/ep/src/rust/mammut/target/debug/deps --extern chrono=/Users/ep/src/rust/mammut/target/debug/deps/libchrono-72684b2f28e9fe2c.rmeta --extern doc_comment=/Users/ep/src/rust/mammut/target/debug/deps/libdoc_comment-3f3009ca6b5845ea.rmeta --extern hyperx=/Users/ep/src/rust/mammut/target/debug/deps/libhyperx-58cd697042051998.rmeta --extern log=/Users/ep/src/rust/mammut/target/debug/deps/liblog-43677abba509ad49.rmeta --extern reqwest=/Users/ep/src/rust/mammut/target/debug/deps/libreqwest-6f1b39962470a51c.rmeta --extern serde=/Users/ep/src/rust/mammut/target/debug/deps/libserde-7aa2ed46f2c9d0ab.rmeta --extern serde_derive=/Users/ep/src/rust/mammut/target/debug/deps/libserde_derive-5701627921a25966.dylib --extern serde_json=/Users/ep/src/rust/mammut/target/debug/deps/libserde_json-14989846f8d6cd6d.rmeta --extern url=/Users/ep/src/rust/mammut/target/debug/deps/liburl-63a14c7395b66a8f.rmeta -C target-cpu=native`
thread 'rustc' panicked at 'no entry found for key', src/libcore/option.rs:1185:5
stack backtrace:
   0:        0x10e766b75 - <unknown>
   1:        0x10e79dcc0 - <unknown>
   2:        0x10e75a47b - <unknown>
   3:        0x10e76af83 - <unknown>
   4:        0x10e76ac8a - <unknown>
   5:        0x10bc05562 - <unknown>
   6:        0x10e76b79c - <unknown>
   7:        0x10e76b229 - <unknown>
   8:        0x10e76b129 - <unknown>
   9:        0x10e79733c - <unknown>
  10:        0x10e79744e - <unknown>
  11:        0x10d04364a - <unknown>
  12:        0x10bff2272 - <unknown>
  13:        0x10cd26bf0 - <unknown>
  14:        0x10cd24150 - <unknown>
  15:        0x10cd1edfe - <unknown>
  16:        0x10bccc87c - <unknown>
  17:        0x10bccaf32 - <unknown>
  18:        0x10bd1afb0 - <unknown>
  19:        0x10bcf6507 - <unknown>
  20:        0x10bcd0e28 - <unknown>
  21:        0x10bce9d4c - <unknown>
  22:        0x10bc41b23 - <unknown>
  23:        0x10bc258b4 - <unknown>
  24:        0x10bc23ad2 - <unknown>
  25:        0x10bc4d945 - <unknown>
  26:        0x10bc606ad - <unknown>
  27:        0x10e77ad2f - <unknown>
  28:        0x10bc61157 - <unknown>
  29:        0x10e74ca1e - <unknown>
  30:        0x10e779a6e - <unknown>
  31:     0x7fff697d6e65 - <unknown>

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.40.0 (73528e339 2019-12-16) running on x86_64-apple-darwin

note: compiler flags: -C debuginfo=2 -C incremental -C target-cpu=native --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 `mammut`.

Caused by:
  process didn't exit successfully: `rustc --edition=2018 --crate-name mammut src/lib.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type lib --emit=dep-info,metadata,link -C debuginfo=2 -C metadata=c809cf0fdf8620be -C extra-filename=-c809cf0fdf8620be --out-dir /Users/ep/src/rust/mammut/target/debug/deps -C incremental=/Users/ep/src/rust/mammut/target/debug/incremental -L dependency=/Users/ep/src/rust/mammut/target/debug/deps --extern chrono=/Users/ep/src/rust/mammut/target/debug/deps/libchrono-72684b2f28e9fe2c.rmeta --extern doc_comment=/Users/ep/src/rust/mammut/target/debug/deps/libdoc_comment-3f3009ca6b5845ea.rmeta --extern hyperx=/Users/ep/src/rust/mammut/target/debug/deps/libhyperx-58cd697042051998.rmeta --extern log=/Users/ep/src/rust/mammut/target/debug/deps/liblog-43677abba509ad49.rmeta --extern reqwest=/Users/ep/src/rust/mammut/target/debug/deps/libreqwest-6f1b39962470a51c.rmeta --extern serde=/Users/ep/src/rust/mammut/target/debug/deps/libserde-7aa2ed46f2c9d0ab.rmeta --extern serde_derive=/Users/ep/src/rust/mammut/target/debug/deps/libserde_derive-5701627921a25966.dylib --extern serde_json=/Users/ep/src/rust/mammut/target/debug/deps/libserde_json-14989846f8d6cd6d.rmeta --extern url=/Users/ep/src/rust/mammut/target/debug/deps/liburl-63a14c7395b66a8f.rmeta -C target-cpu=native` (exit code: 101)
@csmoe

This comment has been minimized.

Copy link
Member

@csmoe csmoe commented Jan 1, 2020

Reproduced with lastest nighlty:

thread 'rustc' panicked at 'no entry found for key', src/libcore/option.rs:1188:5
stack backtrace:
   0: backtrace::backtrace::libunwind::trace
             at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.40/src/backtrace/libunwind.rs:88
   1: backtrace::backtrace::trace_unsynchronized
             at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.40/src/backtrace/mod.rs:66
   2: std::sys_common::backtrace::_print_fmt
             at src/libstd/sys_common/backtrace.rs:77
   3: <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt
             at src/libstd/sys_common/backtrace.rs:59
   4: core::fmt::write
             at src/libcore/fmt/mod.rs:1057
   5: std::io::Write::write_fmt
             at src/libstd/io/mod.rs:1426
   6: std::sys_common::backtrace::_print
             at src/libstd/sys_common/backtrace.rs:62
   7: std::sys_common::backtrace::print
             at src/libstd/sys_common/backtrace.rs:49
   8: std::panicking::default_hook::{{closure}}
             at src/libstd/panicking.rs:195
   9: std::panicking::default_hook
             at src/libstd/panicking.rs:215
  10: rustc_driver::report_ice
  11: <alloc::boxed::Box<F> as core::ops::function::Fn<A>>::call
             at /rustc/119307a83e12291a3fc126735d6bd0292c443464/src/liballoc/boxed.rs:1029
  12: proc_macro::bridge::client::<impl proc_macro::bridge::Bridge>::enter::{{closure}}::{{closure}}
             at /rustc/119307a83e12291a3fc126735d6bd0292c443464/src/libproc_macro/bridge/client.rs:305
  13: std::panicking::rust_panic_with_hook
             at src/libstd/panicking.rs:476
  14: rust_begin_unwind
             at src/libstd/panicking.rs:376
  15: core::panicking::panic_fmt
             at src/libcore/panicking.rs:84
  16: core::option::expect_failed
             at src/libcore/option.rs:1188
  17: rustc::hir::map::definitions::Definitions::invocation_parent
  18: rustc_resolve::macros::<impl rustc_expand::base::Resolver for rustc_resolve::Resolver>::visit_ast_fragment_with_placeholders
  19: rustc_expand::expand::MacroExpander::collect_invocations
  20: rustc_expand::expand::MacroExpander::fully_expand_fragment
  21: rustc_expand::expand::MacroExpander::expand_crate
  22: rustc_interface::passes::configure_and_expand_inner::{{closure}}
  23: rustc::util::common::time
  24: rustc_interface::passes::configure_and_expand::{{closure}}
  25: rustc_interface::passes::configure_and_expand
  26: rustc_interface::queries::Queries::expansion
  27: rustc_interface::interface::run_compiler_in_existing_thread_pool
  28: scoped_tls::ScopedKey<T>::set
  29: syntax::with_globals
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

ICE from macro resolving I believe.

pub fn invocation_parent(&self, invoc_id: ExpnId) -> DefIndex {
self.invocation_parents[&invoc_id]
}

cc @petrochenkov

@Centril

This comment was marked as resolved.

Copy link
Member

@Centril Centril commented Jan 2, 2020

@pnkfelix

This comment has been minimized.

Copy link
Member

@pnkfelix pnkfelix commented Jan 2, 2020

triage: P-high, removing nomination tag. (instead, going to proritize going through the P-high issues that have accumulated over last two weeks.)

@tmandry

This comment has been minimized.

Copy link
Contributor

@tmandry tmandry commented Jan 7, 2020

Visiting from triage.. the next step is to reduce the reproducer.

@lqd

This comment has been minimized.

Copy link
Contributor

@lqd lqd commented Jan 7, 2020

Reduced (playground):

macro_rules! doc_comment {
    ($x: expr, $($tt: tt)*) => {
        #[doc = $x]
        $($tt)*
    };
}

macro_rules! paged_routes {
     ($($rest: tt)* ) => {
         doc_comment! {
            concat!("", ""), 
            async fn name() {} 
        } 
        paged_routes! {
            $($rest)* 
        } 
    }; 
    () => {} 
}
impl Mastodon {
    paged_routes! {
    }
}
@petrochenkov petrochenkov self-assigned this Jan 8, 2020
@gilescope gilescope removed their assignment Jan 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.