rust-lang / rust-lang/rust-analyzer
panic: `associated types not allowed on auto traits`
Open
Nobody has claimed this yet.
B-unstable
C-bug
I-panic
- Dominant language
- Rust
- Stars
- 16.9k
- Forks
- 2.2k
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 72
Description
auto trait Trait {
type Output;
}
fn main() {
let _: <() as Trait>::Output = () ;
}
RUSTFLAGS="" ~/.rustup/toolchains/master/bin/rust-analyzer highlight < code.rs
thread 'main' (3595569) panicked at src/tools/rust-analyzer/crates/hir-ty/src/next_solver/interner.rs:1830:9:
Bug encountered in next-trait-solver: associated types not allowed on auto traits
stack backtrace:
0: 0x7f4511a0a566 - <<std[7a677e1801b0b374]::sys::backtrace::BacktraceLock>::print::DisplayBacktrace as core[8947f86082328bb0]::fmt::Display>::fmt
1: 0x7f451200ec88 - core[8947f86082328bb0]::fmt::write
2: 0x7f4511a1f9dc - <std[7a677e1801b0b374]::sys::stdio::unix::Stderr as core[8947f86082328bb0]::io::write::Write>::write_fmt
3: 0x7f45119de8ea - std[7a677e1801b0b374]::panicking::default_hook::{closure#0}
4: 0x7f45119fcc83 - std[7a677e1801b0b374]::panicking::default_hook
5: 0x7f45119fd0eb - std[7a677e1801b0b374]::panicking::panic_with_hook
6: 0x7f45119de9a2 - std[7a677e1801b0b374]::panicking::panic_handler::{closure#0}
7: 0x7f45119d2e89 - std[7a677e1801b0b374]::sys::backtrace::__rust_end_short_backtrace::<std[7a677e1801b0b374]::panicking::panic_handler::{closure#0}, !>
8: 0x7f45119e02fd - __rustc[3266c8557f45551c]::rust_begin_unwind
9: 0x7f450e75c47c - core[8947f86082328bb0]::panicking::panic_fmt
10: 0x560afefad9e1 - <hir_ty[93cf116e5217208d]::next_solver::interner::DbInterner as ra_ap_rustc_type_ir[4c7ad565f4fbbb32]::interner::Interner>::delay_bug::<&str>
11: 0x560afee9fd05 - <ra_ap_rustc_next_trait_solver[6f4571a0989d1e5b]::solve::eval_ctxt::EvalCtxt<hir_ty[93cf116e5217208d]::next_solver::solver::SolverContext, hir_ty[93cf116e5217208d]::next_solver::interner::DbInterner>>::assemble_and_evaluate_candidates::<ra_ap_rustc_type_ir[4c7ad565f4fbbb32]::predicate::NormalizesTo<hir_ty[93cf116e5217208d]::next_solver::interner::DbInterner>>
12: 0x560aff110c13 - <ra_ap_rustc_type_ir[4c7ad565f4fbbb32]::search_graph::SearchGraph<ra_ap_rustc_next_trait_solver[6f4571a0989d1e5b]::solve::search_graph::SearchGraphDelegate<hir_ty[93cf116e5217208d]::next_solver::solver::SolverContext>, hir_ty[93cf116e5217208d]::next_solver::interner::DbInterner>>::evaluate_goal_in_task
13: 0x560aff104c38 - <ra_ap_rustc_type_ir[4c7ad565f4fbbb32]::search_graph::SearchGraph<ra_ap_rustc_next_trait_solver[6f4571a0989d1e5b]::solve::search_graph::SearchGraphDelegate<hir_ty[93cf116e5217208d]::next_solver::solver::SolverContext>, hir_ty[93cf116e5217208d]::next_solver::interner::DbInterner>>::evaluate_goal
14: 0x560aff09a304 - <ra_ap_rustc_next_trait_solver[6f4571a0989d1e5b]::solve::eval_ctxt::EvalCtxt<hir_ty[93cf116e5217208d]::next_solver::solver::SolverContext, hir_ty[93cf116e5217208d]::next_solver::interner::DbInterner>>::evaluate_goal_raw
15: 0x560aff09bb4f - <ra_ap_rustc_next_trait_solver[6f4571a0989d1e5b]::solve::eval_ctxt::EvalCtxt<hir_ty[93cf116e5217208d]::next_solver::solver::SolverContext, hir_ty[93cf116e5217208d]::next_solver::interner::DbInterner>>::try_evaluate_added_goals
16: 0x560aff10c9c4 - <ra_ap_rustc_type_ir[4c7ad565f4fbbb32]::search_graph::SearchGraph<ra_ap_rustc_next_trait_solver[6f4571a0989d1e5b]::solve::search_graph::SearchGraphDelegate<hir_ty[93cf116e5217208d]::next_solver::solver::SolverContext>, hir_ty[93cf116e5217208d]::next_solver::interner::DbInterner>>::evaluate_goal_in_task
17: 0x560aff104c38 - <ra_ap_rustc_type_ir[4c7ad565f4fbbb32]::search_graph::SearchGraph<ra_ap_rustc_next_trait_solver[6f4571a0989d1e5b]::solve::search_graph::SearchGraphDelegate<hir_ty[93cf116e5217208d]::next_solver::solver::SolverContext>, hir_ty[93cf116e5217208d]::next_solver::interner::DbInterner>>::evaluate_goal
18: 0x560aff09a304 - <ra_ap_rustc_next_trait_solver[6f4571a0989d1e5b]::solve::eval_ctxt::EvalCtxt<hir_ty[93cf116e5217208d]::next_solver::solver::SolverContext, hir_ty[93cf116e5217208d]::next_solver::interner::DbInterner>>::evaluate_goal_raw
19: 0x560aff099859 - <ra_ap_rustc_next_trait_solver[6f4571a0989d1e5b]::solve::eval_ctxt::EvalCtxt<hir_ty[93cf116e5217208d]::next_solver::solver::SolverContext, hir_ty[93cf116e5217208d]::next_solver::interner::DbInterner>>::evaluate_goal
20: 0x560aff2b0b17 - <hir_ty[93cf116e5217208d]::next_solver::solver::SolverContext as ra_ap_rustc_next_trait_solver[6f4571a0989d1e5b]::solve::eval_ctxt::SolverDelegateEvalExt>::evaluate_root_goal
21: 0x560aff0ad495 - <hir_ty[93cf116e5217208d]::next_solver::fulfill::FulfillmentCtxt>::try_evaluate_obligations
22: 0x560aff008ca8 - <hir_ty[93cf116e5217208d]::next_solver::infer::at::At>::structurally_normalize_term
23: 0x560aff145e45 - <hir_ty[93cf116e5217208d]::infer::unify::InferenceTable>::try_structurally_resolve_type
24: 0x560aff012562 - <hir_ty[93cf116e5217208d]::infer::InferenceContext>::infer_expr_inner
25: 0x560aff0103d7 - <hir_ty[93cf116e5217208d]::infer::InferenceContext>::infer_return
26: 0x560aff16e91e - hir_ty[93cf116e5217208d]::infer::infer_query_with_inspect
27: 0x560aff05e4a4 - <salsa[f6baacb4446d11cc]::function::IngredientImpl<<hir_ty[93cf116e5217208d]::infer::InferenceResult>::for_body::_::for_body__Configuration_>>::execute
28: 0x560afee29377 - <salsa[f6baacb4446d11cc]::attach::Attached>::attach::<dyn hir_ty[93cf116e5217208d]::db::HirDatabase, &hir_ty[93cf116e5217208d]::infer::InferenceResult, <hir_ty[93cf116e5217208d]::infer::InferenceResult>::for_body::for_body_::{closure#0}>
29: 0x560afea88c3c - <hir[7d9bbb24bae6c127]::semantics::SemanticsImpl>::get_unsafe_ops
30: 0x560aff3f3313 - ide[6233e951667d8107]::syntax_highlighting::highlight
31: 0x560aff42d03e - ide[6233e951667d8107]::syntax_highlighting::html::highlight_as_html_with_config
32: 0x560aff393e4c - <ide[6233e951667d8107]::Analysis>::highlight_as_html
33: 0x560affde2932 - <rust_analyzer[9f47c25af0fec260]::cli::flags::Highlight>::run
34: 0x560b000820f4 - rust_analyzer[9193986eb7972329]::main
35: 0x560b000187d3 - std[7a677e1801b0b374]::sys::backtrace::__rust_begin_short_backtrace::<fn() -> core[8947f86082328bb0]::result::Result<std[7a677e1801b0b374]::process::ExitCode, anyhow[6c3359fcb7bf7f47]::Error>, core[8947f86082328bb0]::result::Result<std[7a677e1801b0b374]::process::ExitCode, anyhow[6c3359fcb7bf7f47]::Error>>
36: 0x560b0007b142 - std[7a677e1801b0b374]::rt::lang_start::<core[8947f86082328bb0]::result::Result<std[7a677e1801b0b374]::process::ExitCode, anyhow[6c3359fcb7bf7f47]::Error>>::{closure#0}
37: 0x7f451316b599 - std[7a677e1801b0b374]::rt::lang_start_internal
38: 0x560b0009b238 - main
39: 0x7f450ca27741 - <unknown>
40: 0x7f450ca27879 - __libc_start_main
41: 0x560afe98c709 - <unknown>
42: 0x0 - <unknown>
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the panic with the provided Rust snippet and rust-analyzer highlight command. Start at src/tools/rust-analyzer/crates/hir-ty/src/next_solver/interner.rs:1830, then follow the type-solver path shown in the trace. Done means highlighting this input completes without a panic and the regression is covered by a test if the relevant test location is found.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers, devtools
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100