]> 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)
committerArthur Cohen <arthur.cohen@embecosm.com>
Mon, 28 Apr 2025 14:18:52 +0000 (16:18 +0200)
commit56408be2bdbd1e052a140ae014c8e619ecbab5d7
tree0fb1b07fdc5dce71f432bad767877fc8a1b67264
parentef32bd8c866a1b8a97f627fad44a42f29757c816
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]