Skip to content
Open
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
f5cbf5d
add lang items for field projections via virtual places
BennoLossin Apr 7, 2026
785bea2
TOSQUASH: better structure for our lang items
BennoLossin Apr 16, 2026
7f7db8b
TOSQUASH: improve SAFETY constant docs
BennoLossin Apr 16, 2026
f03d083
TOSQUASH: add note regarding missing associated constants in `PlaceBo…
BennoLossin Apr 16, 2026
a1068ca
TOSQUASH: move `ops/{field_projections.rs -> place.rs}` and make the …
BennoLossin Apr 16, 2026
4018705
TOSQUASH: move `Subplace` trait to `ops::place`
BennoLossin Apr 16, 2026
4c3ce06
TOSQUASH: make `Subplace` not require `Copy`
BennoLossin Apr 16, 2026
ef19d2b
TOSQUASH: rename traits according to zulip discussion
BennoLossin Apr 16, 2026
39e5a88
TOSQUASH: write top-level documentation
BennoLossin Apr 16, 2026
2c63011
TOSQUASH: link to module-level safety docs
BennoLossin Apr 16, 2026
8c25087
TOSQUASH: add more trait docs & format to 80 columns
BennoLossin Apr 16, 2026
3ee9a36
TOSQUASH: have consistent ordering with the traits
BennoLossin Apr 16, 2026
26d8e91
TOSQUASH: fix feature gate test
BennoLossin Apr 21, 2026
58cc5f4
TOSQUASH: apply Nadri's suggestions
BennoLossin Apr 22, 2026
55fc3d7
TOSQUASH: apply Tyler's suggestions
BennoLossin Apr 22, 2026
7554c7e
TOSQUASH: rename DerefPlace to PlaceProxy
BennoLossin Apr 23, 2026
80bd308
TOSQUASH: rename NestPlace to DerefPlace
BennoLossin Apr 23, 2026
159ce35
TOSQUASH: rename `const SAFETY` to `const SAFE`
BennoLossin Apr 24, 2026
5f8769e
TOSQUASH: improve documentation
BennoLossin Apr 24, 2026
ded037a
fixup! TOSQUASH: rename `const SAFETY` to `const SAFE`
BennoLossin Apr 24, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 39 additions & 1 deletion compiler/rustc_hir/src/lang_items.rs
Original file line number Diff line number Diff line change
Expand Up @@ -437,13 +437,51 @@ language_item_table! {
Reborrow, sym::reborrow, reborrow, Target::Trait, GenericRequirement::Exact(0);
CoerceShared, sym::coerce_shared, coerce_shared, Target::Trait, GenericRequirement::Exact(0);

// Field representing types.
// # Experimental lang-items for field projections <https://github.com/rust-lang/rust/issues/145383>.

// ## Field representing types.
FieldRepresentingType, sym::field_representing_type, field_representing_type, Target::Struct, GenericRequirement::Exact(3);
Field, sym::field, field, Target::Trait, GenericRequirement::Exact(0);
FieldBase, sym::field_base, field_base, Target::AssocTy, GenericRequirement::Exact(0);
FieldType, sym::field_type, field_type, Target::AssocTy, GenericRequirement::Exact(0);
FieldOffset, sym::field_offset, field_offset, Target::AssocConst, GenericRequirement::Exact(0);

// ## Virtual places.
Subplace, sym::subplace, subplace, Target::Trait, GenericRequirement::Exact(0);
SubplaceSource, sym::subplace_source, subplace_source, Target::AssocTy, GenericRequirement::Exact(0);
SubplaceTarget, sym::subplace_target, subplace_target, Target::AssocTy, GenericRequirement::Exact(0);
SubplaceOffset, sym::subplace_offset, subplace_offset, Target::Method(MethodKind::Trait { body: false }), GenericRequirement::Exact(0);

DerefPlace, sym::deref_place, deref_place, Target::Trait, GenericRequirement::Exact(0);
DerefPlaceTarget, sym::deref_place_target, deref_place_target, Target::AssocTy, GenericRequirement::Exact(0);

ReadPlace, sym::read_place, read_place, Target::Trait, GenericRequirement::Exact(1);
ReadPlaceSafety, sym::read_place_safety, read_place_safety, Target::AssocConst, GenericRequirement::Exact(1);
ReadPlaceRead, sym::read_place_read, read_place_read, Target::Method(MethodKind::Trait { body: false }), GenericRequirement::Exact(1);

WritePlace, sym::write_place, write_place, Target::Trait, GenericRequirement::Exact(1);
WritePlaceSafety, sym::write_place_safety, write_place_safety, Target::AssocConst, GenericRequirement::Exact(1);
WritePlaceWrite, sym::write_place_write, write_place_write, Target::Method(MethodKind::Trait { body: false }), GenericRequirement::Exact(1);

MovePlace, sym::move_place, move_place, Target::Trait, GenericRequirement::Exact(1);

DropPlace, sym::drop_place, drop_place, Target::Trait, GenericRequirement::Exact(1);
DropPlaceDrop, sym::drop_place_drop, drop_place_drop, Target::Method(MethodKind::Trait { body: false }), GenericRequirement::Exact(1);

DropHusk, sym::drop_husk, drop_husk, Target::Trait, GenericRequirement::Exact(0);
DropHuskDropHusk, sym::drop_husk_drop_husk, drop_husk_drop_husk, Target::Method(MethodKind::Trait { body: false }), GenericRequirement::Exact(0);

BorrowPlace, sym::borrow_place, borrow_place, Target::Trait, GenericRequirement::Exact(2);
BorrowPlaceSafety, sym::borrow_place_safety, borrow_place_safety, Target::AssocConst, GenericRequirement::Exact(2);
BorrowPlaceBorrow, sym::borrow_place_borrow, borrow_place_borrow, Target::Method(MethodKind::Trait { body: false }), GenericRequirement::Exact(2);

NestPlace, sym::nest_place, nest_place, Target::Trait, GenericRequirement::Exact(1);
NestPlaceNested, sym::nest_place_nested, nest_place_nested, Target::Method(MethodKind::Trait { body: false }), GenericRequirement::Exact(1);

WrapPlace, sym::wrap_place, wrap_place, Target::Trait, GenericRequirement::Exact(1);
WrapPlaceWrapped, sym::wrap_place_wrapped, wrap_place_wrapped, Target::AssocTy, GenericRequirement::Exact(1);
WrapPlaceWrap, sym::wrap_place_wrap, wrap_place_wrap, Target::Method(MethodKind::Trait { body: false }), GenericRequirement::Exact(1);

// Used to fallback `{float}` to `f32` when `f32: From<{float}>`
From, sym::From, from_trait, Target::Trait, GenericRequirement::Exact(1);
}
Expand Down
26 changes: 26 additions & 0 deletions compiler/rustc_span/src/symbol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -528,6 +528,9 @@ symbols! {
block,
blocking,
bool,
borrow_place,
borrow_place_borrow,
borrow_place_safety,
borrowck_graphviz_format,
borrowck_graphviz_postflow,
box_new,
Expand Down Expand Up @@ -788,6 +791,8 @@ symbols! {
deref_method,
deref_mut,
deref_patterns,
deref_place,
deref_place_target,
deref_pure,
deref_target,
derive,
Expand Down Expand Up @@ -832,7 +837,11 @@ symbols! {
dreg_low8,
dreg_low16,
drop,
drop_husk,
drop_husk_drop_husk,
drop_in_place,
drop_place,
drop_place_drop,
drop_types_in_const,
dropck_eyepatch,
dropck_parametricity,
Expand Down Expand Up @@ -1318,6 +1327,7 @@ symbols! {
more_qualified_paths,
more_struct_aliases,
movbe_target_feature,
move_place,
move_ref_pattern,
move_size_limit,
movrs_target_feature,
Expand Down Expand Up @@ -1353,6 +1363,8 @@ symbols! {
negative_bounds,
negative_impls,
neon,
nest_place,
nest_place_nested,
nested,
never,
never_patterns,
Expand Down Expand Up @@ -1514,6 +1526,7 @@ symbols! {
pin,
pin_ergonomics,
pin_v2,
place,
platform_intrinsics,
plugin,
plugin_registrar,
Expand Down Expand Up @@ -1609,6 +1622,9 @@ symbols! {
raw_identifiers,
raw_ref_op,
re_rebalance_coherence,
read_place,
read_place_read,
read_place_safety,
read_via_copy,
readonly,
realloc,
Expand Down Expand Up @@ -1990,6 +2006,10 @@ symbols! {
sub,
sub_assign,
sub_with_overflow,
subplace,
subplace_offset,
subplace_source,
subplace_target,
suggestion,
super_let,
supertrait_item_shadowing,
Expand Down Expand Up @@ -2260,6 +2280,9 @@ symbols! {
windows_subsystem,
with_negative_coherence,
wrap_binder,
wrap_place,
wrap_place_wrap,
wrap_place_wrapped,
wrapping_add,
wrapping_div,
wrapping_mul,
Expand All @@ -2271,6 +2294,9 @@ symbols! {
write_bytes,
write_fmt,
write_macro,
write_place,
write_place_safety,
write_place_write,
write_str,
write_via_move,
writeln_macro,
Expand Down
2 changes: 2 additions & 0 deletions library/core/src/ops/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,8 @@ mod reborrow;
mod try_trait;
mod unsize;

#[unstable(feature = "field_projections", issue = "145383")]
pub mod place;
#[stable(feature = "rust1", since = "1.0.0")]
pub use self::arith::{Add, Div, Mul, Neg, Rem, Sub};
#[stable(feature = "op_assign_traits", since = "1.8.0")]
Expand Down
Loading
Loading