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

Internal compiler error with serde::de::Error::custom #39924

Closed
bjorn3 opened this issue Feb 18, 2017 · 6 comments
Closed

Internal compiler error with serde::de::Error::custom #39924

bjorn3 opened this issue Feb 18, 2017 · 6 comments
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@bjorn3
Copy link
Member

bjorn3 commented Feb 18, 2017

Pushed my code to https://github.com/bjorn3/goodgame_empire_import/tree/ice.
I also added a comment with the line I changed before I got a ICE.

$ cargo test
   Compiling goodgame_empire_import v0.1.1 (~/Documents/goodgame_empire_import)
error[E0308]: match arms have incompatible types
  --> src/data.rs:36:17
   |
36 |                   match v {
   |  _________________^ starting here...
37 | |                     0 => World::Grass,
38 | |                     1 => World::Sand,
39 | |                     2 => World::Ice,
40 | |                     3 => World::Fire,
41 | |                     4 => World::SpecialEvent,
42 | |                     _ => panic!("Unrecognized world number {}", v),
43 | |                 }
   | |_________________^ ...ending here: expected enum `std::result::Result`, found enum `data::World`
   |
   = note: expected type `_`
              found type `data::World`
note: match arm with an incompatible type
  --> src/data.rs:37:26
   |
37 |                     0 => World::Grass,
   |                          ^^^^^^^^^^^^

error[E0308]: mismatched types
  --> src/data.rs:46:79
   |
46 |               fn expecting(&self, expecting: &mut fmt::Formatter) -> fmt::Result{
   |  _______________________________________________________________________________^ starting here...
47 | |
48 | |             }
   | |_____________^ ...ending here: expected enum `std::result::Result`, found ()
   |
   = note: expected type `std::result::Result<(), std::fmt::Error>`
              found type `()`

error[E0308]: match arms have incompatible types
  --> src/data.rs:36:17
   |
36 |                   match v {
   |  _________________^ starting here...
37 | |                     0 => World::Grass,
38 | |                     1 => World::Sand,
39 | |                     2 => World::Ice,
40 | |                     3 => World::Fire,
41 | |                     4 => World::SpecialEvent,
42 | |                     _ => panic!("Unrecognized world number {}", v),
43 | |                 }
   | |_________________^ ...ending here: expected enum `std::result::Result`, found enum `data::World`
   |
   = note: expected type `_`
              found type `data::World`
note: match arm with an incompatible type
  --> src/data.rs:37:26
   |
37 |                     0 => World::Grass,
   |                          ^^^^^^^^^^^^

error[E0308]: mismatched types
  --> src/data.rs:46:79
   |
46 |               fn expecting(&self, expecting: &mut fmt::Formatter) -> fmt::Result{
   |  _______________________________________________________________________________^ starting here...
47 | |
48 | |             }
   | |_____________^ ...ending here: expected enum `std::result::Result`, found ()
   |
   = note: expected type `std::result::Result<(), std::fmt::Error>`
              found type `()`

error: aborting due to 2 previous errors

error: Could not compile `goodgame_empire_import`.
Build failed, waiting for other jobs to finish...
error: aborting due to 2 previous errors

error: build failed
iMac:goodgame_empire_import bjorn$ cargo test
   Compiling goodgame_empire_import v0.1.1 (file:///Users/bjorn/Documents/goodgame_empire_import)
error: cannot find macro `arguments!` in this scope
  --> src/data.rs:42:43
   |
42 |                     _ => D::Error::custom(arguments!("Unrecognized world number {}", v)),
   |                                           ^^^^^^^^^

error[E0401]: can't use type parameters from outer function; try using a local type parameter instead
  --> src/data.rs:42:26
   |
42 |                     _ => D::Error::custom(arguments!("Unrecognized world number {}", v)),
   |                          ^^^^^^^^^^^^^^^^ use of type variable from outer function

error: cannot find macro `arguments!` in this scope
  --> src/data.rs:42:43
   |
42 |                     _ => D::Error::custom(arguments!("Unrecognized world number {}", v)),
   |                                           ^^^^^^^^^

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

error[E0401]: can't use type parameters from outer function; try using a local type parameter instead
  --> src/data.rs:42:26
   |
42 |                     _ => D::Error::custom(arguments!("Unrecognized world number {}", v)),
   |                          ^^^^^^^^^^^^^^^^ use of type variable from outer function

note: run with `RUST_BACKTRACE=1` for a backtrace

thread 'rustc' panicked at 'assertion failed: resolution.depth == 0 || resolution.base_def != Def::Err', src/librustc_resolve/lib.rs:3060
stack backtrace:
   1:        0x10aef01e9 - std::sys::imp::backtrace::tracing::imp::write::h9559bd7cb15d72ad
   2:        0x10aefcc9e - std::panicking::default_hook::{{closure}}::h4b3f2b69c9ce844d
   3:        0x10aefc8cb - std::panicking::default_hook::h61d415f2381a7336
   4:        0x10aefd117 - std::panicking::rust_panic_with_hook::h8e6300d8e8aca457
   5:        0x1070e3334 - std::panicking::begin_panic::h07bca7d56e8cc59f
   6:        0x10716ff18 - rustc_resolve::Resolver::record_def::h76da3c01d36079d3
   7:        0x107165972 - rustc_resolve::Resolver::smart_resolve_path_fragment::h5d76ea9688e88cd4
   8:        0x107165341 - rustc_resolve::Resolver::smart_resolve_path::hf3c46d2a237088c2
   9:        0x10716ec01 - rustc_resolve::Resolver::resolve_expr::h09b0dc21b3ab616b
  10:        0x10716e310 - rustc_resolve::Resolver::resolve_expr::h09b0dc21b3ab616b
  11:        0x1071637a3 - rustc_resolve::Resolver::resolve_arm::h23d6d148db68a5b2
  12:        0x107128eae - syntax::visit::walk_expr::h437c79100384b73b
  13:        0x10716ec0c - rustc_resolve::Resolver::resolve_expr::h09b0dc21b3ab616b
  14:        0x107163fcd - rustc_resolve::Resolver::resolve_block::hbaa1b9cd3b39d13b
  15:        0x1071566d1 - <rustc_resolve::Resolver<'a> as syntax::visit::Visitor<'tcx>>::visit_fn::hc8ab95e4e9e1018f
  16:        0x107126624 - syntax::visit::walk_impl_item::h8444851599ccdb5a
  17:        0x107160e0f - rustc_resolve::Resolver::with_type_parameter_rib::h3e6c8e0287344f15
  18:        0x1071620f1 - rustc_resolve::Resolver::with_current_self_type::h2d9f068bacea9de1
  19:        0x107162a2a - rustc_resolve::Resolver::with_self_rib::hc4caf49323a9c233
  20:        0x107162478 - rustc_resolve::Resolver::with_optional_trait_ref::ha2a0f64226efba95
  21:        0x1071627ae - rustc_resolve::Resolver::with_self_rib::h3225ea62b06fd17b
  22:        0x10715f9b8 - rustc_resolve::Resolver::resolve_item::h4583f1200c5cff01
  23:        0x107163fb5 - rustc_resolve::Resolver::resolve_block::hbaa1b9cd3b39d13b
  24:        0x1071566d1 - <rustc_resolve::Resolver<'a> as syntax::visit::Visitor<'tcx>>::visit_fn::hc8ab95e4e9e1018f
  25:        0x107126624 - syntax::visit::walk_impl_item::h8444851599ccdb5a
  26:        0x107160e0f - rustc_resolve::Resolver::with_type_parameter_rib::h3e6c8e0287344f15
  27:        0x1071620f1 - rustc_resolve::Resolver::with_current_self_type::h2d9f068bacea9de1
  28:        0x107162a2a - rustc_resolve::Resolver::with_self_rib::hc4caf49323a9c233
  29:        0x107162478 - rustc_resolve::Resolver::with_optional_trait_ref::ha2a0f64226efba95
  30:        0x1071627ae - rustc_resolve::Resolver::with_self_rib::h3225ea62b06fd17b
  31:        0x10715f9b8 - rustc_resolve::Resolver::resolve_item::h4583f1200c5cff01
  32:        0x10712925e - syntax::visit::walk_item::hf987c90749bc584f
  33:        0x10715fb8f - rustc_resolve::Resolver::resolve_item::h4583f1200c5cff01
  34:        0x10715924e - rustc_resolve::Resolver::resolve_crate::he366a34c39e14f9e
  35:        0x105ed59a1 - rustc_driver::driver::phase_2_configure_and_expand::hb928c8ce49deb9dc
  36:        0x105ecb36d - rustc_driver::driver::compile_input::hd50a6918443232a0
  37:        0x105f1321e - rustc_driver::run_compiler::h5151bfc01962b066
  38:        0x105e28928 - std::panicking::try::do_call::h9e86b95d9c931e3d
  39:        0x10aeffd6a - __rust_maybe_catch_panic
  40:        0x105e51353 - <F as alloc::boxed::FnBox<A>>::call_box::ha55b035dd9316cf5
  41:        0x10aefbdc4 - std::sys::imp::thread::Thread::new::thread_start::h80e9dc7cc1dfe0d2
  42:     0x7fff89bfa99c - _pthread_body
  43:     0x7fff89bfa919 - _pthread_start

error: Could not compile `goodgame_empire_import`.
Build failed, waiting for other jobs to finish...
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: run with `RUST_BACKTRACE=1` for a backtrace

thread 'rustc' panicked at 'assertion failed: resolution.depth == 0 || resolution.base_def != Def::Err', src/librustc_resolve/lib.rs:3060
stack backtrace:
   1:        0x113b081e9 - std::sys::imp::backtrace::tracing::imp::write::h9559bd7cb15d72ad
   2:        0x113b14c9e - std::panicking::default_hook::{{closure}}::h4b3f2b69c9ce844d
   3:        0x113b148cb - std::panicking::default_hook::h61d415f2381a7336
   4:        0x113b15117 - std::panicking::rust_panic_with_hook::h8e6300d8e8aca457
   5:        0x10fceb334 - std::panicking::begin_panic::h07bca7d56e8cc59f
   6:        0x10fd77f18 - rustc_resolve::Resolver::record_def::h76da3c01d36079d3
   7:        0x10fd6d972 - rustc_resolve::Resolver::smart_resolve_path_fragment::h5d76ea9688e88cd4
   8:        0x10fd6d341 - rustc_resolve::Resolver::smart_resolve_path::hf3c46d2a237088c2
   9:        0x10fd76c01 - rustc_resolve::Resolver::resolve_expr::h09b0dc21b3ab616b
  10:        0x10fd76310 - rustc_resolve::Resolver::resolve_expr::h09b0dc21b3ab616b
  11:        0x10fd6b7a3 - rustc_resolve::Resolver::resolve_arm::h23d6d148db68a5b2
  12:        0x10fd30eae - syntax::visit::walk_expr::h437c79100384b73b
  13:        0x10fd76c0c - rustc_resolve::Resolver::resolve_expr::h09b0dc21b3ab616b
  14:        0x10fd6bfcd - rustc_resolve::Resolver::resolve_block::hbaa1b9cd3b39d13b
  15:        0x10fd5e6d1 - <rustc_resolve::Resolver<'a> as syntax::visit::Visitor<'tcx>>::visit_fn::hc8ab95e4e9e1018f
  16:        0x10fd2e624 - syntax::visit::walk_impl_item::h8444851599ccdb5a
  17:        0x10fd68e0f - rustc_resolve::Resolver::with_type_parameter_rib::h3e6c8e0287344f15
  18:        0x10fd6a0f1 - rustc_resolve::Resolver::with_current_self_type::h2d9f068bacea9de1
  19:        0x10fd6aa2a - rustc_resolve::Resolver::with_self_rib::hc4caf49323a9c233
  20:        0x10fd6a478 - rustc_resolve::Resolver::with_optional_trait_ref::ha2a0f64226efba95
  21:        0x10fd6a7ae - rustc_resolve::Resolver::with_self_rib::h3225ea62b06fd17b
  22:        0x10fd679b8 - rustc_resolve::Resolver::resolve_item::h4583f1200c5cff01
  23:        0x10fd6bfb5 - rustc_resolve::Resolver::resolve_block::hbaa1b9cd3b39d13b
  24:        0x10fd5e6d1 - <rustc_resolve::Resolver<'a> as syntax::visit::Visitor<'tcx>>::visit_fn::hc8ab95e4e9e1018f
  25:        0x10fd2e624 - syntax::visit::walk_impl_item::h8444851599ccdb5a
  26:        0x10fd68e0f - rustc_resolve::Resolver::with_type_parameter_rib::h3e6c8e0287344f15
  27:        0x10fd6a0f1 - rustc_resolve::Resolver::with_current_self_type::h2d9f068bacea9de1
  28:        0x10fd6aa2a - rustc_resolve::Resolver::with_self_rib::hc4caf49323a9c233
  29:        0x10fd6a478 - rustc_resolve::Resolver::with_optional_trait_ref::ha2a0f64226efba95
  30:        0x10fd6a7ae - rustc_resolve::Resolver::with_self_rib::h3225ea62b06fd17b
  31:        0x10fd679b8 - rustc_resolve::Resolver::resolve_item::h4583f1200c5cff01
  32:        0x10fd3125e - syntax::visit::walk_item::hf987c90749bc584f
  33:        0x10fd67b8f - rustc_resolve::Resolver::resolve_item::h4583f1200c5cff01
  34:        0x10fd6124e - rustc_resolve::Resolver::resolve_crate::he366a34c39e14f9e
  35:        0x10eae79a1 - rustc_driver::driver::phase_2_configure_and_expand::hb928c8ce49deb9dc
  36:        0x10eadd36d - rustc_driver::driver::compile_input::hd50a6918443232a0
  37:        0x10eb2521e - rustc_driver::run_compiler::h5151bfc01962b066
  38:        0x10ea3a928 - std::panicking::try::do_call::h9e86b95d9c931e3d
  39:        0x113b17d6a - __rust_maybe_catch_panic
  40:        0x10ea63353 - <F as alloc::boxed::FnBox<A>>::call_box::ha55b035dd9316cf5
  41:        0x113b13dc4 - std::sys::imp::thread::Thread::new::thread_start::h80e9dc7cc1dfe0d2
  42:     0x7fff89bfa99c - _pthread_body
  43:     0x7fff89bfa919 - _pthread_start

error: build failed
$
$ rustup show
Default host: x86_64-apple-darwin

installed toolchains
--------------------

stable-x86_64-apple-darwin (default)
beta-2016-12-20-x86_64-apple-darwin
nightly-2016-04-14-x86_64-apple-darwin
nightly-2016-04-25-x86_64-apple-darwin
nightly-2016-09-29-x86_64-apple-darwin
nightly-2016-09-30-x86_64-apple-darwin
nightly-2016-12-29-x86_64-apple-darwin
nightly-x86_64-apple-darwin
nightly-x86_64-pc-windows-gnu

installed targets for active toolchain
--------------------------------------

i686-unknown-linux-gnu
wasm32-unknown-emscripten
x86_64-apple-darwin

active toolchain
----------------

nightly-x86_64-apple-darwin (directory override for '~/Documents/goodgame_empire_import')
rustc 1.17.0-nightly (536a900c4 2017-02-17)
@bjorn3
Copy link
Member Author

bjorn3 commented Feb 18, 2017

Can reporduce with https://gist.github.com/bjorn3/8820dcb2e1257cd072918b71a6742ba5:

$ cargo build
   Compiling rustc_ice__serde_de_Error_custom__arguments v0.1.0 (~/Documents/rustc_ice__serde_de_Error_custom__arguments)
error: cannot find macro `arguments!` in this scope
  --> src/lib.rs:45:43
   |
45 |                     _ => D::Error::custom(arguments!("Unrecognized world number {}", v)),
   |                                           ^^^^^^^^^

error[E0401]: can't use type parameters from outer function; try using a local type parameter instead
  --> src/lib.rs:45:26
   |
45 |                     _ => D::Error::custom(arguments!("Unrecognized world number {}", v)),
   |                          ^^^^^^^^^^^^^^^^ use of type variable from outer function

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: run with `RUST_BACKTRACE=1` for a backtrace

thread 'rustc' panicked at 'assertion failed: resolution.depth == 0 || resolution.base_def != Def::Err', src/librustc_resolve/lib.rs:3060
stack backtrace:
   1:        0x108b0e1e9 - std::sys::imp::backtrace::tracing::imp::write::h9559bd7cb15d72ad
   2:        0x108b1ac9e - std::panicking::default_hook::{{closure}}::h4b3f2b69c9ce844d
   3:        0x108b1a8cb - std::panicking::default_hook::h61d415f2381a7336
   4:        0x108b1b117 - std::panicking::rust_panic_with_hook::h8e6300d8e8aca457
   5:        0x104cdf334 - std::panicking::begin_panic::h07bca7d56e8cc59f
   6:        0x104d6bf18 - rustc_resolve::Resolver::record_def::h76da3c01d36079d3
   7:        0x104d61972 - rustc_resolve::Resolver::smart_resolve_path_fragment::h5d76ea9688e88cd4
   8:        0x104d61341 - rustc_resolve::Resolver::smart_resolve_path::hf3c46d2a237088c2
   9:        0x104d6ac01 - rustc_resolve::Resolver::resolve_expr::h09b0dc21b3ab616b
  10:        0x104d6a310 - rustc_resolve::Resolver::resolve_expr::h09b0dc21b3ab616b
  11:        0x104d5f7a3 - rustc_resolve::Resolver::resolve_arm::h23d6d148db68a5b2
  12:        0x104d24eae - syntax::visit::walk_expr::h437c79100384b73b
  13:        0x104d6ac0c - rustc_resolve::Resolver::resolve_expr::h09b0dc21b3ab616b
  14:        0x104d5ffcd - rustc_resolve::Resolver::resolve_block::hbaa1b9cd3b39d13b
  15:        0x104d526d1 - <rustc_resolve::Resolver<'a> as syntax::visit::Visitor<'tcx>>::visit_fn::hc8ab95e4e9e1018f
  16:        0x104d22624 - syntax::visit::walk_impl_item::h8444851599ccdb5a
  17:        0x104d5ce0f - rustc_resolve::Resolver::with_type_parameter_rib::h3e6c8e0287344f15
  18:        0x104d5e0f1 - rustc_resolve::Resolver::with_current_self_type::h2d9f068bacea9de1
  19:        0x104d5ea2a - rustc_resolve::Resolver::with_self_rib::hc4caf49323a9c233
  20:        0x104d5e478 - rustc_resolve::Resolver::with_optional_trait_ref::ha2a0f64226efba95
  21:        0x104d5e7ae - rustc_resolve::Resolver::with_self_rib::h3225ea62b06fd17b
  22:        0x104d5b9b8 - rustc_resolve::Resolver::resolve_item::h4583f1200c5cff01
  23:        0x104d5ffb5 - rustc_resolve::Resolver::resolve_block::hbaa1b9cd3b39d13b
  24:        0x104d526d1 - <rustc_resolve::Resolver<'a> as syntax::visit::Visitor<'tcx>>::visit_fn::hc8ab95e4e9e1018f
  25:        0x104d22624 - syntax::visit::walk_impl_item::h8444851599ccdb5a
  26:        0x104d5ce0f - rustc_resolve::Resolver::with_type_parameter_rib::h3e6c8e0287344f15
  27:        0x104d5e0f1 - rustc_resolve::Resolver::with_current_self_type::h2d9f068bacea9de1
  28:        0x104d5ea2a - rustc_resolve::Resolver::with_self_rib::hc4caf49323a9c233
  29:        0x104d5e478 - rustc_resolve::Resolver::with_optional_trait_ref::ha2a0f64226efba95
  30:        0x104d5e7ae - rustc_resolve::Resolver::with_self_rib::h3225ea62b06fd17b
  31:        0x104d5b9b8 - rustc_resolve::Resolver::resolve_item::h4583f1200c5cff01
  32:        0x104d5524e - rustc_resolve::Resolver::resolve_crate::he366a34c39e14f9e
  33:        0x103ae09a1 - rustc_driver::driver::phase_2_configure_and_expand::hb928c8ce49deb9dc
  34:        0x103ad636d - rustc_driver::driver::compile_input::hd50a6918443232a0
  35:        0x103b1e21e - rustc_driver::run_compiler::h5151bfc01962b066
  36:        0x103a33928 - std::panicking::try::do_call::h9e86b95d9c931e3d
  37:        0x108b1dd6a - __rust_maybe_catch_panic
  38:        0x103a5c353 - <F as alloc::boxed::FnBox<A>>::call_box::ha55b035dd9316cf5
  39:        0x108b19dc4 - std::sys::imp::thread::Thread::new::thread_start::h80e9dc7cc1dfe0d2
  40:     0x7fff89bfa99c - _pthread_body
  41:     0x7fff89bfa919 - _pthread_start

error: Could not compile `rustc_ice__serde_de_Error_custom__arguments`.

To learn more, run the command again with --verbose.

@bjorn3 bjorn3 changed the title Internal compiler error with serde::de::Error::custom and arguments!() Internal compiler error with serde::de::Error::custom Feb 18, 2017
@keeperofdakeys
Copy link
Contributor

keeperofdakeys commented Feb 18, 2017

I suspect that this PR caused it #39752. I tried this on the 2017-02-12 nightly, and it gave an error about arguments with no ICE.

cc: @jseyfried

@bjorn3
Copy link
Member Author

bjorn3 commented Feb 18, 2017

Using format_args!() instead of arguments!() also gives an ice.

@keeperofdakeys
Copy link
Contributor

This doesn't occur on the 2017-02-16 nightly.

@jseyfried
Copy link
Contributor

cc @petrochenkov

@petrochenkov
Copy link
Contributor

Looks like a duplicate of #39559

@steveklabnik steveklabnik added the I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ label Feb 18, 2017
bors added a commit that referenced this issue Feb 19, 2017
Fix two ICEs in path resolution

Fixes #39535
Fixes #39559
Fixes #39924

r? @eddyb
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

No branches or pull requests

5 participants