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 - Expected Type got something else #2479

Closed
MahadMuhammad opened this issue Jul 28, 2023 · 0 comments · Fixed by #2490
Closed

ICE - Expected Type got something else #2479

MahadMuhammad opened this issue Jul 28, 2023 · 0 comments · Fixed by #2490
Assignees
Labels

Comments

@MahadMuhammad
Copy link
Contributor

MahadMuhammad commented Jul 28, 2023

Something other than type was used


I tried this code from E0573

#![allow(unused)]
fn main() {
enum Dragon {
    Born,
}

fn oblivion() -> Dragon::Born { // error!
    Dragon::Born
}

const HOBBIT: u32 = 2;
impl HOBBIT {} // error!

enum Wizard {
    Gandalf,
    Saruman,
}

trait Isengard {
    fn wizard(_: Wizard::Saruman); // error!
}
}

Meta

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

Error output

  • Segmentation fault.
Backtrace

crab1: internal compiler error: in resolve_segments, at rust/typecheck/rust-hir-type-check-type.cc:532
0x7bbc45 Rust::Resolver::TypeCheckType::resolve_segments(unsigned int, unsigned int, std::vector<std::unique_ptr<Rust::HIR::TypePathSegment, std::default_delete<Rust::HIR::TypePathSegment> >, std::allocator<std::unique_ptr<Rust::HIR::TypePathSegment, std::default_delete<Rust::HIR::TypePathSegment> > > >&, unsigned long, Rust::TyTy::BaseType*, Rust::Analysis::NodeMapping const&, Location)
  ../../gccrs/gcc/rust/typecheck/rust-hir-type-check-type.cc:532
0xc15bd1 Rust::Resolver::TypeCheckType::visit(Rust::HIR::TypePath&)
  ../../gccrs/gcc/rust/typecheck/rust-hir-type-check-type.cc:146
0xc15f95 Rust::Resolver::TypeCheckType::Resolve(Rust::HIR::Type*)
  ../../gccrs/gcc/rust/typecheck/rust-hir-type-check-type.cc:64
0xc11619 Rust::Resolver::TypeCheckItem::visit(Rust::HIR::Function&)
  ../../gccrs/gcc/rust/typecheck/rust-hir-type-check-item.cc:385
0xc0d500 Rust::Resolver::TypeCheckItem::Resolve(Rust::HIR::Item&)
  ../../gccrs/gcc/rust/typecheck/rust-hir-type-check-item.cc:49
0xc0d500 Rust::Resolver::TypeCheckItem::Resolve(Rust::HIR::Item&)
  ../../gccrs/gcc/rust/typecheck/rust-hir-type-check-item.cc:35
0xc2908f ???
  ../../gccrs/gcc/rust/typecheck/rust-hir-type-check-stmt.h:36
0xc2914c Rust::Resolver::TypeCheckStmt::Resolve(Rust::HIR::Stmt*)
  ../../gccrs/gcc/rust/typecheck/rust-hir-type-check-stmt.cc:34
0xc21034 Rust::Resolver::TypeCheckExpr::visit(Rust::HIR::BlockExpr&)
  ../../gccrs/gcc/rust/typecheck/rust-hir-type-check-expr.cc:539
0xc1fce3 Rust::Resolver::TypeCheckExpr::Resolve(Rust::HIR::Expr*)
  ../../gccrs/gcc/rust/typecheck/rust-hir-type-check-expr.cc:41
0xc1204d Rust::Resolver::TypeCheckItem::visit(Rust::HIR::Function&)
  ../../gccrs/gcc/rust/typecheck/rust-hir-type-check-item.cc:434
0xc0d500 Rust::Resolver::TypeCheckItem::Resolve(Rust::HIR::Item&)
  ../../gccrs/gcc/rust/typecheck/rust-hir-type-check-item.cc:49
0xc0d500 Rust::Resolver::TypeCheckItem::Resolve(Rust::HIR::Item&)
  ../../gccrs/gcc/rust/typecheck/rust-hir-type-check-item.cc:35
0xbd3b5b Rust::Resolver::TypeResolution::Resolve(Rust::HIR::Crate&)
  ../../gccrs/gcc/rust/typecheck/rust-hir-type-check.cc:37
0xa712bb Rust::Session::compile_crate(char const*)
  ../../gccrs/gcc/rust/rust-session-manager.cc:631
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.

  • After fixing this issue, we need to add E0573 error code in gccrs
@philberty philberty self-assigned this Jul 29, 2023
@philberty philberty added this to the GCC 14 Stage 3 milestone Jul 29, 2023
philberty added a commit that referenced this issue Jul 30, 2023
…ution

Fixes #2479

gcc/rust/ChangeLog:

	* typecheck/rust-hir-trait-resolve.cc (TraitItemReference::resolve_item):
	always resolve the type even when its an a mandatory trait item
	* typecheck/rust-hir-type-check-type.cc (TypeCheckType::resolve_root_path):
	Add check for enum candidates otherwise you get undefined behaviour

gcc/testsuite/ChangeLog:

	* rust/compile/issue-2479.rs: New test.

Signed-off-by: Philip Herron <herron.philip@googlemail.com>
philberty added a commit that referenced this issue Jul 30, 2023
…ution

Fixes #2479

gcc/rust/ChangeLog:

	* typecheck/rust-hir-trait-resolve.cc (TraitItemReference::resolve_item):
	always resolve the type even when its an a mandatory trait item
	* typecheck/rust-hir-type-check-type.cc (TypeCheckType::resolve_root_path):
	Add check for enum candidates otherwise you get undefined behaviour

gcc/testsuite/ChangeLog:

	* rust/compile/issue-2479.rs: New test.

Signed-off-by: Philip Herron <herron.philip@googlemail.com>
github-merge-queue bot pushed a commit that referenced this issue Jul 30, 2023
…ution

Fixes #2479

gcc/rust/ChangeLog:

	* typecheck/rust-hir-trait-resolve.cc (TraitItemReference::resolve_item):
	always resolve the type even when its an a mandatory trait item
	* typecheck/rust-hir-type-check-type.cc (TypeCheckType::resolve_root_path):
	Add check for enum candidates otherwise you get undefined behaviour

gcc/testsuite/ChangeLog:

	* rust/compile/issue-2479.rs: New test.

Signed-off-by: Philip Herron <herron.philip@googlemail.com>
CohenArthur pushed a commit to CohenArthur/gccrs that referenced this issue Nov 15, 2023
…ution

Fixes Rust-GCC#2479

gcc/rust/ChangeLog:

	* typecheck/rust-hir-trait-resolve.cc (TraitItemReference::resolve_item):
	always resolve the type even when its an a mandatory trait item
	* typecheck/rust-hir-type-check-type.cc (TypeCheckType::resolve_root_path):
	Add check for enum candidates otherwise you get undefined behaviour

gcc/testsuite/ChangeLog:

	* rust/compile/issue-2479.rs: New test.

Signed-off-by: Philip Herron <herron.philip@googlemail.com>
CohenArthur pushed a commit to CohenArthur/gccrs that referenced this issue Nov 21, 2023
…ution

Fixes Rust-GCC#2479

gcc/rust/ChangeLog:

	* typecheck/rust-hir-trait-resolve.cc (TraitItemReference::resolve_item):
	always resolve the type even when its an a mandatory trait item
	* typecheck/rust-hir-type-check-type.cc (TypeCheckType::resolve_root_path):
	Add check for enum candidates otherwise you get undefined behaviour

gcc/testsuite/ChangeLog:

	* rust/compile/issue-2479.rs: New test.

Signed-off-by: Philip Herron <herron.philip@googlemail.com>
CohenArthur pushed a commit to CohenArthur/gccrs that referenced this issue Nov 21, 2023
…ution

Fixes Rust-GCC#2479

gcc/rust/ChangeLog:

	* typecheck/rust-hir-trait-resolve.cc (TraitItemReference::resolve_item):
	always resolve the type even when its an a mandatory trait item
	* typecheck/rust-hir-type-check-type.cc (TypeCheckType::resolve_root_path):
	Add check for enum candidates otherwise you get undefined behaviour

gcc/testsuite/ChangeLog:

	* rust/compile/issue-2479.rs: New test.

Signed-off-by: Philip Herron <herron.philip@googlemail.com>
CohenArthur pushed a commit to CohenArthur/gccrs that referenced this issue Jan 5, 2024
…ution

Fixes Rust-GCC#2479

gcc/rust/ChangeLog:

	* typecheck/rust-hir-trait-resolve.cc (TraitItemReference::resolve_item):
	always resolve the type even when its an a mandatory trait item
	* typecheck/rust-hir-type-check-type.cc (TypeCheckType::resolve_root_path):
	Add check for enum candidates otherwise you get undefined behaviour

gcc/testsuite/ChangeLog:

	* rust/compile/issue-2479.rs: New test.

Signed-off-by: Philip Herron <herron.philip@googlemail.com>
CohenArthur pushed a commit to CohenArthur/gccrs that referenced this issue Jan 8, 2024
…ution

Fixes Rust-GCC#2479

gcc/rust/ChangeLog:

	* typecheck/rust-hir-trait-resolve.cc (TraitItemReference::resolve_item):
	always resolve the type even when its an a mandatory trait item
	* typecheck/rust-hir-type-check-type.cc (TypeCheckType::resolve_root_path):
	Add check for enum candidates otherwise you get undefined behaviour

gcc/testsuite/ChangeLog:

	* rust/compile/issue-2479.rs: New test.

Signed-off-by: Philip Herron <herron.philip@googlemail.com>
CohenArthur pushed a commit to CohenArthur/gccrs that referenced this issue Jan 9, 2024
…ution

Fixes Rust-GCC#2479

gcc/rust/ChangeLog:

	* typecheck/rust-hir-trait-resolve.cc (TraitItemReference::resolve_item):
	always resolve the type even when its an a mandatory trait item
	* typecheck/rust-hir-type-check-type.cc (TypeCheckType::resolve_root_path):
	Add check for enum candidates otherwise you get undefined behaviour

gcc/testsuite/ChangeLog:

	* rust/compile/issue-2479.rs: New test.

Signed-off-by: Philip Herron <herron.philip@googlemail.com>
CohenArthur pushed a commit to CohenArthur/gccrs that referenced this issue Jan 9, 2024
…ution

Fixes Rust-GCC#2479

gcc/rust/ChangeLog:

	* typecheck/rust-hir-trait-resolve.cc (TraitItemReference::resolve_item):
	always resolve the type even when its an a mandatory trait item
	* typecheck/rust-hir-type-check-type.cc (TypeCheckType::resolve_root_path):
	Add check for enum candidates otherwise you get undefined behaviour

gcc/testsuite/ChangeLog:

	* rust/compile/issue-2479.rs: New test.

Signed-off-by: Philip Herron <herron.philip@googlemail.com>
CohenArthur pushed a commit to CohenArthur/gccrs that referenced this issue Jan 9, 2024
…ution

Fixes Rust-GCC#2479

gcc/rust/ChangeLog:

	* typecheck/rust-hir-trait-resolve.cc (TraitItemReference::resolve_item):
	always resolve the type even when its an a mandatory trait item
	* typecheck/rust-hir-type-check-type.cc (TypeCheckType::resolve_root_path):
	Add check for enum candidates otherwise you get undefined behaviour

gcc/testsuite/ChangeLog:

	* rust/compile/issue-2479.rs: New test.

Signed-off-by: Philip Herron <herron.philip@googlemail.com>
CohenArthur pushed a commit to CohenArthur/gccrs that referenced this issue Jan 9, 2024
…ution

Fixes Rust-GCC#2479

gcc/rust/ChangeLog:

	* typecheck/rust-hir-trait-resolve.cc (TraitItemReference::resolve_item):
	always resolve the type even when its an a mandatory trait item
	* typecheck/rust-hir-type-check-type.cc (TypeCheckType::resolve_root_path):
	Add check for enum candidates otherwise you get undefined behaviour

gcc/testsuite/ChangeLog:

	* rust/compile/issue-2479.rs: New test.

Signed-off-by: Philip Herron <herron.philip@googlemail.com>
CohenArthur pushed a commit to CohenArthur/gccrs that referenced this issue Jan 9, 2024
…ution

Fixes Rust-GCC#2479

gcc/rust/ChangeLog:

	* typecheck/rust-hir-trait-resolve.cc (TraitItemReference::resolve_item):
	always resolve the type even when its an a mandatory trait item
	* typecheck/rust-hir-type-check-type.cc (TypeCheckType::resolve_root_path):
	Add check for enum candidates otherwise you get undefined behaviour

gcc/testsuite/ChangeLog:

	* rust/compile/issue-2479.rs: New test.

Signed-off-by: Philip Herron <herron.philip@googlemail.com>
CohenArthur pushed a commit to CohenArthur/gccrs that referenced this issue Jan 9, 2024
…ution

Fixes Rust-GCC#2479

gcc/rust/ChangeLog:

	* typecheck/rust-hir-trait-resolve.cc (TraitItemReference::resolve_item):
	always resolve the type even when its an a mandatory trait item
	* typecheck/rust-hir-type-check-type.cc (TypeCheckType::resolve_root_path):
	Add check for enum candidates otherwise you get undefined behaviour

gcc/testsuite/ChangeLog:

	* rust/compile/issue-2479.rs: New test.

Signed-off-by: Philip Herron <herron.philip@googlemail.com>
CohenArthur pushed a commit to CohenArthur/gccrs that referenced this issue Jan 9, 2024
…ution

Fixes Rust-GCC#2479

gcc/rust/ChangeLog:

	* typecheck/rust-hir-trait-resolve.cc (TraitItemReference::resolve_item):
	always resolve the type even when its an a mandatory trait item
	* typecheck/rust-hir-type-check-type.cc (TypeCheckType::resolve_root_path):
	Add check for enum candidates otherwise you get undefined behaviour

gcc/testsuite/ChangeLog:

	* rust/compile/issue-2479.rs: New test.

Signed-off-by: Philip Herron <herron.philip@googlemail.com>
CohenArthur pushed a commit to CohenArthur/gccrs that referenced this issue Jan 9, 2024
…ution

Fixes Rust-GCC#2479

gcc/rust/ChangeLog:

	* typecheck/rust-hir-trait-resolve.cc (TraitItemReference::resolve_item):
	always resolve the type even when its an a mandatory trait item
	* typecheck/rust-hir-type-check-type.cc (TypeCheckType::resolve_root_path):
	Add check for enum candidates otherwise you get undefined behaviour

gcc/testsuite/ChangeLog:

	* rust/compile/issue-2479.rs: New test.

Signed-off-by: Philip Herron <herron.philip@googlemail.com>
CohenArthur pushed a commit to CohenArthur/gccrs that referenced this issue Jan 11, 2024
…ution

Fixes Rust-GCC#2479

gcc/rust/ChangeLog:

	* typecheck/rust-hir-trait-resolve.cc (TraitItemReference::resolve_item):
	always resolve the type even when its an a mandatory trait item
	* typecheck/rust-hir-type-check-type.cc (TypeCheckType::resolve_root_path):
	Add check for enum candidates otherwise you get undefined behaviour

gcc/testsuite/ChangeLog:

	* rust/compile/issue-2479.rs: New test.

Signed-off-by: Philip Herron <herron.philip@googlemail.com>
CohenArthur pushed a commit to CohenArthur/gccrs that referenced this issue Jan 12, 2024
…ution

Fixes Rust-GCC#2479

gcc/rust/ChangeLog:

	* typecheck/rust-hir-trait-resolve.cc (TraitItemReference::resolve_item):
	always resolve the type even when its an a mandatory trait item
	* typecheck/rust-hir-type-check-type.cc (TypeCheckType::resolve_root_path):
	Add check for enum candidates otherwise you get undefined behaviour

gcc/testsuite/ChangeLog:

	* rust/compile/issue-2479.rs: New test.

Signed-off-by: Philip Herron <herron.philip@googlemail.com>
CohenArthur pushed a commit to CohenArthur/gccrs that referenced this issue Jan 16, 2024
…ution

Fixes Rust-GCC#2479

gcc/rust/ChangeLog:

	* typecheck/rust-hir-trait-resolve.cc (TraitItemReference::resolve_item):
	always resolve the type even when its an a mandatory trait item
	* typecheck/rust-hir-type-check-type.cc (TypeCheckType::resolve_root_path):
	Add check for enum candidates otherwise you get undefined behaviour

gcc/testsuite/ChangeLog:

	* rust/compile/issue-2479.rs: New test.

Signed-off-by: Philip Herron <herron.philip@googlemail.com>
CohenArthur pushed a commit to CohenArthur/gccrs that referenced this issue Jan 16, 2024
…ution

Fixes Rust-GCC#2479

gcc/rust/ChangeLog:

	* typecheck/rust-hir-trait-resolve.cc (TraitItemReference::resolve_item):
	always resolve the type even when its an a mandatory trait item
	* typecheck/rust-hir-type-check-type.cc (TypeCheckType::resolve_root_path):
	Add check for enum candidates otherwise you get undefined behaviour

gcc/testsuite/ChangeLog:

	* rust/compile/issue-2479.rs: New test.

Signed-off-by: Philip Herron <herron.philip@googlemail.com>
CohenArthur pushed a commit to CohenArthur/gccrs that referenced this issue Jan 17, 2024
…ution

Fixes Rust-GCC#2479

gcc/rust/ChangeLog:

	* typecheck/rust-hir-trait-resolve.cc (TraitItemReference::resolve_item):
	always resolve the type even when its an a mandatory trait item
	* typecheck/rust-hir-type-check-type.cc (TypeCheckType::resolve_root_path):
	Add check for enum candidates otherwise you get undefined behaviour

gcc/testsuite/ChangeLog:

	* rust/compile/issue-2479.rs: New test.

Signed-off-by: Philip Herron <herron.philip@googlemail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants