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

missing specialization: <serialize::json::Encoder as SpecializedEncoder<syntax_pos::symbol::Ident>>::specialized_encode not overridden #63728

Closed
tesuji opened this issue Aug 20, 2019 · 0 comments · Fixed by #63853
Assignees
Labels
A-specialization Area: Trait impl specialization C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ requires-nightly This issue requires a nightly compiler in some way. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@tesuji
Copy link
Contributor

tesuji commented Aug 20, 2019

The following code when compiled with -Z ast-json causes ICE:

pub fn main() {
    let a = ["1", "lol", "3", "NaN", "5"];

    let element: Option<i32> = a.iter().filter_map(|s| s.parse().ok()).next();
    assert_eq!(element, Some(1));
}

Error:

% RUST_BACKTRACE=1 cargo rustc -- -Z ast-json
   Compiling check v0.1.0 (/home/lzutao/forked/rust/check)
thread 'rustc' panicked at 'missing specialization: `<serialize::json::Encoder as SpecializedEncoder<syntax_pos::symbol::Ident>>::specialized_encode` not overridden', src/libserialize/serialize.rs:851:9
stack backtrace:
   0: backtrace::backtrace::libunwind::trace
             at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.35/src/backtrace/libunwind.rs:88
   1: backtrace::backtrace::trace_unsynchronized
             at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.35/src/backtrace/mod.rs:66
   2: std::sys_common::backtrace::_print
             at src/libstd/sys_common/backtrace.rs:47
   3: std::sys_common::backtrace::print
             at src/libstd/sys_common/backtrace.rs:36
   4: std::panicking::default_hook::{{closure}}
             at src/libstd/panicking.rs:200
   5: std::panicking::default_hook
             at src/libstd/panicking.rs:214
   6: rustc::util::common::panic_hook
   7: std::panicking::rust_panic_with_hook
             at src/libstd/panicking.rs:481
   8: std::panicking::continue_panic_fmt
             at src/libstd/panicking.rs:384
   9: std::panicking::begin_panic_fmt
             at src/libstd/panicking.rs:339
  10: <E as serialize::serialize::SpecializationError>::not_found
  11: <serialize::json::Encoder as serialize::serialize::Encoder>::emit_struct
  12: <serialize::json::Encoder as serialize::serialize::Encoder>::emit_seq
  13: <serialize::json::Encoder as serialize::serialize::Encoder>::emit_struct
  14: <serialize::json::Encoder as serialize::serialize::Encoder>::emit_struct
  15: <serialize::json::AsJson<T> as core::fmt::Display>::fmt
  16: core::fmt::write
             at src/libcore/fmt/mod.rs:1029
  17: std::io::Write::write_fmt
             at src/libstd/io/mod.rs:1399
  18: <std::io::stdio::Stdout as std::io::Write>::write_fmt
             at src/libstd/io/stdio.rs:533
  19: std::io::stdio::print_to::{{closure}}
             at src/libstd/io/stdio.rs:786
  20: std::thread::local::LocalKey<T>::try_with
             at src/libstd/thread/local.rs:262
  21: std::io::stdio::print_to
             at src/libstd/io/stdio.rs:780
  22: std::io::stdio::_print
             at src/libstd/io/stdio.rs:802
  23: rustc_interface::passes::configure_and_expand_inner
  24: rustc_interface::passes::configure_and_expand::{{closure}}
  25: rustc_data_structures::box_region::PinnedGenerator<I,A,R>::new
  26: rustc_interface::passes::configure_and_expand
  27: rustc_interface::queries::Query<T>::compute
  28: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::expansion
  29: rustc_interface::interface::run_compiler_in_existing_thread_pool
  30: std::thread::local::LocalKey<T>::with
  31: scoped_tls::ScopedKey<T>::set
  32: syntax::with_globals
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
query stack during panic:
end of query stack

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.39.0-nightly (c1b08dd26 2019-08-19) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z ast-json -C debuginfo=2 -C incremental --crate-type lib

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

{"module":{"inner":{"lo":0,"hi":174},"items":[{"ident":
error: Could not compile `check`.

To learn more, run the command again with --verbose.
@jonas-schievink jonas-schievink added A-specialization Area: Trait impl specialization 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. requires-nightly This issue requires a nightly compiler in some way. labels Aug 20, 2019
@matthewjasper matthewjasper self-assigned this Aug 20, 2019
Centril added a commit to Centril/rust that referenced this issue Aug 27, 2019
…n, r=estebank

Add default serialization for `Ident`s

Also add tests for `-Zast-json` and `-Zast-json-noexpand`

closes rust-lang#63728
@bors bors closed this as completed in c422372 Aug 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-specialization Area: Trait impl specialization C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ requires-nightly This issue requires a nightly compiler in some way. 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