]> git.ipfire.org Git - thirdparty/gcc.git/commit
gccrs: Fix segv in unsafe chcker
authorPhilip Herron <herron.philip@googlemail.com>
Fri, 4 Apr 2025 15:35:13 +0000 (16:35 +0100)
committerPhilip Herron <philip.herron@embecosm.com>
Wed, 16 Apr 2025 09:04:47 +0000 (09:04 +0000)
commit5ac41dce35b947f5d1f904b39958ebf6f1b538cf
tree3612e5900e004cf5f97e38857b7fc694cab8c7a7
parentdaf5dbc0272d57b772d579233268545c3a485e18
gccrs: Fix segv in unsafe chcker

Trait constants were missing type resolution step, this adds that
as if it was a normal constant. The unsafe checker was missing a
null check.

Fixes Rust-GCC#3612

gcc/rust/ChangeLog:

* checks/errors/rust-unsafe-checker.cc (UnsafeChecker::visit): add null check
* hir/tree/rust-hir-item.h: add has_type helper
* typecheck/rust-hir-trait-resolve.cc (TraitItemReference::resolve_item):
add missing type checking

gcc/testsuite/ChangeLog:

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

Signed-off-by: Philip Herron <herron.philip@googlemail.com>
gcc/rust/checks/errors/rust-unsafe-checker.cc
gcc/rust/hir/tree/rust-hir-item.h
gcc/rust/typecheck/rust-hir-trait-resolve.cc
gcc/testsuite/rust/compile/issue-3612.rs [new file with mode: 0644]