Skip to content

gccrs: Fix segv in unsafe chcker #3694

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

Merged
merged 1 commit into from
Apr 16, 2025
Merged

gccrs: Fix segv in unsafe chcker #3694

merged 1 commit into from
Apr 16, 2025

Conversation

philberty
Copy link
Member

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 #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.

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 #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 <[email protected]>
@philberty philberty force-pushed the phil/trait-const-tychk branch from ddc832d to 19f4219 Compare April 4, 2025 15:47
@CohenArthur CohenArthur added this pull request to the merge queue Apr 14, 2025
Copy link
Member

@CohenArthur CohenArthur left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to no response for status checks Apr 14, 2025
@philberty philberty added this pull request to the merge queue Apr 16, 2025
Merged via the queue into master with commit 5ac41dc Apr 16, 2025
12 checks passed
@github-project-automation github-project-automation bot moved this from Todo to Done in libcore 1.49 Apr 16, 2025
@philberty philberty deleted the phil/trait-const-tychk branch April 16, 2025 15:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

ICE: segfault Rust::TyTy::BaseType::get_ref
2 participants