Skip to content
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

Rollup of 11 pull requests #138365

Closed
wants to merge 39 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
6b29bb6
Prevent ICE in autodiff validation by emitting user-friendly errors
Sa4dUs Mar 2, 2025
50efba2
Adjust `Map`'s `to_string` functionality.
nnethercote Feb 21, 2025
fc40f6f
Rename `hir_attrs` query as `hir_attr_map`.
nnethercote Feb 24, 2025
1047768
Move methods from `Map` to `TyCtxt`, part 4.
nnethercote Feb 21, 2025
9067f7c
Explain weird quirk in user type annotation lowering
compiler-errors Mar 9, 2025
8ab05ad
Do not write user type annotation for const param value path
compiler-errors Mar 9, 2025
ed6dfdd
Do not feed anon const a type that references generics that it does n…
compiler-errors Mar 9, 2025
f525b17
Remove AdtFlags::IS_ANONYMOUS and Copy/Clone condition for anonymous ADT
compiler-errors Mar 10, 2025
02bb2d4
Disable CFI for weakly linked syscalls
1c3t3a Mar 4, 2025
e5dc1e3
Add comments for #[no_sanitize(cfi)] in stdlib
1c3t3a Mar 10, 2025
f38819c
Add some layout tests for pattern type edge cases
oli-obk Jan 30, 2025
916f955
Reject wrapping ranges of pattern types
oli-obk Jan 30, 2025
9d87d4e
Add tests for pattern type literals
oli-obk Jan 29, 2025
f87e58f
Allow int literals for pattern types with int base types
oli-obk Jan 29, 2025
53237c8
Refactor GCC compilation
Kobzol Mar 5, 2025
009aba0
Add `gcc` bootstrap config section
Kobzol Mar 5, 2025
c68a5ec
Add `[gcc] download-ci-gcc` option
Kobzol Mar 5, 2025
3de10b0
Add `download-ci-gcc-stamp` file
Kobzol Mar 5, 2025
bc6302c
Implement downloading GCC from CI
Kobzol Mar 5, 2025
2b1b09c
Add change tracker entry
Kobzol Mar 5, 2025
dcc2b30
Add triagebot entry for GCC modifications
Kobzol Mar 10, 2025
bf58a35
stabilize `ci_rustc_if_unchanged_logic` test for local environments
onur-ozkan Mar 8, 2025
cf8e1f5
Fix ICE for invalid return activity and proper error handling
Sa4dUs Mar 7, 2025
33f9a49
Combine autodiff errors together
Sa4dUs Mar 10, 2025
8546e01
Add individual activity span availability FIXME
Sa4dUs Mar 10, 2025
3846f94
miri native_calls: ensure we actually expose *mutable* provenance to …
RalfJung Mar 11, 2025
ba6c406
let the bodies hit the floor
lcnr Mar 11, 2025
75a69a4
Do not download GCC in tests
Kobzol Mar 11, 2025
cb81162
Rollup merge of #137504 - nnethercote:remove-Map-4, r=Zalathar
matthiaskrgr Mar 11, 2025
ef10f32
Rollup merge of #137715 - oli-obk:pattern-type-literals, r=BoxyUwU
matthiaskrgr Mar 11, 2025
beb284e
Rollup merge of #138002 - 1c3t3a:fix-std-cfi-violation, r=rcvalle
matthiaskrgr Mar 11, 2025
11e747b
Rollup merge of #138051 - Kobzol:download-ci-gcc, r=onur-ozkan
matthiaskrgr Mar 11, 2025
95c4165
Rollup merge of #138231 - Sa4dUs:autodiff-ice, r=ZuseZ4
matthiaskrgr Mar 11, 2025
29d662d
Rollup merge of #138245 - onur-ozkan:ci-rustc-test-fix, r=jieyouxu
matthiaskrgr Mar 11, 2025
523e589
Rollup merge of #138256 - compiler-errors:anon-const-ty, r=BoxyUwU
matthiaskrgr Mar 11, 2025
fb81345
Rollup merge of #138284 - compiler-errors:const-param-ty-annotation, …
matthiaskrgr Mar 11, 2025
522ae7f
Rollup merge of #138296 - compiler-errors:deanonymous, r=lcnr
matthiaskrgr Mar 11, 2025
9b18387
Rollup merge of #138352 - RalfJung:miri-native-calls-exposed, r=oli-obk
matthiaskrgr Mar 11, 2025
3a3e9a0
Rollup merge of #138354 - lcnr:goodbye-TypeVerifier, r=compiler-errors
matthiaskrgr Mar 11, 2025
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
4 changes: 2 additions & 2 deletions compiler/rustc_borrowck/src/diagnostics/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
let var_id =
self.infcx.tcx.closure_captures(def_id)[field.index()].get_root_variable();

Some(self.infcx.tcx.hir().name(var_id).to_string())
Some(self.infcx.tcx.hir_name(var_id).to_string())
}
_ => {
// Might need a revision when the fields in trait RFC is implemented
Expand Down Expand Up @@ -1124,7 +1124,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
def_id, target_place, places
);
let hir_id = self.infcx.tcx.local_def_id_to_hir_id(def_id);
let expr = &self.infcx.tcx.hir().expect_expr(hir_id).kind;
let expr = &self.infcx.tcx.hir_expect_expr(hir_id).kind;
debug!("closure_span: hir_id={:?} expr={:?}", hir_id, expr);
if let &hir::ExprKind::Closure(&hir::Closure { kind, fn_decl_span, .. }) = expr {
for (captured_place, place) in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -698,7 +698,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
if !matches!(k, hir::AssocItemKind::Fn { .. }) {
continue;
}
if self.infcx.tcx.hir().name(hi) != self.infcx.tcx.hir().name(my_hir) {
if self.infcx.tcx.hir_name(hi) != self.infcx.tcx.hir_name(my_hir) {
continue;
}
f_in_trait_opt = Some(hi);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {

if let Some(opaque_def_id) = opaque_def_id.as_local()
&& let hir::OpaqueTyOrigin::FnReturn { parent, .. } =
tcx.hir().expect_opaque_ty(opaque_def_id).origin
tcx.hir_expect_opaque_ty(opaque_def_id).origin
{
if let Some(sugg) = impl_trait_overcapture_suggestion(
tcx,
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_borrowck/src/diagnostics/region_name.rs
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ impl<'tcx> MirBorrowckCtxt<'_, '_, 'tcx> {
}
};
let hir::ExprKind::Closure(&hir::Closure { fn_decl_span, .. }) =
tcx.hir().expect_expr(self.mir_hir_id()).kind
tcx.hir_expect_expr(self.mir_hir_id()).kind
else {
bug!("Closure is not defined by a closure expr");
};
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_borrowck/src/diagnostics/var_name.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
let upvar_hir_id = upvars[upvar_index].get_root_variable();
debug!("get_upvar_name_and_span_for_region: upvar_hir_id={upvar_hir_id:?}");

let upvar_name = tcx.hir().name(upvar_hir_id);
let upvar_name = tcx.hir_name(upvar_hir_id);
let upvar_span = tcx.hir().span(upvar_hir_id);
debug!(
"get_upvar_name_and_span_for_region: upvar_name={upvar_name:?} upvar_span={upvar_span:?}",
Expand Down
54 changes: 26 additions & 28 deletions compiler/rustc_borrowck/src/type_check/input_output.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ use crate::universal_regions::DefiningTy;
impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
/// Check explicit closure signature annotation,
/// e.g., `|x: FxIndexMap<_, &'static u32>| ...`.
#[instrument(skip(self, body), level = "debug")]
pub(super) fn check_signature_annotation(&mut self, body: &Body<'tcx>) {
let mir_def_id = body.source.def_id().expect_local();
#[instrument(skip(self), level = "debug")]
pub(super) fn check_signature_annotation(&mut self) {
let mir_def_id = self.body.source.def_id().expect_local();

if !self.tcx().is_closure_like(mir_def_id.to_def_id()) {
return;
Expand All @@ -38,9 +38,9 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
// (e.g., the `_` in the code above) with fresh variables.
// Then replace the bound items in the fn sig with fresh variables,
// so that they represent the view from "inside" the closure.
let user_provided_sig = self.instantiate_canonical(body.span, &user_provided_poly_sig);
let user_provided_sig = self.instantiate_canonical(self.body.span, &user_provided_poly_sig);
let mut user_provided_sig = self.infcx.instantiate_binder_with_fresh_vars(
body.span,
self.body.span,
BoundRegionConversionTime::FnCall,
user_provided_sig,
);
Expand All @@ -66,12 +66,13 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
Ty::new_tup(self.tcx(), user_provided_sig.inputs()),
args.tupled_upvars_ty(),
args.coroutine_captures_by_ref_ty(),
self.infcx.next_region_var(RegionVariableOrigin::MiscVariable(body.span), || {
RegionCtxt::Unknown
}),
self.infcx
.next_region_var(RegionVariableOrigin::MiscVariable(self.body.span), || {
RegionCtxt::Unknown
}),
);

let next_ty_var = || self.infcx.next_ty_var(body.span);
let next_ty_var = || self.infcx.next_ty_var(self.body.span);
let output_ty = Ty::new_coroutine(
self.tcx(),
self.tcx().coroutine_for_closure(mir_def_id),
Expand Down Expand Up @@ -107,9 +108,10 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
for (&user_ty, arg_decl) in user_provided_sig.inputs().iter().zip_eq(
// In MIR, closure args begin with an implicit `self`.
// Also, coroutines have a resume type which may be implicitly `()`.
body.args_iter()
self.body
.args_iter()
.skip(1 + if is_coroutine_with_implicit_resume_ty { 1 } else { 0 })
.map(|local| &body.local_decls[local]),
.map(|local| &self.body.local_decls[local]),
) {
self.ascribe_user_type_skip_wf(
arg_decl.ty,
Expand All @@ -119,20 +121,16 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
}

// If the user explicitly annotated the output type, enforce it.
let output_decl = &body.local_decls[RETURN_PLACE];
let output_decl = &self.body.local_decls[RETURN_PLACE];
self.ascribe_user_type_skip_wf(
output_decl.ty,
ty::UserType::new(ty::UserTypeKind::Ty(user_provided_sig.output())),
output_decl.source_info.span,
);
}

#[instrument(skip(self, body), level = "debug")]
pub(super) fn equate_inputs_and_outputs(
&mut self,
body: &Body<'tcx>,
normalized_inputs_and_output: &[Ty<'tcx>],
) {
#[instrument(skip(self), level = "debug")]
pub(super) fn equate_inputs_and_outputs(&mut self, normalized_inputs_and_output: &[Ty<'tcx>]) {
let (&normalized_output_ty, normalized_input_tys) =
normalized_inputs_and_output.split_last().unwrap();

Expand All @@ -141,36 +139,36 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {

// Equate expected input tys with those in the MIR.
for (argument_index, &normalized_input_ty) in normalized_input_tys.iter().enumerate() {
if argument_index + 1 >= body.local_decls.len() {
if argument_index + 1 >= self.body.local_decls.len() {
self.tcx()
.dcx()
.span_bug(body.span, "found more normalized_input_ty than local_decls");
.span_bug(self.body.span, "found more normalized_input_ty than local_decls");
}

// In MIR, argument N is stored in local N+1.
let local = Local::from_usize(argument_index + 1);

let mir_input_ty = body.local_decls[local].ty;
let mir_input_ty = self.body.local_decls[local].ty;

let mir_input_span = body.local_decls[local].source_info.span;
let mir_input_span = self.body.local_decls[local].source_info.span;
self.equate_normalized_input_or_output(
normalized_input_ty,
mir_input_ty,
mir_input_span,
);
}

if let Some(mir_yield_ty) = body.yield_ty() {
let yield_span = body.local_decls[RETURN_PLACE].source_info.span;
if let Some(mir_yield_ty) = self.body.yield_ty() {
let yield_span = self.body.local_decls[RETURN_PLACE].source_info.span;
self.equate_normalized_input_or_output(
self.universal_regions.yield_ty.unwrap(),
mir_yield_ty,
yield_span,
);
}

if let Some(mir_resume_ty) = body.resume_ty() {
let yield_span = body.local_decls[RETURN_PLACE].source_info.span;
if let Some(mir_resume_ty) = self.body.resume_ty() {
let yield_span = self.body.local_decls[RETURN_PLACE].source_info.span;
self.equate_normalized_input_or_output(
self.universal_regions.resume_ty.unwrap(),
mir_resume_ty,
Expand All @@ -179,8 +177,8 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
}

// Return types are a bit more complex. They may contain opaque `impl Trait` types.
let mir_output_ty = body.local_decls[RETURN_PLACE].ty;
let output_span = body.local_decls[RETURN_PLACE].source_info.span;
let mir_output_ty = self.body.local_decls[RETURN_PLACE].ty;
let output_span = self.body.local_decls[RETURN_PLACE].source_info.span;
self.equate_normalized_input_or_output(normalized_output_ty, mir_output_ty, output_span);
}

Expand Down
20 changes: 6 additions & 14 deletions compiler/rustc_borrowck/src/type_check/liveness/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ mod trace;
/// performed before
pub(super) fn generate<'a, 'tcx>(
typeck: &mut TypeChecker<'_, 'tcx>,
body: &Body<'tcx>,
location_map: &DenseLocationMap,
flow_inits: ResultsCursor<'a, 'tcx, MaybeInitializedPlaces<'a, 'tcx>>,
move_data: &MoveData<'tcx>,
Expand All @@ -51,23 +50,16 @@ pub(super) fn generate<'a, 'tcx>(
// We do record these regions in the polonius context, since they're used to differentiate
// relevant and boring locals, which is a key distinction used later in diagnostics.
if typeck.tcx().sess.opts.unstable_opts.polonius.is_next_enabled() {
let (_, boring_locals) = compute_relevant_live_locals(typeck.tcx(), &free_regions, body);
let (_, boring_locals) =
compute_relevant_live_locals(typeck.tcx(), &free_regions, typeck.body);
typeck.polonius_liveness.as_mut().unwrap().boring_nll_locals =
boring_locals.into_iter().collect();
free_regions = typeck.universal_regions.universal_regions_iter().collect();
}
let (relevant_live_locals, boring_locals) =
compute_relevant_live_locals(typeck.tcx(), &free_regions, body);

trace::trace(
typeck,
body,
location_map,
flow_inits,
move_data,
relevant_live_locals,
boring_locals,
);
compute_relevant_live_locals(typeck.tcx(), &free_regions, typeck.body);

trace::trace(typeck, location_map, flow_inits, move_data, relevant_live_locals, boring_locals);

// Mark regions that should be live where they appear within rvalues or within a call: like
// args, regions, and types.
Expand All @@ -76,7 +68,7 @@ pub(super) fn generate<'a, 'tcx>(
&mut typeck.constraints.liveness_constraints,
&typeck.universal_regions,
&mut typeck.polonius_liveness,
body,
typeck.body,
);
}

Expand Down
Loading