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

ICE when non-trait type was used in trait position #2499

Open
MahadMuhammad opened this issue Aug 1, 2023 · 0 comments
Open

ICE when non-trait type was used in trait position #2499

MahadMuhammad opened this issue Aug 1, 2023 · 0 comments
Assignees
Labels

Comments

@MahadMuhammad
Copy link
Contributor

ICE - non-trait type was used in trait position such as a bound or impl.


I tried this Code from E0404

#![allow(unused)]
fn main() {
struct Foo;
struct Bar;

impl Foo for Bar {} // error: `Foo` is not a trait
fn baz<T: Foo>(t: T) {} // error: `Foo` is not a trait
}

Meta

  • What version of Rust GCC were you using, git sha dba8bc5.
  • gccrs (Compiler-Explorer-Build-gcc-22f4c74767bddcb9813dca06fc6a354a67d05343-binutils-2.40) 13.0.1 20230417 (experimental)

Error output

  • Internal Compile Error.
Backtrace

➜  gccrs-build gcc/crab1 ../mahad-testsuite/E0404.rs 
crab1: internal compiler error: in resolve_path_to_trait, at rust/typecheck/rust-hir-trait-resolve.cc:129
0x7be3d9 Rust::Resolver::TraitResolver::resolve_path_to_trait(Rust::HIR::TypePath const&, Rust::HIR::Trait**) const
  ../../gccrs/gcc/rust/typecheck/rust-hir-trait-resolve.cc:129
0xc5cd67 Rust::Resolver::TraitResolver::resolve_path(Rust::HIR::TypePath&)
  ../../gccrs/gcc/rust/typecheck/rust-hir-trait-resolve.cc:139
0xc5cd67 Rust::Resolver::TraitResolver::Resolve(Rust::HIR::TypePath&)
  ../../gccrs/gcc/rust/typecheck/rust-hir-trait-resolve.cc:89
0xc62369 Rust::Resolver::TypeCheckItem::resolve_impl_block_substitutions(Rust::HIR::ImplBlock&, bool&)
  ../../gccrs/gcc/rust/typecheck/rust-hir-type-check-item.cc:562
0xc686a9 Rust::Resolver::TypeCheckItem::visit(Rust::HIR::ImplBlock&)
  ../../gccrs/gcc/rust/typecheck/rust-hir-type-check-item.cc:392
0xc621f0 Rust::Resolver::TypeCheckItem::Resolve(Rust::HIR::Item&)
  ../../gccrs/gcc/rust/typecheck/rust-hir-type-check-item.cc:49
0xc621f0 Rust::Resolver::TypeCheckItem::Resolve(Rust::HIR::Item&)
  ../../gccrs/gcc/rust/typecheck/rust-hir-type-check-item.cc:35
0xc8134f ???
  ../../gccrs/gcc/rust/typecheck/rust-hir-type-check-stmt.h:36
0xc8142c Rust::Resolver::TypeCheckStmt::Resolve(Rust::HIR::Stmt*)
  ../../gccrs/gcc/rust/typecheck/rust-hir-type-check-stmt.cc:34
0xc78e04 Rust::Resolver::TypeCheckExpr::visit(Rust::HIR::BlockExpr&)
  ../../gccrs/gcc/rust/typecheck/rust-hir-type-check-expr.cc:551
0xc77c83 Rust::Resolver::TypeCheckExpr::Resolve(Rust::HIR::Expr*)
  ../../gccrs/gcc/rust/typecheck/rust-hir-type-check-expr.cc:41
0xc676ea Rust::Resolver::TypeCheckItem::visit(Rust::HIR::Function&)
  ../../gccrs/gcc/rust/typecheck/rust-hir-type-check-item.cc:496
0xc621f0 Rust::Resolver::TypeCheckItem::Resolve(Rust::HIR::Item&)
  ../../gccrs/gcc/rust/typecheck/rust-hir-type-check-item.cc:49
0xc621f0 Rust::Resolver::TypeCheckItem::Resolve(Rust::HIR::Item&)
  ../../gccrs/gcc/rust/typecheck/rust-hir-type-check-item.cc:35
0xc2877b Rust::Resolver::TypeResolution::Resolve(Rust::HIR::Crate&)
  ../../gccrs/gcc/rust/typecheck/rust-hir-type-check.cc:37
0xab7d56 Rust::Session::compile_crate(char const*)
  ../../gccrs/gcc/rust/rust-session-manager.cc:640
Please submit a full bug report, with preprocessed source (by using -freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

Fixing this issue, will also help gccrs to produce error code similiar to rustc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants