Skip to content

Add lang pin/unpin - #4720

Merged
powerboat9 merged 2 commits into
Rust-GCC:masterfrom
nsvke:add-pin-unpin
Aug 9, 2026
Merged

Add lang pin/unpin#4720
powerboat9 merged 2 commits into
Rust-GCC:masterfrom
nsvke:add-pin-unpin

Conversation

@nsvke

@nsvke nsvke commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

This patch adds pin/unpin lang items to the compiler but not fully tested
due to issues #4709 and #4678 so we tested
auto trait and negative impls behaviors.

gcc/rust/ChangeLog:

* util/rust-lang-item.cc (Rust::LangItem::lang_items): Add pin
and unpin lang items to the BiMap.
* util/rust-lang-item.h (class LangItem): Add PIN and UNPIN to
the Kind enum.

gcc/testsuite/ChangeLog:

* rust/compile/lang-pin-unpin.rs: New test.

This patch adds support for structural auto-traits and fixes how negative
trait implementations are handled.

gcc/rust/ChangeLog:

* typecheck/rust-tyty-bounds.cc
(TypeBoundsProbe::add_trait_bound): Check all fields of an ADT.
* typecheck/rust-tyty.cc (BaseType::satisfies_bound): Reject
trait if there is a negative impl.

Closes #4760

@CohenArthur CohenArthur left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The GCC5 builder is reporting a segmentation fault, code looks good to me apart from this :) well done

Comment thread gcc/rust/typecheck/rust-tyty.cc Outdated
// node of somekind
if (b.second == nullptr)
return true;
return predicate.get_polarity () == BoundPolarity::RegularBound;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit but let's add braces here since we have braces on the else

Suggested change
return predicate.get_polarity () == BoundPolarity::RegularBound;
{
return predicate.get_polarity () == BoundPolarity::RegularBound;
}

@nsvke
nsvke requested a review from CohenArthur August 3, 2026 08:53
@CohenArthur CohenArthur added the lowering Lowering from AST to HIR label Aug 3, 2026
@CohenArthur CohenArthur added this to the Lowering fixes core 1.49 milestone Aug 3, 2026
Comment thread gcc/rust/typecheck/rust-tyty-bounds.cc
nsvke added 2 commits August 9, 2026 14:31
This patch adds support for structural auto-traits and fixes how negative
trait implementations are handled.

gcc/rust/ChangeLog:

	* typecheck/rust-tyty-bounds.cc
	(TypeBoundsProbe::add_trait_bound): Check all fields of an ADT.
	* typecheck/rust-tyty.cc (BaseType::satisfies_bound): Reject
	trait if there is a negative impl.

Signed-off-by: Enes Cevik <enes@nsvke.com>
This patch adds pin/unpin lang items to the compiler but not fully tested
due to issues Rust-GCC#4709 and Rust-GCC#4678 so we tested
auto trait and negative impls behaviors.

gcc/rust/ChangeLog:

	* util/rust-lang-item.cc (Rust::LangItem::lang_items): Add pin
	and unpin lang items to the BiMap.
	* util/rust-lang-item.h (class LangItem): Add PIN and UNPIN to
	the Kind enum.

gcc/testsuite/ChangeLog:

	* rust/compile/lang-pin-unpin.rs: New test.

Signed-off-by: Enes Cevik <enes@nsvke.com>
@powerboat9

Copy link
Copy Markdown
Collaborator

LGTM, but could you use Rust-GCC/gccrs#XXXX to refer to issue numbers? Otherwise, I think upstream bugzilla gets confused

@nsvke

nsvke commented Aug 9, 2026

Copy link
Copy Markdown
Contributor Author

I already used it as Rust-GCC/gccrs#XXXX, but github automatically converts it to a link like #XXXX. I was confused when I first saw it too 😅 . If I remember correctly, @dkm added some logic to CI to check this.

@powerboat9
powerboat9 enabled auto-merge August 9, 2026 12:07
@powerboat9
powerboat9 added this pull request to the merge queue Aug 9, 2026
Merged via the queue into Rust-GCC:master with commit fa1a84b Aug 9, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lowering Lowering from AST to HIR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Stub out pin and unpin lang items

3 participants