Closed
Description
Hello
Try to run this code:
fn main() {
pretty_env_logger::init();
let address = ([127, 0, 0, 1], 3000).into();
let pool = Arc::new(Database::get_pool());
let root_node = Arc::new(RootNode::new(Query, Mutation));
let ctx = Arc::new(Context { pool: pool.clone() });
let service = move || {
let root_node = root_node.clone();
let ctx = ctx.clone();
service_fn(
move |req| -> Box<Future<Item = Response<Body>, Error = _> + Send> {
let root_node = root_node.clone();
let ctx = ctx.clone();
match (req.method(), req.uri().path()) {
(&Method::GET, "/") => Box::new(juniper_hyper::graphiql("/graphql")),
(&Method::GET, "/graphql") => {
Box::new(juniper_hyper::graphql(root_node, ctx, req))
}
(&Method::POST, "/graphql") => {
Box::new(juniper_hyper::graphql(root_node, ctx, req))
}
_ => {
let mut response = Response::new(Body::empty());
*response.status_mut() = StatusCode::NOT_FOUND;
Box::new(future::ok(response))
}
}
},
)
};
let server = Server::bind(&address)
.serve(service)
.map_err(|e| eprintln!("server error: {}", e));
println!("Listening on http://{}", address);
rt::run(server);
}
And get this ICE:
error: internal compiler error: src/librustc_mir/borrow_check/nll/universal_regions.rs:744: cannot convert `ReScope(Node(238))` to a region vid
thread 'rustc' panicked at 'Box<Any>', src/librustc_errors/lib.rs:588:9
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
1: std::sys_common::backtrace::_print
2: std::panicking::default_hook::{{closure}}
3: std::panicking::default_hook
4: rustc::util::common::panic_hook
5: std::panicking::rust_panic_with_hook
6: std::panicking::begin_panic
7: rustc_errors::Handler::bug
8: rustc::util::bug::opt_span_bug_fmt::{{closure}}
9: rustc::ty::context::tls::with_opt::{{closure}}
10: rustc::ty::context::tls::with_context_opt
11: rustc::ty::context::tls::with_opt
12: rustc::util::bug::opt_span_bug_fmt
13: rustc::util::bug::bug_fmt
14: rustc_mir::borrow_check::nll::universal_regions::UniversalRegionIndices::to_region_vid::{{closure}}
15: rustc_mir::borrow_check::nll::universal_regions::UniversalRegionIndices::to_region_vid
16: rustc_mir::borrow_check::nll::type_check::constraint_conversion::ConstraintConversion::convert_all
17: rustc_mir::borrow_check::nll::type_check::TypeChecker::prove_predicate
18: rustc_mir::borrow_check::nll::type_check::TypeChecker::check_stmt
19: rustc_mir::borrow_check::nll::type_check::TypeChecker::typeck_mir
20: rustc_mir::borrow_check::nll::type_check::type_check
21: rustc_mir::borrow_check::nll::compute_regions
22: rustc_mir::borrow_check::do_mir_borrowck
23: rustc::ty::context::GlobalCtxt::enter_local
24: rustc_mir::borrow_check::mir_borrowck
25: rustc::ty::query::__query_compute::mir_borrowck
26: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors<'tcx> for rustc::ty::query::queries::mir_borrowck<'tcx>>::compute
27: rustc::dep_graph::graph::DepGraph::with_task_impl
28: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::try_get_with
29: rustc_mir::borrow_check::nll::type_check::TypeChecker::check_stmt
30: rustc_mir::borrow_check::nll::type_check::TypeChecker::typeck_mir
31: rustc_mir::borrow_check::nll::type_check::type_check
32: rustc_mir::borrow_check::nll::compute_regions
33: rustc_mir::borrow_check::do_mir_borrowck
34: rustc::ty::context::GlobalCtxt::enter_local
35: rustc_mir::borrow_check::mir_borrowck
36: rustc::ty::query::__query_compute::mir_borrowck
37: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors<'tcx> for rustc::ty::query::queries::mir_borrowck<'tcx>>::compute
38: rustc::dep_graph::graph::DepGraph::with_task_impl
39: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::try_get_with
40: rustc_mir::borrow_check::nll::type_check::TypeChecker::check_stmt
41: rustc_mir::borrow_check::nll::type_check::TypeChecker::typeck_mir
42: rustc_mir::borrow_check::nll::type_check::type_check
43: rustc_mir::borrow_check::nll::compute_regions
44: rustc_mir::borrow_check::do_mir_borrowck
45: rustc::ty::context::GlobalCtxt::enter_local
46: rustc_mir::borrow_check::mir_borrowck
47: rustc::ty::query::__query_compute::mir_borrowck
48: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors<'tcx> for rustc::ty::query::queries::mir_borrowck<'tcx>>::compute
49: rustc::dep_graph::graph::DepGraph::with_task_impl
50: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::try_get_with
51: rustc::ty::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::par_body_owners
52: rustc::util::common::time
53: <std::thread::local::LocalKey<T>>::with
54: rustc::ty::context::TyCtxt::create_and_enter
55: rustc_driver::driver::compile_input
56: rustc_driver::run_compiler_with_pool
57: <scoped_tls::ScopedKey<T>>::set
58: rustc_driver::run_compiler
59: <scoped_tls::ScopedKey<T>>::set
query stack during panic:
#0 [mir_borrowck] processing `main::{{closure}}::{{closure}}`
#1 [mir_borrowck] processing `main::{{closure}}`
#2 [mir_borrowck] processing `main`
end of query stack
error: aborting due to previous error
Seems the problem is here:
(&Method::GET, "/graphql") => {
Box::new(juniper_hyper::graphql(root_node, ctx, req))
}
(&Method::POST, "/graphql") => {
Box::new(juniper_hyper::graphql(root_node, ctx, req))
}
Meta
rustc 1.33.0 (2aa4c46cf 2019-02-28)
binary: rustc
commit-hash: 2aa4c46cfdd726e97360c2734835aa3515e8c858
commit-date: 2019-02-28
host: x86_64-apple-darwin
release: 1.33.0
LLVM version: 8.0
Thanks