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

Rustc crash with Rocket #48982

Closed
Ronaldho80 opened this issue Mar 13, 2018 · 2 comments · Fixed by #48990
Closed

Rustc crash with Rocket #48982

Ronaldho80 opened this issue Mar 13, 2018 · 2 comments · Fixed by #48990
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@Ronaldho80
Copy link

Rustc reports an internal compiler error: unexpected panic by compiling a Rocket program.

I guess the problem is a logically wrong function call by calling two "#get" functions which are close to being similar which should report an error.

This is the code of failure:

#[get("/")]
fn lipmato(_user: UserId, ctrl: State<SafeController>, flash: Option<FlashMessage>) -> Template {

    let tmpl = &mut TemplateLipmato::from_controller(
        &ctrl,
    );
    
    if flash.is_some() {
        tmpl.error_occured(flash.unwrap().msg().to_string());
    }

    Template::render(
        "lipmato",
        tmpl)
}

// this function below should probably report an error. If I do not call this function, rustc works well. Otherwise it crashes.
#[get("/"), rank = 2]
fn lipmato(_user: UserId, ctrl: State<SafeController>) -> Redirect {

    if let Some(user) = ctrl.lock().unwrap().get_user_by_id(_user.0) {
        if !user.allow_lipmato {
            Redirect::to("/login")
        }
    }
}

Meta

herzog@Elfriede:~/Lipotype/ltx2/webapp-rs (master)*
$ cargo run --verbose
       Fresh ena v0.5.0
       Fresh bytecount v0.3.1
       Fresh fixedbitset v0.1.8
       Fresh bitflags v0.7.0
       Fresh language-tags v0.2.2
       Fresh encoding_index_tests v0.1.4
       Fresh termcolor v0.3.5
       Fresh untrusted v0.5.1
       Fresh safemem v0.2.0
       Fresh typeable v0.1.2
       Fresh term v0.4.6
       Fresh traitobject v0.1.0
       Fresh num-traits v0.2.1
       Fresh humansize v1.1.0
       Fresh percent-encoding v1.0.1
       Fresh gcc v0.3.54
       Fresh unidecode v0.2.0
       Fresh lazy_static v0.2.11
       Fresh winapi v0.2.8
       Fresh quick-error v1.2.1
       Fresh vec_map v0.8.0
       Fresh diff v0.1.11
       Fresh unicode-xid v0.1.0
       Fresh pkg-config v0.3.9
       Fresh data-encoding v2.1.1
       Fresh glob v0.2.11
       Fresh modifier v0.1.0
       Fresh itertools v0.4.19
       Fresh yansi v0.3.4
       Fresh linked-hash-map v0.5.1
       Fresh unicode-xid v0.0.4
       Fresh bit-vec v0.4.4
       Fresh dtoa v0.4.2
       Fresh regex-syntax v0.4.2
       Fresh rustc-serialize v0.3.24
       Fresh void v1.0.2
       Fresh ascii v0.7.1
       Fresh scoped_threadpool v0.1.9
       Fresh strsim v0.6.0
       Fresh linked-hash-map v0.4.2
       Fresh libc v0.2.39
       Fresh rustc-demangle v0.1.7
       Fresh ucd-util v0.1.1
       Fresh smallvec v0.4.4
       Fresh lalrpop-util v0.13.1 (file:///home/herzog/Lipotype/_rs/lalrpop/lalrpop-util)
       Fresh strsim v0.7.0
       Fresh ordermap v0.3.5
       Fresh cc v1.0.6
       Fresh quote v0.3.15
       Fresh chunked_transfer v0.3.1
       Fresh byteorder v0.5.3
       Fresh difference v2.0.0
       Fresh unicode-xid v0.0.3
       Fresh pear v0.0.12
       Fresh byteorder v1.2.1
       Fresh serde v1.0.30
       Fresh unicode-normalization v0.1.5
       Fresh siphasher v0.2.2
       Fresh lazy_static v1.0.0
       Fresh nodrop v0.1.12
       Fresh ordermap v0.2.13
       Fresh either v1.4.0
       Fresh winapi-build v0.1.1
       Fresh bitflags v1.0.1
       Fresh unicode-width v0.1.4
       Fresh memoffset v0.2.1
       Fresh ansi_term v0.11.0
       Fresh httparse v1.2.4
       Fresh cfg-if v0.1.2
       Fresh utf8-ranges v1.0.0
       Fresh version_check v0.1.3
       Fresh lalrpop-intern v0.13.1 (file:///home/herzog/Lipotype/_rs/lalrpop/lalrpop-intern)
       Fresh scopeguard v0.3.3
       Fresh hex v0.2.0
       Fresh state v0.3.3
       Fresh pest v0.4.1
       Fresh itoa v0.3.4
       Fresh matches v0.1.6
       Fresh xml-rs v0.3.6
       Fresh encoding-index-korean v1.20141219.5
       Fresh encoding-index-singlebyte v1.20141219.5
       Fresh encoding-index-tradchinese v1.20141219.5
       Fresh encoding-index-japanese v1.20141219.5
       Fresh encoding-index-simpchinese v1.20141219.5
       Fresh ascii-canvas v1.0.0
       Fresh term-painter v0.2.4
       Fresh error v0.1.9
       Fresh unsafe-any v0.4.2
       Fresh num-integer v0.1.36
       Fresh slug v0.1.2
       Fresh humantime v1.1.1
       Fresh proc-macro2 v0.2.3
       Fresh synom v0.11.3
       Fresh bit-set v0.4.0
       Fresh conduit-mime-types v0.7.3
       Fresh unreachable v1.0.0
       Fresh lru-cache v0.1.1
       Fresh time v0.1.39
       Fresh memchr v2.0.1
       Fresh memchr v1.0.2
       Fresh hostname v0.1.4
       Fresh isatty v0.1.6
       Fresh atty v0.2.8
       Fresh num_cpus v1.8.0
       Fresh rand v0.4.2
       Fresh regex-syntax v0.5.2
       Fresh petgraph v0.4.11
       Fresh csv v0.14.7
       Fresh base64 v0.6.0
       Fresh base64 v0.9.0
       Fresh toml v0.4.5
       Fresh arrayvec v0.4.7
       Fresh itertools v0.5.10
       Fresh xml-rs v0.7.0
       Fresh textwrap v0.9.0
       Fresh crossbeam-utils v0.2.2
       Fresh log v0.4.1
       Fresh serde_json v1.0.11
       Fresh unicode-bidi v0.3.4
       Fresh encoding v0.2.33
       Fresh typemap v0.3.3
       Fresh num-iter v0.1.35
       Fresh quote v0.4.2
       Fresh syn v0.11.11
       Fresh thread_local v0.3.5
       Fresh twoway v0.1.7
       Fresh aho-corasick v0.6.4
       Fresh csv v0.15.0
       Fresh buf_redux v0.6.3
       Fresh threadpool v1.7.1
       Fresh rand v0.3.22
       Fresh clap v2.31.1
       Fresh crossbeam-epoch v0.3.0
       Fresh log v0.3.9
       Fresh idna v0.1.4
       Fresh plugin v0.2.6
       Fresh num v0.1.42
       Fresh syn v0.12.14
       Fresh libsqlite3-sys v0.9.1
       Fresh derive-error-chain v0.11.0
       Fresh regex v0.2.9
       Fresh uuid v0.1.18
       Fresh rust-crypto v0.2.36
       Fresh backtrace-sys v0.1.16
       Fresh miniz-sys v0.1.10
       Fresh kernel32-sys v0.2.2
       Fresh crossbeam-deque v0.2.0
       Fresh mime v0.2.6
       Fresh pear_codegen v0.0.12
       Fresh unicase v1.4.2
       Fresh url v1.7.0
       Fresh chrono v0.2.25
       Fresh chrono v0.4.0
       Fresh serde_derive_internals v0.20.0
       Fresh env_logger v0.5.5
       Fresh docopt v0.7.0
       Fresh url v0.2.38
       Fresh pwhash v0.1.2
       Fresh backtrace v0.3.5
       Fresh flate2 v0.2.20
       Fresh atty v0.1.2
       Fresh remove_dir_all v0.3.0
       Fresh pbr v1.0.0-alpha.2 (file:///home/herzog/Lipotype/_rs/pb)
       Fresh rayon-core v1.4.0
       Fresh phf_shared v0.7.21
       Fresh hyper v0.10.13
       Fresh bson v0.11.1
       Fresh rusqlite v0.13.0
       Fresh flexi_logger v0.6.14
       Fresh serde_derive v1.0.30
       Fresh tiny_http v0.5.9
       Fresh error-chain v0.10.0
       Fresh error-chain v0.11.0
       Fresh sgml v0.1.0 (file:///home/herzog/Lipotype/ltx2/backend/sgml)
       Fresh lalrpop-snap v0.13.1 (file:///home/herzog/Lipotype/_rs/lalrpop/lalrpop-snap)
       Fresh tempdir v0.3.6
       Fresh rayon v0.7.1
       Fresh phf v0.7.21
       Fresh phf_generator v0.7.21
       Fresh iron v0.5.1
       Fresh chemsc v0.1.0 (file:///home/herzog/Lipotype/ltx2/backend/chemsc)
       Fresh tera v0.10.10
       Fresh dotenv v0.11.0
       Fresh phf_codegen v0.7.21
       Fresh config v0.1.0 (file:///home/herzog/Lipotype/ltx2/backend/config)
       Fresh lalrpop v0.13.1 (file:///home/herzog/Lipotype/_rs/lalrpop/lalrpop)
       Fresh ring v0.11.0
       Fresh cookie v0.9.2
       Fresh mime_guess v1.8.4
       Fresh rocket v0.3.6
       Fresh rocket v0.3.6 (file:///home/herzog/Lipotype/_rs/Rocket/lib)
       Fresh multipart v0.13.1 (file:///home/herzog/Lipotype/_rs/multipart)
       Fresh mfql v0.1.0 (file:///home/herzog/Lipotype/ltx2/backend/mfql)
       Fresh rocket-simpleauth v0.3.0 (file:///home/herzog/Lipotype/_rs/auth-rs)
       Fresh rocket_codegen v0.3.6 (file:///home/herzog/Lipotype/_rs/Rocket/codegen)
       Fresh rocket_contrib v0.3.6 (file:///home/herzog/Lipotype/_rs/Rocket/contrib)
       Fresh masterscan v0.1.0 (file:///home/herzog/Lipotype/ltx2/backend/masterscan)
       Fresh identifier v0.1.0 (file:///home/herzog/Lipotype/ltx2/backend/identifier)
   Compiling webapp v0.1.0 (file:///home/herzog/Lipotype/ltx2/webapp-rs)
     Running `rustc --crate-name webapp src/main.rs --crate-type bin --emit=dep-info,link -C debuginfo=2 -C metadata=e5134a661d18bea6 -C extra-filename=-e5134a661d18bea6 --out-dir /home/herzog/Lipotype/ltx2/webapp-rs/target/debug/deps -C incremental=/home/herzog/Lipotype/ltx2/webapp-rs/target/debug/incremental -L dependency=/home/herzog/Lipotype/ltx2/webapp-rs/target/debug/deps --extern identifier=/home/herzog/Lipotype/ltx2/webapp-rs/target/debug/deps/libidentifier-ecde33b94536b274.rlib --extern serde_derive=/home/herzog/Lipotype/ltx2/webapp-rs/target/debug/deps/libserde_derive-9ef300bae18f17d9.so --extern rustc_serialize=/home/herzog/Lipotype/ltx2/webapp-rs/target/debug/deps/librustc_serialize-bf5c97f604e4ef03.rlib --extern rocket=/home/herzog/Lipotype/ltx2/webapp-rs/target/debug/deps/librocket-f99ac287ddf2c766.rlib --extern chemsc=/home/herzog/Lipotype/ltx2/webapp-rs/target/debug/deps/libchemsc-cb707da6de644f23.rlib --extern dotenv=/home/herzog/Lipotype/ltx2/webapp-rs/target/debug/deps/libdotenv-34c6ff00f9a4b787.rlib --extern rusqlite=/home/herzog/Lipotype/ltx2/webapp-rs/target/debug/deps/librusqlite-5664e987999b25a6.rlib --extern config=/home/herzog/Lipotype/ltx2/webapp-rs/target/debug/deps/libconfig-8ca0b2bf5fa88b55.rlib --extern serde_json=/home/herzog/Lipotype/ltx2/webapp-rs/target/debug/deps/libserde_json-ba4c2990989a04b9.rlib --extern flexi_logger=/home/herzog/Lipotype/ltx2/webapp-rs/target/debug/deps/libflexi_logger-365847d141d31962.rlib --extern chrono=/home/herzog/Lipotype/ltx2/webapp-rs/target/debug/deps/libchrono-7253c7191da6dcfd.rlib --extern rocket_simpleauth=/home/herzog/Lipotype/ltx2/webapp-rs/target/debug/deps/librocket_simpleauth-f6f087242fb21a05.rlib --extern pwhash=/home/herzog/Lipotype/ltx2/webapp-rs/target/debug/deps/libpwhash-d16dcdec3e942cba.rlib --extern log=/home/herzog/Lipotype/ltx2/webapp-rs/target/debug/deps/liblog-be8fd45b81578a9c.rlib --extern rocket_contrib=/home/herzog/Lipotype/ltx2/webapp-rs/target/debug/deps/librocket_contrib-92f14a190b0ae9d9.rlib --extern time=/home/herzog/Lipotype/ltx2/webapp-rs/target/debug/deps/libtime-78bfec62797427f9.rlib --extern multipart=/home/herzog/Lipotype/ltx2/webapp-rs/target/debug/deps/libmultipart-7c58dc6c197c6807.rlib --extern rocket_codegen=/home/herzog/Lipotype/ltx2/webapp-rs/target/debug/deps/librocket_codegen.so --extern regex=/home/herzog/Lipotype/ltx2/webapp-rs/target/debug/deps/libregex-88fde11c8200a853.rlib --extern serde=/home/herzog/Lipotype/ltx2/webapp-rs/target/debug/deps/libserde-5b036d096353ceb0.rlib --extern mfql=/home/herzog/Lipotype/ltx2/webapp-rs/target/debug/deps/libmfql-e19c5a5dd359cf3c.rlib --extern webapp=/home/herzog/Lipotype/ltx2/webapp-rs/target/debug/deps/libwebapp-235791e339709820.rlib -L native=/home/herzog/Lipotype/ltx2/webapp-rs/target/debug/build/rust-crypto-39daf7f7f6152475/out -L native=/home/herzog/Lipotype/ltx2/webapp-rs/target/debug/build/backtrace-sys-95d5acac02bbebb5/out/.libs -L native=/home/herzog/Lipotype/ltx2/webapp-rs/target/debug/build/miniz-sys-3922c4e1dc390d77/out -L native=/home/herzog/Lipotype/ltx2/webapp-rs/target/debug/build/ring-a072ff1445a1f647/out`
error: internal compiler error: Error constructed but not emitted

thread 'rustc' panicked at 'explicit panic', librustc_errors/diagnostic_builder.rs:242:13
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
stack backtrace:
   0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
             at libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
   1: std::sys_common::backtrace::_print
             at libstd/sys_common/backtrace.rs:71
   2: std::panicking::default_hook::{{closure}}
             at libstd/sys_common/backtrace.rs:59
             at libstd/panicking.rs:207
   3: std::panicking::default_hook
             at libstd/panicking.rs:223
   4: core::ops::function::Fn::call
   5: std::panicking::rust_panic_with_hook
             at libstd/panicking.rs:403
   6: std::panicking::begin_panic
   7: <rustc_errors::diagnostic_builder::DiagnosticBuilder<'a> as core::ops::drop::Drop>::drop
   8: syntax::ext::expand::MacroExpander::expand_invoc
   9: syntax::ext::expand::MacroExpander::expand
  10: syntax::ext::expand::MacroExpander::expand_crate
  11: rustc_driver::driver::phase_2_configure_and_expand_inner::{{closure}}
  12: rustc_driver::driver::phase_2_configure_and_expand_inner
  13: rustc_driver::driver::compile_input
  14: rustc_driver::run_compiler

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.26.0-nightly (2789b067d 2018-03-06) running on x86_64-unknown-linux-gnu

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

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

error: Could not compile `webapp`.

Caused by:
  process didn't exit successfully: `rustc --crate-name webapp src/main.rs --crate-type bin --emit=dep-info,link -C debuginfo=2 -C metadata=e5134a661d18bea6 -C extra-filename=-e5134a661d18bea6 --out-dir /home/herzog/Lipotype/ltx2/webapp-rs/target/debug/deps -C incremental=/home/herzog/Lipotype/ltx2/webapp-rs/target/debug/incremental -L dependency=/home/herzog/Lipotype/ltx2/webapp-rs/target/debug/deps --extern identifier=/home/herzog/Lipotype/ltx2/webapp-rs/target/debug/deps/libidentifier-ecde33b94536b274.rlib --extern serde_derive=/home/herzog/Lipotype/ltx2/webapp-rs/target/debug/deps/libserde_derive-9ef300bae18f17d9.so --extern rustc_serialize=/home/herzog/Lipotype/ltx2/webapp-rs/target/debug/deps/librustc_serialize-bf5c97f604e4ef03.rlib --extern rocket=/home/herzog/Lipotype/ltx2/webapp-rs/target/debug/deps/librocket-f99ac287ddf2c766.rlib --extern chemsc=/home/herzog/Lipotype/ltx2/webapp-rs/target/debug/deps/libchemsc-cb707da6de644f23.rlib --extern dotenv=/home/herzog/Lipotype/ltx2/webapp-rs/target/debug/deps/libdotenv-34c6ff00f9a4b787.rlib --extern rusqlite=/home/herzog/Lipotype/ltx2/webapp-rs/target/debug/deps/librusqlite-5664e987999b25a6.rlib --extern config=/home/herzog/Lipotype/ltx2/webapp-rs/target/debug/deps/libconfig-8ca0b2bf5fa88b55.rlib --extern serde_json=/home/herzog/Lipotype/ltx2/webapp-rs/target/debug/deps/libserde_json-ba4c2990989a04b9.rlib --extern flexi_logger=/home/herzog/Lipotype/ltx2/webapp-rs/target/debug/deps/libflexi_logger-365847d141d31962.rlib --extern chrono=/home/herzog/Lipotype/ltx2/webapp-rs/target/debug/deps/libchrono-7253c7191da6dcfd.rlib --extern rocket_simpleauth=/home/herzog/Lipotype/ltx2/webapp-rs/target/debug/deps/librocket_simpleauth-f6f087242fb21a05.rlib --extern pwhash=/home/herzog/Lipotype/ltx2/webapp-rs/target/debug/deps/libpwhash-d16dcdec3e942cba.rlib --extern log=/home/herzog/Lipotype/ltx2/webapp-rs/target/debug/deps/liblog-be8fd45b81578a9c.rlib --extern rocket_contrib=/home/herzog/Lipotype/ltx2/webapp-rs/target/debug/deps/librocket_contrib-92f14a190b0ae9d9.rlib --extern time=/home/herzog/Lipotype/ltx2/webapp-rs/target/debug/deps/libtime-78bfec62797427f9.rlib --extern multipart=/home/herzog/Lipotype/ltx2/webapp-rs/target/debug/deps/libmultipart-7c58dc6c197c6807.rlib --extern rocket_codegen=/home/herzog/Lipotype/ltx2/webapp-rs/target/debug/deps/librocket_codegen.so --extern regex=/home/herzog/Lipotype/ltx2/webapp-rs/target/debug/deps/libregex-88fde11c8200a853.rlib --extern serde=/home/herzog/Lipotype/ltx2/webapp-rs/target/debug/deps/libserde-5b036d096353ceb0.rlib --extern mfql=/home/herzog/Lipotype/ltx2/webapp-rs/target/debug/deps/libmfql-e19c5a5dd359cf3c.rlib --extern webapp=/home/herzog/Lipotype/ltx2/webapp-rs/target/debug/deps/libwebapp-235791e339709820.rlib -L native=/home/herzog/Lipotype/ltx2/webapp-rs/target/debug/build/rust-crypto-39daf7f7f6152475/out -L native=/home/herzog/Lipotype/ltx2/webapp-rs/target/debug/build/backtrace-sys-95d5acac02bbebb5/out/.libs -L native=/home/herzog/Lipotype/ltx2/webapp-rs/target/debug/build/miniz-sys-3922c4e1dc390d77/out -L native=/home/herzog/Lipotype/ltx2/webapp-rs/target/debug/build/ring-a072ff1445a1f647/out` (exit code: 101)

@sfackler sfackler added the I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ label Mar 13, 2018
@ExpHP
Copy link
Contributor

ExpHP commented Mar 13, 2018

This is #48941 again. I am working on it.

(note: it doesn't have anything to do with the names of the functions (although I imagine that probably is a problem; I don't know, I don't use Rocket).

Anyways, the ICE is happening due to the invalid syntax in the second #[get] attribute. Unfortunately the compiler dies before telling you what the error is, but that will be fixed. To fix your code, the rank = 2 should be moved into the parentheses of get())

@Ronaldho80
Copy link
Author

Ah..! I see. Thank you!

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants