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 - Segmentation fault after unknown trait item #2478

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

ICE - Segmentation fault after unknown trait item #2478

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

Comments

@MahadMuhammad
Copy link
Contributor

Segmentation fault after unknown trait item


I tried this code from E0324

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

trait Foo {
    const N : u32;

    fn M();
}

impl Foo for Bar {
    fn N() {}
    // error: item `N` is an associated method, which doesn't match its
    //        trait `<Bar as Foo>`
}
}

Meta

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

Error output

  • ICE - after method is not a member of trait
Backtrace

E0324.rs:12:5: error: method ‘N’ is not a member of trait ‘Foo11 | impl Foo for Bar {
    |      ~~~
 12 |     fn N() {}
    |     ^~
crab1: internal compiler error: Segmentation fault
0x11e1ad3 crash_signal
  ../../gccrs/gcc/toplev.cc:314
0x7f9bb844251f ???
  ./signal/../sysdeps/unix/sysv/linux/x86_64/libc_sigaction.c:0
0xc0a644 std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::length() const
  /usr/include/c++/11/bits/basic_string.h:927
0xc0a644 std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)
  /usr/include/c++/11/bits/basic_string.h:459
0xc0a644 Rust::Resolver::TraitItemReference::get_identifier[abi:cxx11]() const
  ../../gccrs/gcc/rust/typecheck/rust-hir-trait-reference.cc:45
0xc12bd8 Rust::Resolver::TypeCheckItem::validate_trait_impl_block(Rust::HIR::ImplBlock&, Rust::TyTy::BaseType*, std::vector<Rust::TyTy::SubstitutionParamMapping, std::allocator<Rust::TyTy::SubstitutionParamMapping> >&)
  ../../gccrs/gcc/rust/typecheck/rust-hir-type-check-item.cc:575
0xc13133 Rust::Resolver::TypeCheckItem::visit(Rust::HIR::ImplBlock&)
  ../../gccrs/gcc/rust/typecheck/rust-hir-type-check-item.cc:346
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
0xc2906f ???
  ../../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 E0324 error code in gccrs
@philberty philberty self-assigned this Jul 29, 2023
philberty added a commit that referenced this issue Jul 29, 2023
When the resulting trait item is in an error state this means the
underlying fields will be null.

Fixes #2478

gcc/rust/ChangeLog:

	* typecheck/rust-hir-type-check-item.cc: add is_error check

gcc/testsuite/ChangeLog:

	* rust/compile/non_member_const.rs: add missing error message
	* rust/compile/issue-2478.rs: New test.

Signed-off-by: Philip Herron <herron.philip@googlemail.com>
github-merge-queue bot pushed a commit that referenced this issue Jul 29, 2023
When the resulting trait item is in an error state this means the
underlying fields will be null.

Fixes #2478

gcc/rust/ChangeLog:

	* typecheck/rust-hir-type-check-item.cc: add is_error check

gcc/testsuite/ChangeLog:

	* rust/compile/non_member_const.rs: add missing error message
	* rust/compile/issue-2478.rs: New test.

Signed-off-by: Philip Herron <herron.philip@googlemail.com>
@MahadMuhammad MahadMuhammad moved this from Internal Compile Error to Done Supported Error Codes in Error Code Support & Improving User Errors Aug 9, 2023
CohenArthur pushed a commit to CohenArthur/gccrs that referenced this issue Nov 15, 2023
When the resulting trait item is in an error state this means the
underlying fields will be null.

Fixes Rust-GCC#2478

gcc/rust/ChangeLog:

	* typecheck/rust-hir-type-check-item.cc: add is_error check

gcc/testsuite/ChangeLog:

	* rust/compile/non_member_const.rs: add missing error message
	* rust/compile/issue-2478.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
When the resulting trait item is in an error state this means the
underlying fields will be null.

Fixes Rust-GCC#2478

gcc/rust/ChangeLog:

	* typecheck/rust-hir-type-check-item.cc: add is_error check

gcc/testsuite/ChangeLog:

	* rust/compile/non_member_const.rs: add missing error message
	* rust/compile/issue-2478.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
When the resulting trait item is in an error state this means the
underlying fields will be null.

Fixes Rust-GCC#2478

gcc/rust/ChangeLog:

	* typecheck/rust-hir-type-check-item.cc: add is_error check

gcc/testsuite/ChangeLog:

	* rust/compile/non_member_const.rs: add missing error message
	* rust/compile/issue-2478.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
When the resulting trait item is in an error state this means the
underlying fields will be null.

Fixes Rust-GCC#2478

gcc/rust/ChangeLog:

	* typecheck/rust-hir-type-check-item.cc: add is_error check

gcc/testsuite/ChangeLog:

	* rust/compile/non_member_const.rs: add missing error message
	* rust/compile/issue-2478.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
When the resulting trait item is in an error state this means the
underlying fields will be null.

Fixes Rust-GCC#2478

gcc/rust/ChangeLog:

	* typecheck/rust-hir-type-check-item.cc: add is_error check

gcc/testsuite/ChangeLog:

	* rust/compile/non_member_const.rs: add missing error message
	* rust/compile/issue-2478.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
When the resulting trait item is in an error state this means the
underlying fields will be null.

Fixes Rust-GCC#2478

gcc/rust/ChangeLog:

	* typecheck/rust-hir-type-check-item.cc: add is_error check

gcc/testsuite/ChangeLog:

	* rust/compile/non_member_const.rs: add missing error message
	* rust/compile/issue-2478.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
When the resulting trait item is in an error state this means the
underlying fields will be null.

Fixes Rust-GCC#2478

gcc/rust/ChangeLog:

	* typecheck/rust-hir-type-check-item.cc: add is_error check

gcc/testsuite/ChangeLog:

	* rust/compile/non_member_const.rs: add missing error message
	* rust/compile/issue-2478.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
When the resulting trait item is in an error state this means the
underlying fields will be null.

Fixes Rust-GCC#2478

gcc/rust/ChangeLog:

	* typecheck/rust-hir-type-check-item.cc: add is_error check

gcc/testsuite/ChangeLog:

	* rust/compile/non_member_const.rs: add missing error message
	* rust/compile/issue-2478.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
When the resulting trait item is in an error state this means the
underlying fields will be null.

Fixes Rust-GCC#2478

gcc/rust/ChangeLog:

	* typecheck/rust-hir-type-check-item.cc: add is_error check

gcc/testsuite/ChangeLog:

	* rust/compile/non_member_const.rs: add missing error message
	* rust/compile/issue-2478.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
When the resulting trait item is in an error state this means the
underlying fields will be null.

Fixes Rust-GCC#2478

gcc/rust/ChangeLog:

	* typecheck/rust-hir-type-check-item.cc: add is_error check

gcc/testsuite/ChangeLog:

	* rust/compile/non_member_const.rs: add missing error message
	* rust/compile/issue-2478.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
When the resulting trait item is in an error state this means the
underlying fields will be null.

Fixes Rust-GCC#2478

gcc/rust/ChangeLog:

	* typecheck/rust-hir-type-check-item.cc: add is_error check

gcc/testsuite/ChangeLog:

	* rust/compile/non_member_const.rs: add missing error message
	* rust/compile/issue-2478.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
When the resulting trait item is in an error state this means the
underlying fields will be null.

Fixes Rust-GCC#2478

gcc/rust/ChangeLog:

	* typecheck/rust-hir-type-check-item.cc: add is_error check

gcc/testsuite/ChangeLog:

	* rust/compile/non_member_const.rs: add missing error message
	* rust/compile/issue-2478.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
When the resulting trait item is in an error state this means the
underlying fields will be null.

Fixes Rust-GCC#2478

gcc/rust/ChangeLog:

	* typecheck/rust-hir-type-check-item.cc: add is_error check

gcc/testsuite/ChangeLog:

	* rust/compile/non_member_const.rs: add missing error message
	* rust/compile/issue-2478.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
When the resulting trait item is in an error state this means the
underlying fields will be null.

Fixes Rust-GCC#2478

gcc/rust/ChangeLog:

	* typecheck/rust-hir-type-check-item.cc: add is_error check

gcc/testsuite/ChangeLog:

	* rust/compile/non_member_const.rs: add missing error message
	* rust/compile/issue-2478.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
When the resulting trait item is in an error state this means the
underlying fields will be null.

Fixes Rust-GCC#2478

gcc/rust/ChangeLog:

	* typecheck/rust-hir-type-check-item.cc: add is_error check

gcc/testsuite/ChangeLog:

	* rust/compile/non_member_const.rs: add missing error message
	* rust/compile/issue-2478.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
When the resulting trait item is in an error state this means the
underlying fields will be null.

Fixes Rust-GCC#2478

gcc/rust/ChangeLog:

	* typecheck/rust-hir-type-check-item.cc: add is_error check

gcc/testsuite/ChangeLog:

	* rust/compile/non_member_const.rs: add missing error message
	* rust/compile/issue-2478.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
When the resulting trait item is in an error state this means the
underlying fields will be null.

Fixes Rust-GCC#2478

gcc/rust/ChangeLog:

	* typecheck/rust-hir-type-check-item.cc: add is_error check

gcc/testsuite/ChangeLog:

	* rust/compile/non_member_const.rs: add missing error message
	* rust/compile/issue-2478.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
When the resulting trait item is in an error state this means the
underlying fields will be null.

Fixes Rust-GCC#2478

gcc/rust/ChangeLog:

	* typecheck/rust-hir-type-check-item.cc: add is_error check

gcc/testsuite/ChangeLog:

	* rust/compile/non_member_const.rs: add missing error message
	* rust/compile/issue-2478.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
None yet
Development

Successfully merging a pull request may close this issue.

3 participants