Skip to content

Commit e004014

Browse files
committed
Auto merge of #146023 - tgross35:rollup-gbec538, r=tgross35
Rollup of 9 pull requests Successful merges: - #145242 (std: use a TAIT to define `SplitPaths` on UNIX) - #145467 (Stabilize `strict_provenance_atomic_ptr` feature) - #145756 (str: Stabilize `round_char_boundary` feature) - #145967 (compiler: Include span of too huge enum with `-Cdebuginfo=2`) - #145990 (`AutoDeref::final_ty` is already resolved) - #145991 (std: haiku: fix `B_FIND_PATH_IMAGE_PATH`) - #146000 (Improve librustdoc error when a file creation/modification failed) - #146017 (Mark pipe2 supported in Android) - #146022 (compiler-builtins subtree update) r? `@ghost` `@rustbot` modify labels: rollup
2 parents fe55364 + 319d554 commit e004014

File tree

43 files changed

+201
-138
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+201
-138
lines changed

compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@ use rustc_middle::ty::{
1919
self, AdtKind, CoroutineArgsExt, ExistentialTraitRef, Instance, Ty, TyCtxt, Visibility,
2020
};
2121
use rustc_session::config::{self, DebugInfo, Lto};
22-
use rustc_span::{DUMMY_SP, FileName, FileNameDisplayPreference, SourceFile, Symbol, hygiene};
22+
use rustc_span::{
23+
DUMMY_SP, FileName, FileNameDisplayPreference, SourceFile, Span, Symbol, hygiene,
24+
};
2325
use rustc_symbol_mangling::typeid_for_trait_ref;
2426
use rustc_target::spec::DebuginfoKind;
2527
use smallvec::smallvec;
@@ -423,6 +425,14 @@ fn build_slice_type_di_node<'ll, 'tcx>(
423425
/// This function will look up the debuginfo node in the TypeMap. If it can't find it, it
424426
/// will create the node by dispatching to the corresponding `build_*_di_node()` function.
425427
pub(crate) fn type_di_node<'ll, 'tcx>(cx: &CodegenCx<'ll, 'tcx>, t: Ty<'tcx>) -> &'ll DIType {
428+
spanned_type_di_node(cx, t, DUMMY_SP)
429+
}
430+
431+
pub(crate) fn spanned_type_di_node<'ll, 'tcx>(
432+
cx: &CodegenCx<'ll, 'tcx>,
433+
t: Ty<'tcx>,
434+
span: Span,
435+
) -> &'ll DIType {
426436
let unique_type_id = UniqueTypeId::for_ty(cx.tcx, t);
427437

428438
if let Some(existing_di_node) = debug_context(cx).type_map.di_node_for_unique_id(unique_type_id)
@@ -460,7 +470,7 @@ pub(crate) fn type_di_node<'ll, 'tcx>(cx: &CodegenCx<'ll, 'tcx>, t: Ty<'tcx>) ->
460470
ty::Adt(def, ..) => match def.adt_kind() {
461471
AdtKind::Struct => build_struct_type_di_node(cx, unique_type_id),
462472
AdtKind::Union => build_union_type_di_node(cx, unique_type_id),
463-
AdtKind::Enum => enums::build_enum_type_di_node(cx, unique_type_id),
473+
AdtKind::Enum => enums::build_enum_type_di_node(cx, unique_type_id, span),
464474
},
465475
ty::Tuple(_) => build_tuple_type_di_node(cx, unique_type_id),
466476
_ => bug!("debuginfo: unexpected type in type_di_node(): {:?}", t),

compiler/rustc_codegen_llvm/src/debuginfo/metadata/enums/mod.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use rustc_middle::bug;
1010
use rustc_middle::mir::CoroutineLayout;
1111
use rustc_middle::ty::layout::{LayoutOf, TyAndLayout};
1212
use rustc_middle::ty::{self, AdtDef, CoroutineArgs, CoroutineArgsExt, Ty, VariantDef};
13-
use rustc_span::Symbol;
13+
use rustc_span::{Span, Symbol};
1414

1515
use super::type_map::{DINodeCreationResult, UniqueTypeId};
1616
use super::{SmallVec, size_and_align_of};
@@ -30,13 +30,14 @@ mod native;
3030
pub(super) fn build_enum_type_di_node<'ll, 'tcx>(
3131
cx: &CodegenCx<'ll, 'tcx>,
3232
unique_type_id: UniqueTypeId<'tcx>,
33+
span: Span,
3334
) -> DINodeCreationResult<'ll> {
3435
let enum_type = unique_type_id.expect_ty();
3536
let &ty::Adt(enum_adt_def, _) = enum_type.kind() else {
3637
bug!("build_enum_type_di_node() called with non-enum type: `{:?}`", enum_type)
3738
};
3839

39-
let enum_type_and_layout = cx.layout_of(enum_type);
40+
let enum_type_and_layout = cx.spanned_layout_of(enum_type, span);
4041

4142
if wants_c_like_enum_debuginfo(cx.tcx, enum_type_and_layout) {
4243
return build_c_style_enum_di_node(cx, enum_adt_def, enum_type_and_layout);

compiler/rustc_codegen_llvm/src/debuginfo/mod.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ use rustc_target::spec::DebuginfoKind;
2828
use smallvec::SmallVec;
2929
use tracing::debug;
3030

31-
use self::metadata::{UNKNOWN_COLUMN_NUMBER, UNKNOWN_LINE_NUMBER, file_metadata, type_di_node};
31+
use self::metadata::{
32+
UNKNOWN_COLUMN_NUMBER, UNKNOWN_LINE_NUMBER, file_metadata, spanned_type_di_node, type_di_node,
33+
};
3234
use self::namespace::mangled_name_of_instance;
3335
use self::utils::{DIB, create_DIArray, is_node_local_to_unit};
3436
use crate::builder::Builder;
@@ -626,7 +628,7 @@ impl<'ll, 'tcx> DebugInfoCodegenMethods<'tcx> for CodegenCx<'ll, 'tcx> {
626628
let loc = self.lookup_debug_loc(span.lo());
627629
let file_metadata = file_metadata(self, &loc.file);
628630

629-
let type_metadata = type_di_node(self, variable_type);
631+
let type_metadata = spanned_type_di_node(self, variable_type, span);
630632

631633
let (argument_index, dwarf_tag) = match variable_kind {
632634
ArgumentVariable(index) => (index as c_uint, DW_TAG_arg_variable),

compiler/rustc_hir_analysis/src/autoderef.rs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -202,14 +202,10 @@ impl<'a, 'tcx> Autoderef<'a, 'tcx> {
202202
Some((normalized_ty, ocx.into_pending_obligations()))
203203
}
204204

205-
/// Returns the final type we ended up with, which may be an inference
206-
/// variable (we will resolve it first, if we want).
207-
pub fn final_ty(&self, resolve: bool) -> Ty<'tcx> {
208-
if resolve {
209-
self.infcx.resolve_vars_if_possible(self.state.cur_ty)
210-
} else {
211-
self.state.cur_ty
212-
}
205+
/// Returns the final type we ended up with, which may be an unresolved
206+
/// inference variable.
207+
pub fn final_ty(&self) -> Ty<'tcx> {
208+
self.state.cur_ty
213209
}
214210

215211
pub fn step_count(&self) -> usize {

compiler/rustc_hir_typeck/src/autoderef.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
4242

4343
let mut obligations = PredicateObligations::new();
4444
let targets =
45-
steps.iter().skip(1).map(|&(ty, _)| ty).chain(iter::once(autoderef.final_ty(false)));
45+
steps.iter().skip(1).map(|&(ty, _)| ty).chain(iter::once(autoderef.final_ty()));
4646
let steps: Vec<_> = steps
4747
.iter()
4848
.map(|&(source, kind)| {

compiler/rustc_hir_typeck/src/callee.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
8686
result = self.try_overloaded_call_step(call_expr, callee_expr, arg_exprs, &autoderef);
8787
}
8888

89-
match autoderef.final_ty(false).kind() {
89+
match autoderef.final_ty().kind() {
9090
ty::FnDef(def_id, _) => {
9191
let abi = self.tcx.fn_sig(def_id).skip_binder().skip_binder().abi;
9292
self.check_call_abi(abi, call_expr.span);
@@ -200,8 +200,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
200200
arg_exprs: &'tcx [hir::Expr<'tcx>],
201201
autoderef: &Autoderef<'a, 'tcx>,
202202
) -> Option<CallStep<'tcx>> {
203-
let adjusted_ty =
204-
self.structurally_resolve_type(autoderef.span(), autoderef.final_ty(false));
203+
let adjusted_ty = self.structurally_resolve_type(autoderef.span(), autoderef.final_ty());
205204

206205
// If the callee is a function pointer or a closure, then we're all set.
207206
match *adjusted_ty.kind() {

compiler/rustc_hir_typeck/src/expr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2918,7 +2918,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
29182918
// Emits an error if we deref an infer variable, like calling `.field` on a base type
29192919
// of `&_`. We can also use this to suppress unnecessary "missing field" errors that
29202920
// will follow ambiguity errors.
2921-
let final_ty = self.structurally_resolve_type(autoderef.span(), autoderef.final_ty(false));
2921+
let final_ty = self.structurally_resolve_type(autoderef.span(), autoderef.final_ty());
29222922
if let ty::Error(_) = final_ty.kind() {
29232923
return final_ty;
29242924
}

compiler/rustc_hir_typeck/src/method/probe.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -629,7 +629,7 @@ pub(crate) fn method_autoderef_steps<'tcx>(
629629
.collect();
630630
(steps, autoderef_via_deref.reached_recursion_limit())
631631
};
632-
let final_ty = autoderef_via_deref.final_ty(true);
632+
let final_ty = autoderef_via_deref.final_ty();
633633
let opt_bad_ty = match final_ty.kind() {
634634
ty::Infer(ty::TyVar(_)) | ty::Error(_) => Some(MethodAutoderefBadTy {
635635
reached_raw_pointer,

compiler/rustc_hir_typeck/src/place_op.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
109109
index_ty: Ty<'tcx>,
110110
index_expr: &hir::Expr<'_>,
111111
) -> Option<(/*index type*/ Ty<'tcx>, /*element type*/ Ty<'tcx>)> {
112-
let adjusted_ty =
113-
self.structurally_resolve_type(autoderef.span(), autoderef.final_ty(false));
112+
let adjusted_ty = self.structurally_resolve_type(autoderef.span(), autoderef.final_ty());
114113
debug!(
115114
"try_index_step(expr={:?}, base_expr={:?}, adjusted_ty={:?}, \
116115
index_ty={:?})",

compiler/rustc_middle/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#![allow(rustc::diagnostic_outside_of_impl)]
3030
#![allow(rustc::direct_use_of_rustc_type_ir)]
3131
#![allow(rustc::untranslatable_diagnostic)]
32+
#![cfg_attr(bootstrap, feature(round_char_boundary))]
3233
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
3334
#![doc(rust_logo)]
3435
#![feature(allocator_api)]
@@ -51,7 +52,6 @@
5152
#![feature(negative_impls)]
5253
#![feature(never_type)]
5354
#![feature(ptr_alignment_type)]
54-
#![feature(round_char_boundary)]
5555
#![feature(rustc_attrs)]
5656
#![feature(rustdoc_internals)]
5757
#![feature(sized_hierarchy)]

0 commit comments

Comments
 (0)