Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

"Error constructed but not emitted" with rocket annotations #47612

Closed
TatriX opened this issue Jan 20, 2018 · 1 comment · Fixed by #48990
Closed

"Error constructed but not emitted" with rocket annotations #47612

TatriX opened this issue Jan 20, 2018 · 1 comment · Fixed by #48990
Labels
A-decl-macros-2-0 Area: Declarative macros 2.0 (#39412) 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.

Comments

@TatriX
Copy link

TatriX commented Jan 20, 2018

I get a compiler panic due to typo in the annotations.

I tried this code (note double equal sign near "data"):

#[put("/user", data= = "<user")]
fn put_user(user: Json<UpdateUser>, conn: db::Conn) -> Option<Json<Value>> {

I expected to see this happen: proper compiler error.

Instead, this happened:

error: internal compiler error: Error constructed but not emitted

error: internal compiler error: unexpected panic

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

Meta

rustc --version --verbose:

rustc 1.25.0-nightly (e6072a7b3 2018-01-13)
binary: rustc
commit-hash: e6072a7b3835f1875e81c9fd27799f9b20a0770c
commit-date: 2018-01-13
host: x86_64-unknown-linux-gnu
release: 1.25.0-nightly
LLVM version: 4.0

Backtrace:

stack backtrace:
   0:     0x7f2d41212bab - std::sys::unix::backtrace::tracing::imp::unwind_backtrace::h5f6d52492915cd4e
                               at libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
   1:     0x7f2d412278d1 - std::sys_common::backtrace::print::h431edf3a15f44d21
                               at libstd/sys_common/backtrace.rs:68
                               at libstd/sys_common/backtrace.rs:57
   2:     0x7f2d41200e00 - std::panicking::default_hook::{{closure}}::h6e28a80c80ad398d
                               at libstd/panicking.rs:380
   3:     0x7f2d412008c3 - std::panicking::default_hook::h5de848639374d88c
                               at libstd/panicking.rs:390
   4:     0x7f2d4120130b - std::panicking::rust_panic_with_hook::h8d3a97e694abd4a9
                               at libstd/panicking.rs:576
   5:     0x7f2d3bd07d73 - std::panicking::begin_panic::h4687289c571ccf20
   6:     0x7f2d3bd0d5b1 - <rustc_errors::diagnostic_builder::DiagnosticBuilder<'a> as core::ops::drop::Drop>::drop::h6583338a8bed2e63
   7:     0x7f2d3c10e520 - syntax::ext::expand::MacroExpander::expand_invoc::heb9ed1c8308e0934
   8:     0x7f2d3c10a129 - syntax::ext::expand::MacroExpander::expand::hc44fb8af8eb869d3
   9:     0x7f2d3c10942f - syntax::ext::expand::MacroExpander::expand_crate::hb1eba0195e743d05
  10:     0x7f2d415f4775 - rustc_driver::driver::phase_2_configure_and_expand::{{closure}}::h92112561a18f0999
  11:     0x7f2d415e63bc - rustc::util::common::time::h78a5414e854c78df
  12:     0x7f2d41663d6c - rustc_driver::driver::phase_2_configure_and_expand::h521e21b4d485b113
  13:     0x7f2d416600d5 - rustc_driver::driver::compile_input::hd4b83a842d537951
  14:     0x7f2d41669d21 - rustc_driver::run_compiler::h4a2fad22b4a0e7b6
  15:     0x7f2d4156d0c1 - std::sys_common::backtrace::__rust_begin_short_backtrace::hf660c0a0bc4d2860
  16:     0x7f2d4124c6ee - __rust_maybe_catch_panic
                               at libpanic_unwind/lib.rs:102
  17:     0x7f2d415b8be2 - <F as alloc::boxed::FnBox<A>>::call_box::hc2176842fb5e0582
  18:     0x7f2d412216e7 - std::sys_common::thread::start_thread::h63baebbba56a8844
                               at /checkout/src/liballoc/boxed.rs:827
                               at libstd/sys_common/thread.rs:24
  19:     0x7f2d4122acb8 - std::sys::unix::thread::Thread::new::thread_start::h30e00ffa8c70cc92
                               at libstd/sys/unix/thread.rs:90
  20:     0x7f2d3b25208b - start_thread
  21:     0x7f2d40ef4e1e - __GI___clone
  22:                0x0 - <unknown>

@TatriX TatriX changed the title "Error constructed but not emitted" with rocket annoations "Error constructed but not emitted" with rocket annotations Jan 20, 2018
@pietroalbini pietroalbini added 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. A-decl-macros-2-0 Area: Declarative macros 2.0 (#39412) C-bug Category: This is a bug. labels Jan 21, 2018
@dtolnay
Copy link
Member

dtolnay commented Jan 25, 2018

@anxiousmodernman reported a similar issue in #47315.

#[post("/task"), data = "<task>"] // Syntax error!
fn create_task(db: State<Arc<sled::Tree>>, task: Json<Task>) -> status::Accepted<String> {
    status::Accepted(Some(format!("success")))
}

The same internal compiler error: Error constructed but not emitted.

kennytm added a commit to kennytm/rust that referenced this issue Mar 15, 2018
Fix ICE on malformed plugin attributes

See rust-lang#48941 for some discussion.

This bug had several duplicate reports which were never closed as dupes:

Fixes rust-lang#47612
Fixes rust-lang#48387
Fixes rust-lang#48941
Fixes rust-lang#48982
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
A-decl-macros-2-0 Area: Declarative macros 2.0 (#39412) 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.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants