Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
6e612c5
rustc_hir_typeck: match all ty kinds in probe
BennoLossin Sep 6, 2025
bc7a0bb
add field_projections feature gate
BennoLossin Sep 5, 2025
1c26175
add field traits
BennoLossin Sep 5, 2025
95eab26
error on manually implementing field traits
BennoLossin Sep 5, 2025
a88b108
add unaligned_field_offset intrinsic
BennoLossin Sep 5, 2025
c9d04aa
add builtin `field_of!` macro
BennoLossin Sep 5, 2025
976272c
move `NoFieldOnType` error
BennoLossin Sep 6, 2025
52eb6be
add `FieldPath`
BennoLossin Sep 6, 2025
47c3417
use `FieldPath` in `offset_of!`
BennoLossin Sep 6, 2025
17946a5
add FRTs to HIR
BennoLossin Sep 6, 2025
36db825
add FRTs as `ty::Field`
BennoLossin Sep 6, 2025
af4f1e7
printing `ty::Field`
BennoLossin Sep 6, 2025
2a9d9b2
FRTs are `Sized`
BennoLossin Sep 6, 2025
51bac24
FRTs are uninhabited
BennoLossin Sep 6, 2025
9ad7bf9
FRTs are not trivially `Copy` & `Clone`
BennoLossin Sep 6, 2025
eae060e
FRTs are trivially `Freeze`
BennoLossin Sep 6, 2025
351f028
FRTs are not trivially `Unpin`
BennoLossin Sep 6, 2025
36b21d9
FRTs don't implement `Drop`
BennoLossin Sep 5, 2025
b82b874
add coherence check for FRTs
BennoLossin Sep 6, 2025
6c7ffa6
borrow check of FRTs (have no fields & can't be dereferenced)
BennoLossin Sep 5, 2025
bcf27f8
const eval of FRTs (they are uninhabited, so not really much to do)
BennoLossin Sep 5, 2025
743de26
add FRTs to rustc_public
BennoLossin Sep 6, 2025
014671d
FRTs & symbol names
BennoLossin Sep 6, 2025
fd8f344
FRTs & FFI
BennoLossin Sep 6, 2025
7ef9323
rustdoc support for FRTs
BennoLossin Sep 5, 2025
0bea467
add builtin impls of `Field` and `UnalignedField` for FRTs
BennoLossin Sep 6, 2025
29db7da
add values for associated items of `UnalignedField`
BennoLossin Sep 6, 2025
5e062b5
basic test
BennoLossin Sep 6, 2025
92f733b
debuginfo for FRTs
BennoLossin Sep 6, 2025
0e9e30a
fix test locations
BennoLossin Sep 8, 2025
847000f
allow field types to implement copy
BennoLossin Sep 8, 2025
fe5608a
rustc_const_eval: improve error handling
BennoLossin Sep 9, 2025
adf8036
rustc_const_eval: explain `TooGeneric` error
BennoLossin Sep 10, 2025
7547da8
remove fixme & use unreachable
BennoLossin Sep 12, 2025
674f94a
partial enum & union support
BennoLossin Sep 13, 2025
53fc6ad
make itemctxt structurally resolve field types
BennoLossin Sep 18, 2025
07e6d0e
lower_field_path: don't query the type of the last field
BennoLossin Sep 18, 2025
1ee4a9c
add cyclic test
BennoLossin Sep 18, 2025
64b720e
fix typo
BennoLossin Sep 18, 2025
b568a77
add `-Znext-solver` versions to tests
BennoLossin Sep 18, 2025
4a8f5c9
remove unaligned & unsized field support from lib & their lang items
BennoLossin Sep 18, 2025
915e8b2
add next solver trait assembly
BennoLossin Sep 18, 2025
d0e2f9e
remove `impl Field` for fields of packed structs
BennoLossin Sep 19, 2025
c7aa957
fix visibilty check
BennoLossin Sep 19, 2025
cb15775
field path lowering, do check the field's type if the kind is OffsetOf
BennoLossin Sep 20, 2025
df3daf5
allow dead code in cyclic test
BennoLossin Sep 20, 2025
eee5536
fix codegen test
BennoLossin Sep 20, 2025
5fe1380
fix clippy
BennoLossin Sep 20, 2025
acf2e31
remove re-export of `trait FieldPath`
BennoLossin Sep 23, 2025
f9d297f
make FRTs invariant
BennoLossin Sep 23, 2025
807ae15
fix relation with invariance
BennoLossin Sep 23, 2025
b2cb269
rustc_type_ir: walk: remove resolved FIXME
BennoLossin Sep 24, 2025
e6a0420
add send test
BennoLossin Sep 25, 2025
4f0462e
check for auto impls on field representing types
BennoLossin Sep 26, 2025
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix visibilty check
  • Loading branch information
BennoLossin committed Oct 3, 2025
commit c7aa95767449dabab15dd431c20c0565c8e7918d
25 changes: 12 additions & 13 deletions compiler/rustc_hir_typeck/src/fn_ctxt/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,12 @@ impl<'tcx> HirTyLowerer<'tcx> for FnCtxt<'_, 'tcx> {
// of error recovery.
field_indices.push((index, subindex));

if field.vis.is_accessible_from(sub_def_scope, self.tcx) {
self.tcx.check_stability(field.did, Some(hir_id), span, None);
} else {
self.private_field_err(ident, container_def.did()).emit();
}

if !last {
let field_ty = self.field_ty(span, field, args);

Expand All @@ -371,12 +377,6 @@ impl<'tcx> HirTyLowerer<'tcx> for FnCtxt<'_, 'tcx> {
},
);

if field.vis.is_accessible_from(sub_def_scope, self.tcx) {
self.tcx.check_stability(field.did, Some(hir_id), span, None);
} else {
self.private_field_err(ident, container_def.did()).emit();
}

current_container = field_ty;
}

Expand All @@ -396,6 +396,12 @@ impl<'tcx> HirTyLowerer<'tcx> for FnCtxt<'_, 'tcx> {
// of error recovery.
field_indices.push((FIRST_VARIANT, index));

if field.vis.is_accessible_from(def_scope, self.tcx) {
self.tcx.check_stability(field.did, Some(hir_id), span, None);
} else {
self.private_field_err(ident, container_def.did()).emit();
}

if !last {
let field_ty = self.field_ty(span, field, args);

Expand All @@ -416,13 +422,6 @@ impl<'tcx> HirTyLowerer<'tcx> for FnCtxt<'_, 'tcx> {
// not.
}
}

if field.vis.is_accessible_from(def_scope, self.tcx) {
self.tcx.check_stability(field.did, Some(hir_id), span, None);
} else {
self.private_field_err(ident, container_def.did()).emit();
}

current_container = field_ty;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,35 +1,35 @@
error[E0616]: field `a` of struct `A` is private
--> $DIR/deny-private-field.rs:43:25
--> $DIR/deny-private-field.rs:45:25
|
LL | let _: field_of!(A, a);
| ^ private field

error[E0616]: field `b` of struct `B` is private
--> $DIR/deny-private-field.rs:45:27
--> $DIR/deny-private-field.rs:47:27
|
LL | let _: field_of!(A, b.b);
| ^ private field

error[E0616]: field `c` of struct `C` is private
--> $DIR/deny-private-field.rs:47:29
--> $DIR/deny-private-field.rs:49:29
|
LL | let _: field_of!(A, b.c.c);
| ^ private field

error[E0616]: field `d` of struct `D` is private
--> $DIR/deny-private-field.rs:49:31
--> $DIR/deny-private-field.rs:51:31
|
LL | let _: field_of!(A, b.c.d.d);
| ^ private field

error[E0616]: field `e` of struct `E` is private
--> $DIR/deny-private-field.rs:51:33
--> $DIR/deny-private-field.rs:53:33
|
LL | let _: field_of!(A, b.c.d.e.e);
| ^ private field

error[E0616]: field `f` of struct `F` is private
--> $DIR/deny-private-field.rs:53:35
--> $DIR/deny-private-field.rs:55:35
|
LL | let _: field_of!(A, b.c.d.e.f.f);
| ^ private field
Expand Down
39 changes: 39 additions & 0 deletions tests/ui/field_projections/deny-private-field.old.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
error[E0616]: field `a` of struct `A` is private
--> $DIR/deny-private-field.rs:45:25
|
LL | let _: field_of!(A, a);
| ^ private field

error[E0616]: field `b` of struct `B` is private
--> $DIR/deny-private-field.rs:47:27
|
LL | let _: field_of!(A, b.b);
| ^ private field

error[E0616]: field `c` of struct `C` is private
--> $DIR/deny-private-field.rs:49:29
|
LL | let _: field_of!(A, b.c.c);
| ^ private field

error[E0616]: field `d` of struct `D` is private
--> $DIR/deny-private-field.rs:51:31
|
LL | let _: field_of!(A, b.c.d.d);
| ^ private field

error[E0616]: field `e` of struct `E` is private
--> $DIR/deny-private-field.rs:53:33
|
LL | let _: field_of!(A, b.c.d.e.e);
| ^ private field

error[E0616]: field `f` of struct `F` is private
--> $DIR/deny-private-field.rs:55:35
|
LL | let _: field_of!(A, b.c.d.e.f.f);
| ^ private field

error: aborting due to 6 previous errors

For more information about this error, try `rustc --explain E0616`.