tower-web icon indicating copy to clipboard operation
tower-web copied to clipboard

Using `@content_type("text/plain")` with structs that should be JSON has an inscrutable message

Open shepmaster opened this issue 7 years ago • 0 comments

thread 'tokio-runtime-worker-2' panicked at 'called `Result::unwrap()` on an `Err` value: ImpossibleSerialization("struct")', libcore/result.rs:945:5
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
             at libstd/sys_common/backtrace.rs:59
   2: std::panicking::default_hook::{{closure}}
             at libstd/panicking.rs:211
   3: std::panicking::default_hook
             at libstd/panicking.rs:227
   4: <std::panicking::begin_panic::PanicPayload<A> as core::panic::BoxMeUp>::get
             at libstd/panicking.rs:475
   5: std::panicking::continue_panic_fmt
             at libstd/panicking.rs:390
   6: std::panicking::try::do_call
             at libstd/panicking.rs:325
   7: core::ptr::drop_in_place
             at libcore/panicking.rs:77
   8: core::result::unwrap_failed
             at /Users/travis/build/rust-lang/rust/src/libcore/macros.rs:26
   9: <core::result::Result<T, E>>::unwrap
             at /Users/travis/build/rust-lang/rust/src/libcore/result.rs:782
  10: <tower_web::response::serializer::DefaultSerializer as tower_web::response::serializer::Serializer>::serialize
             at /Users/shep/Projects/tower-web/src/response/serializer.rs:79
  11: <tower_web::response::context::Context<'a, S>>::serialize
             at /Users/shep/Projects/tower-web/src/response/context.rs:29
  12: ui::__IMPL_RESPONSE_FOR_MetaCratesResponse::<impl tower_web::response::response::Response for ui::MetaCratesResponse>::into_http
             at src/main.rs:632
  13: <ui::tower_web_server::__IMPL_WEB_3_FOR_Meta::ResponseFuture<S, B> as futures::future::Future>::poll
             at ./<derive_resource macros>:2
  14: <T as tower_web::service::future::HttpResponseFuture>::poll_http_response
             at /Users/shep/Projects/tower-web/src/service/future.rs:44
  15: <tower_web::util::tuple::Either2<A, B> as tower_web::service::future::HttpResponseFuture>::poll_http_response
             at /Users/shep/Projects/tower-web/src/util/tuple.rs:275
  16: <tower_web::util::tuple::LiftHttpResponse<T> as futures::future::Future>::poll
             at /Users/shep/Projects/tower-web/src/util/tuple.rs:27
  17: <T as tower_web::service::future::HttpResponseFuture>::poll_http_response
             at /Users/shep/Projects/tower-web/src/service/future.rs:44
  18: <tower_web::util::tuple::Either2<A, B> as tower_web::service::future::HttpResponseFuture>::poll_http_response
             at /Users/shep/Projects/tower-web/src/util/tuple.rs:275
  19: <tower_web::util::tuple::LiftHttpResponse<T> as futures::future::Future>::poll
             at /Users/shep/Projects/tower-web/src/util/tuple.rs:27
  20: <futures::future::map::Map<A, F> as futures::future::Future>::poll
             at /Users/shep/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-0.1.23/src/future/map.rs:30
  21: <alloc::boxed::Box<F> as futures::future::Future>::poll
             at /Users/shep/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-0.1.23/src/future/mod.rs:113
  22: <hyper::proto::h1::dispatch::Server<S> as hyper::proto::h1::dispatch::Dispatch>::poll_msg
             at /Users/shep/.cargo/registry/src/github.com-1ecc6299db9ec823/hyper-0.12.7/src/proto/h1/dispatch.rs:379
  23: <hyper::proto::h1::dispatch::Dispatcher<D, Bs, I, T>>::poll_write
             at /Users/shep/.cargo/registry/src/github.com-1ecc6299db9ec823/hyper-0.12.7/src/proto/h1/dispatch.rs:237
  24: <hyper::proto::h1::dispatch::Dispatcher<D, Bs, I, T>>::poll_inner
             at /Users/shep/.cargo/registry/src/github.com-1ecc6299db9ec823/hyper-0.12.7/src/proto/h1/dispatch.rs:101
  25: <hyper::proto::h1::dispatch::Dispatcher<D, Bs, I, T>>::poll_catch
             at /Users/shep/.cargo/registry/src/github.com-1ecc6299db9ec823/hyper-0.12.7/src/proto/h1/dispatch.rs:86
  26: <hyper::proto::h1::dispatch::Dispatcher<D, Bs, I, T> as futures::future::Future>::poll
             at /Users/shep/.cargo/registry/src/github.com-1ecc6299db9ec823/hyper-0.12.7/src/proto/h1/dispatch.rs:348
  27: <futures::future::either::Either<A, B> as futures::future::Future>::poll
             at /Users/shep/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-0.1.23/src/future/either.rs:35
  28: futures::future::option::<impl futures::future::Future for core::option::Option<F>>::poll
             at /Users/shep/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-0.1.23/src/future/option.rs:12
  29: <hyper::server::conn::Connection<I, S> as futures::future::Future>::poll
             at /Users/shep/.cargo/registry/src/github.com-1ecc6299db9ec823/hyper-0.12.7/src/server/conn.rs:502
  30: <futures::future::map::Map<A, F> as futures::future::Future>::poll
             at /Users/shep/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-0.1.23/src/future/map.rs:30
  31: <futures::future::map_err::MapErr<A, F> as futures::future::Future>::poll
             at /Users/shep/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-0.1.23/src/future/map_err.rs:30
  32: core::num::<impl usize>::max_value
             at /Users/shep/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-0.1.23/src/future/mod.rs:113
  33: <bool as core::fmt::Debug>::fmt
             at /Users/shep/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-0.1.23/src/task_impl/mod.rs:289
  34: <bool as core::fmt::Debug>::fmt
             at /Users/shep/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-0.1.23/src/task_impl/mod.rs:363
  35: futures::task_impl::std::CURRENT_THREAD_NOTIFY::__init
             at /Users/shep/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-0.1.23/src/task_impl/std/mod.rs:78
  36: <bool as core::fmt::Debug>::fmt
             at /Users/shep/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-0.1.23/src/task_impl/mod.rs:363
  37: <bool as core::fmt::Debug>::fmt
             at /Users/shep/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-0.1.23/src/task_impl/mod.rs:289
  38: tokio_threadpool::task::TaskFuture::poll
             at /Users/shep/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-threadpool-0.1.5/src/task/mod.rs:292
  39: tokio_threadpool::task::Task::run::{{closure}}
             at /Users/shep/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-threadpool-0.1.5/src/task/mod.rs:165
  40: core::ops::function::FnOnce::call_once
             at /Users/travis/build/rust-lang/rust/src/libcore/ops/function.rs:223
  41: <tokio_threadpool::notifier::Forget<T>>::new
             at /Users/travis/build/rust-lang/rust/src/libstd/panic.rs:313
  42: <tokio_threadpool::notifier::Forget<T>>::new
             at /Users/travis/build/rust-lang/rust/src/libstd/panicking.rs:310
  43: panic_unwind::dwarf::eh::read_encoded_pointer
             at libpanic_unwind/lib.rs:106
  44: <tokio_threadpool::notifier::Forget<T>>::new
             at /Users/travis/build/rust-lang/rust/src/libstd/panicking.rs:289
  45: <tokio_threadpool::notifier::Forget<T>>::new
             at /Users/travis/build/rust-lang/rust/src/libstd/panic.rs:392
  46: tokio_threadpool::task::Task::run
             at /Users/shep/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-threadpool-0.1.5/src/task/mod.rs:151
  47: tokio_threadpool::worker::Worker::run_task2
             at /Users/shep/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-threadpool-0.1.5/src/worker/mod.rs:545
  48: tokio_threadpool::worker::Worker::run_task
             at /Users/shep/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-threadpool-0.1.5/src/worker/mod.rs:445
  49: tokio_threadpool::worker::Worker::try_steal_task
             at /Users/shep/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-threadpool-0.1.5/src/worker/mod.rs:412
  50: tokio_threadpool::worker::Worker::try_run_task
             at /Users/shep/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-threadpool-0.1.5/src/worker/mod.rs:297
  51: tokio_threadpool::worker::Worker::with_current::{{closure}}
             at /Users/shep/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-threadpool-0.1.5/src/worker/mod.rs:239
  52: tokio::runtime::builder::Builder::build::{{closure}}::{{closure}}::{{closure}}::{{closure}}
             at /Users/shep/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.1.7/src/runtime/builder.rs:125
  53: <std::collections::hash::table::SafeHash as core::cmp::PartialEq>::eq
             at /Users/shep/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-timer-0.2.4/src/timer/handle.rs:64
  54: std::sync::mpsc::blocking::SignalToken::cast_from_usize
             at /Users/travis/build/rust-lang/rust/src/libstd/thread/local.rs:294
  55: std::sync::mpsc::blocking::SignalToken::cast_from_usize
             at /Users/travis/build/rust-lang/rust/src/libstd/thread/local.rs:248
  56: <std::collections::hash::table::SafeHash as core::cmp::PartialEq>::eq
             at /Users/shep/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-timer-0.2.4/src/timer/handle.rs:56
  57: tokio::runtime::builder::Builder::build::{{closure}}::{{closure}}::{{closure}}
             at /Users/shep/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.1.7/src/runtime/builder.rs:124
  58: futures::task_impl::core::get_ptr
             at /Users/shep/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-timer-0.2.4/src/clock/clock.rs:136
  59: std::sync::mpsc::blocking::SignalToken::cast_from_usize
             at /Users/travis/build/rust-lang/rust/src/libstd/thread/local.rs:294
  60: std::sync::mpsc::blocking::SignalToken::cast_from_usize
             at /Users/travis/build/rust-lang/rust/src/libstd/thread/local.rs:248
  61: futures::task_impl::core::get_ptr
             at /Users/shep/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-timer-0.2.4/src/clock/clock.rs:119
  62: tokio::runtime::builder::Builder::build::{{closure}}::{{closure}}
             at /Users/shep/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.1.7/src/runtime/builder.rs:123
  63: tokio::runtime::Runtime::inner
             at /Users/shep/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-reactor-0.1.2/src/lib.rs:231
  64: std::sync::mpsc::blocking::SignalToken::cast_from_usize
             at /Users/travis/build/rust-lang/rust/src/libstd/thread/local.rs:294
  65: std::sync::mpsc::blocking::SignalToken::cast_from_usize
             at /Users/travis/build/rust-lang/rust/src/libstd/thread/local.rs:248
  66: tokio::runtime::Runtime::inner
             at /Users/shep/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-reactor-0.1.2/src/lib.rs:214
  67: tokio::runtime::builder::Builder::build::{{closure}}
             at /Users/shep/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.1.7/src/runtime/builder.rs:122
  68: tokio_threadpool::callback::Callback::call
             at /Users/shep/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-threadpool-0.1.5/src/callback.rs:21
  69: tokio_threadpool::worker::Worker::do_run::{{closure}}::{{closure}}
             at /Users/shep/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-threadpool-0.1.5/src/worker/mod.rs:121
  70: tokio_threadpool::task::queue::Queue::poll
             at /Users/shep/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-executor-0.1.2/src/global.rs:176
  71: crossbeam_epoch::collector::Handle::is_pinned
             at /Users/travis/build/rust-lang/rust/src/libstd/thread/local.rs:294
  72: crossbeam_epoch::collector::Handle::is_pinned
             at /Users/travis/build/rust-lang/rust/src/libstd/thread/local.rs:248
  73: tokio_threadpool::task::queue::Queue::poll
             at /Users/shep/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-executor-0.1.2/src/global.rs:150
  74: tokio_threadpool::worker::Worker::do_run::{{closure}}
             at /Users/shep/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-threadpool-0.1.5/src/worker/mod.rs:119
  75: crossbeam_epoch::collector::Handle::is_pinned
             at /Users/travis/build/rust-lang/rust/src/libstd/thread/local.rs:294
  76: crossbeam_epoch::collector::Handle::is_pinned
             at /Users/travis/build/rust-lang/rust/src/libstd/thread/local.rs:248
  77: tokio_threadpool::worker::Worker::do_run
             at /Users/shep/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-threadpool-0.1.5/src/worker/mod.rs:110
  78: tokio_threadpool::pool::Pool::spawn_thread::{{closure}}
             at /Users/shep/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-threadpool-0.1.5/src/pool/mod.rs:417
  79: <alloc::collections::CollectionAllocErr as core::convert::From<core::alloc::AllocErr>>::from
             at /Users/travis/build/rust-lang/rust/src/libstd/sys_common/backtrace.rs:136
  80: crossbeam_epoch::collector::Handle::is_pinned
             at /Users/travis/build/rust-lang/rust/src/libstd/thread/mod.rs:409
  81: <tokio_threadpool::notifier::Forget<T>>::new
             at /Users/travis/build/rust-lang/rust/src/libstd/panic.rs:313
  82: <tokio_threadpool::notifier::Forget<T>>::new
             at /Users/travis/build/rust-lang/rust/src/libstd/panicking.rs:310
  83: panic_unwind::dwarf::eh::read_encoded_pointer
             at libpanic_unwind/lib.rs:106
  84: <tokio_threadpool::notifier::Forget<T>>::new
             at /Users/travis/build/rust-lang/rust/src/libstd/panicking.rs:289
  85: <tokio_threadpool::notifier::Forget<T>>::new
             at /Users/travis/build/rust-lang/rust/src/libstd/panic.rs:392
  86: crossbeam_epoch::collector::Handle::is_pinned
             at /Users/travis/build/rust-lang/rust/src/libstd/thread/mod.rs:408
  87: crossbeam_epoch::collector::Handle::is_pinned
             at /Users/travis/build/rust-lang/rust/src/liballoc/boxed.rs:640
  88: std::sys::unix::thread::Thread::new::thread_start
             at /Users/travis/build/rust-lang/rust/src/liballoc/boxed.rs:650
             at libstd/sys_common/thread.rs:24
             at libstd/sys/unix/thread.rs:90
  89: _pthread_body
  90: _pthread_start
        /// @get("/meta/crates")
        /// @content_type("text/plain")
        fn meta_crates(&self) -> Result<::MetaCratesResponse, ::Error>
#[derive(Debug, Clone, Serialize)]
struct CrateInformation {
    name: String,
    version: String,
    id: String,
}

#[derive(Debug, Clone, Response)]
struct MetaCratesResponse {
    crates: Vec<CrateInformation>,
}

shepmaster avatar Jul 29 '18 15:07 shepmaster