Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
f7acd9f
Fix assertion failures in `OwnedHandle` with `windows_subsystem`.
sunfishcode Sep 9, 2021
2df9cc5
Fix Windows compilation errors.
sunfishcode Sep 9, 2021
0693aa1
Document the valid values for `HandleOrNull` and `HandleOrInvalid`.
sunfishcode Oct 5, 2021
9654d52
Ensure that pushing empty path works as before
seanyoung Oct 8, 2021
427b6a7
Feature gate and make must_not_suspend allow-by-default
guswynn Oct 12, 2021
4b4b56d
Only use `clone3` when needed for pidfd
cuviper Oct 15, 2021
aaa8f4e
Update another comment on fork vs. clone3
cuviper Oct 15, 2021
462002b
Also note tool expectations of fork vs clone3
cuviper Oct 15, 2021
d658d6d
Revert "Do not call getpid wrapper after fork in tests"
cuviper Oct 15, 2021
d19aeb2
Fix documentation header sizes
jsha Oct 22, 2021
3374d0d
Fixes incorrect handling of ADT's drop requirements
JakobDegen Oct 23, 2021
4f9474c
Add regresstion test for #90024.
JakobDegen Oct 24, 2021
d092236
Clean up debug statements in needs_drop
JakobDegen Oct 26, 2021
2039a92
Fix ICE when forgetting to `Box` a parameter to a `Self::func` call
JakobDegen Oct 24, 2021
7a83694
expose default substs in param_env
b-naber Oct 25, 2021
96fd370
add tests
b-naber Oct 25, 2021
dc73bdc
Update odht crate to 0.3.1 (big-endian bugfix)
michaelwoerister Oct 29, 2021
640bfaf
Add more missing methods to `IntraLinkCrateLoader`
jyn514 Nov 8, 2021
5fd4bb4
Go back to loading all external crates unconditionally
jyn514 Nov 1, 2021
082accd
Split doc_cfg and doc_auto_cfg features
GuillaumeGomez Nov 2, 2021
fb40f17
Also check for feature gates in "src/test/rustdoc"
GuillaumeGomez Nov 2, 2021
fed62b2
Apply adjustments for field expression even if inaccessible
nbdd0121 Nov 2, 2021
5de0c84
introduce an enum for tracking the 2229 migration causes
nikomatsakis Nov 4, 2021
042c837
rework diagnostic reporting to be more structured
nikomatsakis Nov 4, 2021
34cd4ef
handle case of a variable not captured
nikomatsakis Nov 5, 2021
d9ddee4
apply suggestions from code review
nikomatsakis Nov 5, 2021
e63c3b5
Properly register text_direction_codepoint_in_comment lint.
hkratz Nov 5, 2021
cba2546
Bump stage0 to stable 1.56.1
cuviper Nov 16, 2021
236bc61
Use ubuntu image to download openssl, curl sources, cacert.pem
hkratz Oct 31, 2021
69b4a85
Ignore files copied from previous stage when generating hash.
hkratz Nov 1, 2021
4d156c3
Android is not GNU
cuviper Nov 12, 2021
a4a72e7
Update llvm submodule
Amanieu Nov 16, 2021
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
Prev Previous commit
Next Next commit
Apply adjustments for field expression even if inaccessible
The adjustments are used later by ExprUseVisitor to build Place projections
and without adjustments it can produce invalid result.

(cherry picked from commit f556075)
  • Loading branch information
nbdd0121 authored and cuviper committed Nov 16, 2021
commit fed62b2069e82fa88f34a52353a3dbe7b03c5961
9 changes: 6 additions & 3 deletions compiler/rustc_typeck/src/check/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1698,15 +1698,15 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
// Save the index of all fields regardless of their visibility in case
// of error recovery.
self.write_field_index(expr.hir_id, index);
let adjustments = self.adjust_steps(&autoderef);
if field.vis.is_accessible_from(def_scope, self.tcx) {
let adjustments = self.adjust_steps(&autoderef);
self.apply_adjustments(base, adjustments);
self.register_predicates(autoderef.into_obligations());

self.tcx.check_stability(field.did, Some(expr.hir_id), expr.span, None);
return field_ty;
}
private_candidate = Some((base_def.did, field_ty));
private_candidate = Some((adjustments, base_def.did, field_ty));
}
}
ty::Tuple(tys) => {
Expand All @@ -1729,7 +1729,10 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
}
self.structurally_resolved_type(autoderef.span(), autoderef.final_ty(false));

if let Some((did, field_ty)) = private_candidate {
if let Some((adjustments, did, field_ty)) = private_candidate {
// (#90483) apply adjustments to avoid ExprUseVisitor from
// creating erroneous projection.
self.apply_adjustments(base, adjustments);
self.ban_private_field_access(expr, expr_t, field, did);
return field_ty;
}
Expand Down
14 changes: 14 additions & 0 deletions src/test/ui/typeck/issue-90483-inaccessible-field-adjustment.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// edition:2021

mod m {
pub struct S { foo: i32 }
impl S {
pub fn foo(&self) -> i32 { 42 }
}
}

fn bar(s: &m::S) {
|| s.foo() + s.foo; //~ ERROR E0616
}

fn main() {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
error[E0616]: field `foo` of struct `S` is private
--> $DIR/issue-90483-inaccessible-field-adjustment.rs:11:18
|
LL | || s.foo() + s.foo;
| ^^^ private field
|
help: a method `foo` also exists, call it with parentheses
|
LL | || s.foo() + s.foo();
| ++

error: aborting due to previous error

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