Skip to content

Commit efd02e1

Browse files
Make str into a real struct
1 parent d358cca commit efd02e1

File tree

98 files changed

+240
-231
lines changed

Some content is hidden

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

98 files changed

+240
-231
lines changed

compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,6 @@ fn build_slice_type_di_node<'ll, 'tcx>(
406406
) -> DINodeCreationResult<'ll> {
407407
let element_type = match slice_type.kind() {
408408
ty::Slice(element_type) => *element_type,
409-
ty::Str => cx.tcx.types.u8,
410409
_ => {
411410
bug!(
412411
"Only ty::Slice is valid for build_slice_type_di_node(). Found {:?} instead.",
@@ -440,7 +439,7 @@ pub fn type_di_node<'ll, 'tcx>(cx: &CodegenCx<'ll, 'tcx>, t: Ty<'tcx>) -> &'ll D
440439
}
441440
ty::Tuple(elements) if elements.is_empty() => build_basic_type_di_node(cx, t),
442441
ty::Array(..) => build_fixed_size_array_di_node(cx, unique_type_id, t),
443-
ty::Slice(_) | ty::Str => build_slice_type_di_node(cx, t, unique_type_id),
442+
ty::Slice(_) => build_slice_type_di_node(cx, t, unique_type_id),
444443
ty::Dynamic(..) => build_dyn_type_di_node(cx, t, unique_type_id),
445444
ty::Foreign(..) => build_foreign_type_di_node(cx, t, unique_type_id),
446445
ty::RawPtr(ty::TypeAndMut { ty: pointee_type, .. }) | ty::Ref(_, pointee_type, _) => {

compiler/rustc_codegen_llvm/src/debuginfo/utils.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ pub(crate) fn fat_pointer_kind<'ll, 'tcx>(
7777
}
7878

7979
match *pointee_tail_ty.kind() {
80-
ty::Str | ty::Slice(_) => Some(FatPtrKind::Slice),
80+
ty::Slice(_) => Some(FatPtrKind::Slice),
8181
ty::Dynamic(..) => Some(FatPtrKind::Dyn),
8282
ty::Foreign(_) => {
8383
// Assert that pointers to foreign types really are thin:

compiler/rustc_codegen_llvm/src/type_of.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ fn uncached_llvm_type<'a, 'tcx>(
4242
// FIXME(eddyb) producing readable type names for trait objects can result
4343
// in problematically distinct types due to HRTB and subtyping (see #47638).
4444
// ty::Dynamic(..) |
45-
ty::Adt(..) | ty::Closure(..) | ty::Foreign(..) | ty::Generator(..) | ty::Str
45+
ty::Adt(..) | ty::Closure(..) | ty::Foreign(..) | ty::Generator(..)
4646
// For performance reasons we use names only when emitting LLVM IR. Unless we are on
4747
// LLVM < 14, where the use of unnamed types resulted in various issues, e.g., #76213,
4848
// #79564, and #79246.

compiler/rustc_codegen_ssa/src/debuginfo/type_names.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ fn push_debuginfo_type_name<'tcx>(
5959
match *t.kind() {
6060
ty::Bool => output.push_str("bool"),
6161
ty::Char => output.push_str("char"),
62-
ty::Str => {
62+
ty::Adt(def, _) if def.is_str() => {
6363
if cpp_like_debuginfo {
6464
output.push_str("str$")
6565
} else {

compiler/rustc_codegen_ssa/src/glue.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ pub fn size_and_align_of_dst<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
3737

3838
(size, align)
3939
}
40-
ty::Slice(_) | ty::Str => {
40+
ty::Slice(_) => {
4141
let unit = layout.field(bx, 0);
4242
// The info in this case is the length of the str, so the size is that
4343
// times the unit size.

compiler/rustc_codegen_ssa/src/mir/place.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ impl<'a, 'tcx, V: CodegenObject> PlaceRef<'tcx, V> {
146146
return simple();
147147
}
148148
_ if field.is_sized() => return simple(),
149-
ty::Slice(..) | ty::Str | ty::Foreign(..) => return simple(),
149+
ty::Slice(..) | ty::Foreign(..) => return simple(),
150150
ty::Adt(def, _) => {
151151
if def.repr().packed() {
152152
// FIXME(eddyb) generalize the adjustment when we

compiler/rustc_codegen_ssa/src/traits/type_.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ pub trait DerivedTypeMethods<'tcx>: BaseTypeMethods<'tcx> + MiscMethods<'tcx> {
9191
let tail = self.tcx().struct_tail_erasing_lifetimes(ty, param_env);
9292
match tail.kind() {
9393
ty::Foreign(..) => false,
94-
ty::Str | ty::Slice(..) | ty::Dynamic(..) => true,
94+
ty::Slice(..) | ty::Dynamic(..) => true,
9595
_ => bug!("unexpected unsized tail: {:?}", tail),
9696
}
9797
}

compiler/rustc_const_eval/src/const_eval/eval_queries.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ pub(super) fn op_to_const<'tcx>(
126126
Abi::ScalarPair(..) => match op.layout.ty.kind() {
127127
ty::Ref(_, inner, _) => match *inner.kind() {
128128
ty::Slice(elem) => elem == ecx.tcx.types.u8,
129-
ty::Str => true,
129+
ty::Adt(def, _) => def.is_str(),
130130
_ => false,
131131
},
132132
_ => false,

compiler/rustc_const_eval/src/const_eval/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,6 @@ pub(crate) fn deref_mir_constant<'tcx>(
154154
MemPlaceMeta::None => mplace.layout.ty,
155155
// In case of unsized types, figure out the real type behind.
156156
MemPlaceMeta::Meta(scalar) => match mplace.layout.ty.kind() {
157-
ty::Str => bug!("there's no sized equivalent of a `str`"),
158157
ty::Slice(elem_ty) => tcx.mk_array(*elem_ty, scalar.to_machine_usize(&tcx).unwrap()),
159158
_ => bug!(
160159
"type {} should not have metadata, but had {:?}",

compiler/rustc_const_eval/src/const_eval/valtrees.rs

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,15 @@ pub(crate) fn const_to_valtree_inner<'tcx>(
111111
const_to_valtree_inner(ecx, &derefd_place, num_nodes)
112112
}
113113

114-
ty::Str | ty::Slice(_) | ty::Array(_, _) => {
114+
ty::Slice(_) | ty::Array(_, _) => {
115115
slice_branches(ecx, place, num_nodes)
116116
}
117+
118+
// FIXME(str): Do we need this?
119+
ty::Adt(def, _) if def.is_str() => {
120+
slice_branches(ecx, place, num_nodes)
121+
}
122+
117123
// Trait objects are not allowed in type level constants, as we have no concept for
118124
// resolving their backing type, even if we can do that at const eval time. We may
119125
// hypothetically be able to allow `dyn StructuralEq` trait objects in the future,
@@ -187,16 +193,9 @@ fn get_info_on_unsized_field<'tcx>(
187193
);
188194
let unsized_inner_ty = match tail.kind() {
189195
ty::Slice(t) => *t,
190-
ty::Str => tail,
191196
_ => bug!("expected Slice or Str"),
192197
};
193198

194-
// Have to adjust type for ty::Str
195-
let unsized_inner_ty = match unsized_inner_ty.kind() {
196-
ty::Str => tcx.mk_ty(ty::Uint(ty::UintTy::U8)),
197-
_ => unsized_inner_ty,
198-
};
199-
200199
// Get the number of elements in the unsized field
201200
let num_elems = last_valtree.unwrap_branch().len();
202201

@@ -215,10 +214,6 @@ fn create_pointee_place<'tcx>(
215214
// We need to create `Allocation`s for custom DSTs
216215

217216
let (unsized_inner_ty, num_elems) = get_info_on_unsized_field(ty, valtree, tcx);
218-
let unsized_inner_ty = match unsized_inner_ty.kind() {
219-
ty::Str => tcx.mk_ty(ty::Uint(ty::UintTy::U8)),
220-
_ => unsized_inner_ty,
221-
};
222217
let unsized_inner_ty_size =
223218
tcx.layout_of(ty::ParamEnv::empty().and(unsized_inner_ty)).unwrap().layout.size();
224219
debug!(?unsized_inner_ty, ?unsized_inner_ty_size, ?num_elems);
@@ -317,7 +312,6 @@ pub fn valtree_to_const_value<'tcx>(
317312
| ty::GeneratorWitnessMIR(..)
318313
| ty::FnPtr(_)
319314
| ty::RawPtr(_)
320-
| ty::Str
321315
| ty::Slice(_)
322316
| ty::Dynamic(..) => bug!("no ValTree should have been created for type {:?}", ty.kind()),
323317
}
@@ -353,7 +347,16 @@ fn valtree_into_mplace<'tcx>(
353347
intern_const_alloc_recursive(ecx, InternKind::Constant, &pointee_place).unwrap();
354348

355349
let imm = match inner_ty.kind() {
356-
ty::Slice(_) | ty::Str => {
350+
ty::Slice(_) => {
351+
let len = valtree.unwrap_branch().len();
352+
let len_scalar = Scalar::from_machine_usize(len as u64, &tcx);
353+
354+
Immediate::ScalarPair(
355+
Scalar::from_maybe_pointer((*pointee_place).ptr, &tcx),
356+
len_scalar,
357+
)
358+
}
359+
ty::Adt(def, _) if def.is_str() => {
357360
let len = valtree.unwrap_branch().len();
358361
let len_scalar = Scalar::from_machine_usize(len as u64, &tcx);
359362

@@ -368,7 +371,7 @@ fn valtree_into_mplace<'tcx>(
368371

369372
ecx.write_immediate(imm, &place.into()).unwrap();
370373
}
371-
ty::Adt(_, _) | ty::Tuple(_) | ty::Array(_, _) | ty::Str | ty::Slice(_) => {
374+
ty::Adt(_, _) | ty::Tuple(_) | ty::Array(_, _) | ty::Slice(_) => {
372375
let branches = valtree.unwrap_branch();
373376

374377
// Need to downcast place for enums
@@ -396,7 +399,8 @@ fn valtree_into_mplace<'tcx>(
396399
debug!(?i, ?inner_valtree);
397400

398401
let mut place_inner = match ty.kind() {
399-
ty::Str | ty::Slice(_) => ecx.mplace_index(&place, i as u64).unwrap(),
402+
ty::Adt(def, _) if def.is_str() => ecx.mplace_index(&place, i as u64).unwrap(),
403+
ty::Slice(_) => ecx.mplace_index(&place, i as u64).unwrap(),
400404
_ if !ty.is_sized(*ecx.tcx, ty::ParamEnv::empty())
401405
&& i == branches.len() - 1 =>
402406
{

compiler/rustc_const_eval/src/interpret/eval_context.rs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -573,6 +573,20 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
573573
return Ok(Some((layout.size, layout.align.abi)));
574574
}
575575
match layout.ty.kind() {
576+
// FIXME(str): Do we need this?
577+
ty::Adt(def, _) if def.is_str() => {
578+
let len = metadata.unwrap_meta().to_machine_usize(self)?;
579+
let elem = layout.field(self, 0);
580+
581+
// Make sure the slice is not too big.
582+
let size = elem.size.bytes().saturating_mul(len); // we rely on `max_size_of_val` being smaller than `u64::MAX`.
583+
let size = Size::from_bytes(size);
584+
if size > self.max_size_of_val() {
585+
throw_ub!(InvalidMeta("slice is bigger than largest supported object"));
586+
}
587+
Ok(Some((size, elem.align.abi)))
588+
}
589+
576590
ty::Adt(..) | ty::Tuple(..) => {
577591
// First get the size of all statically known fields.
578592
// Don't use type_of::sizing_type_of because that expects t to be sized,
@@ -638,7 +652,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
638652
Ok(Some(self.get_vtable_size_and_align(vtable)?))
639653
}
640654

641-
ty::Slice(_) | ty::Str => {
655+
ty::Slice(_) => {
642656
let len = metadata.unwrap_meta().to_machine_usize(self)?;
643657
let elem = layout.field(self, 0);
644658

compiler/rustc_const_eval/src/interpret/intrinsics.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@ pub(crate) fn eval_nullary_intrinsic<'tcx>(
9090
| ty::Uint(_)
9191
| ty::Float(_)
9292
| ty::Foreign(_)
93-
| ty::Str
9493
| ty::Array(_, _)
9594
| ty::Slice(_)
9695
| ty::RawPtr(_)

compiler/rustc_const_eval/src/interpret/place.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,10 @@ impl<'tcx, Prov: Provenance> MPlaceTy<'tcx, Prov> {
229229
if self.layout.is_unsized() {
230230
// We need to consult `meta` metadata
231231
match self.layout.ty.kind() {
232-
ty::Slice(..) | ty::Str => self.mplace.meta.unwrap_meta().to_machine_usize(cx),
232+
ty::Slice(..) => self.mplace.meta.unwrap_meta().to_machine_usize(cx),
233+
ty::Adt(adt, _) if adt.is_str() => {
234+
self.mplace.meta.unwrap_meta().to_machine_usize(cx)
235+
}
233236
_ => bug!("len not supported on unsized type {:?}", self.layout.ty),
234237
}
235238
} else {

compiler/rustc_const_eval/src/interpret/projection.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,8 +200,9 @@ where
200200
}
201201
_ => span_bug!(
202202
self.cur_span(),
203-
"`mplace_index` called on non-array type {:?}",
204-
base.layout.ty
203+
"`mplace_index` called on non-array type {:?} with abi {:?}",
204+
base.layout.ty,
205+
base.layout.fields
205206
),
206207
}
207208
}

compiler/rustc_const_eval/src/interpret/validity.rs

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ impl<'rt, 'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> ValidityVisitor<'rt, 'mir, '
347347
);
348348
// FIXME: check if the type/trait match what ty::Dynamic says?
349349
}
350-
ty::Slice(..) | ty::Str => {
350+
ty::Slice(..) => {
351351
let _len = meta.unwrap_meta().to_machine_usize(self.ecx)?;
352352
// We do not check that `len * elem_size <= isize::MAX`:
353353
// that is only required for references, and there it falls out of the
@@ -590,7 +590,6 @@ impl<'rt, 'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> ValidityVisitor<'rt, 'mir, '
590590
| ty::Tuple(..)
591591
| ty::Array(..)
592592
| ty::Slice(..)
593-
| ty::Str
594593
| ty::Dynamic(..)
595594
| ty::Closure(..)
596595
| ty::Generator(..) => Ok(false),
@@ -813,15 +812,6 @@ impl<'rt, 'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> ValueVisitor<'mir, 'tcx, M>
813812
fields: impl Iterator<Item = InterpResult<'tcx, Self::V>>,
814813
) -> InterpResult<'tcx> {
815814
match op.layout.ty.kind() {
816-
ty::Str => {
817-
let mplace = op.assert_mem_place(); // strings are unsized and hence never immediate
818-
let len = mplace.len(self.ecx)?;
819-
try_validation!(
820-
self.ecx.read_bytes_ptr_strip_provenance(mplace.ptr, Size::from_bytes(len)),
821-
self.path,
822-
InvalidUninitBytes(..) => { "uninitialized data in `str`" },
823-
);
824-
}
825815
ty::Array(tys, ..) | ty::Slice(tys)
826816
// This optimization applies for types that can hold arbitrary bytes (such as
827817
// integer and floating point types) or for structs or tuples with no fields.

compiler/rustc_const_eval/src/util/type_name.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ impl<'tcx> Printer<'tcx> for AbsolutePathPrinter<'tcx> {
3939
| ty::Int(_)
4040
| ty::Uint(_)
4141
| ty::Float(_)
42-
| ty::Str
4342
| ty::Array(_, _)
4443
| ty::Slice(_)
4544
| ty::RawPtr(_)

compiler/rustc_hir/src/lang_items.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,7 @@ language_item_table! {
328328
RangeTo, sym::RangeTo, range_to_struct, Target::Struct, GenericRequirement::None;
329329

330330
String, sym::String, string, Target::Struct, GenericRequirement::None;
331+
Str, sym::str, str_type, Target::Struct, GenericRequirement::Exact(0);
331332
}
332333

333334
pub enum GenericRequirement {

compiler/rustc_hir_analysis/src/coherence/inherent_impls.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,6 @@ impl<'tcx> InherentCollect<'tcx> {
213213
| ty::Int(_)
214214
| ty::Uint(_)
215215
| ty::Float(_)
216-
| ty::Str
217216
| ty::Array(..)
218217
| ty::Slice(_)
219218
| ty::RawPtr(_)

compiler/rustc_hir_analysis/src/coherence/orphan.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,6 @@ fn do_orphan_check_impl<'tcx>(
219219
| ty::Int(..)
220220
| ty::Uint(..)
221221
| ty::Float(..)
222-
| ty::Str
223222
| ty::Array(..)
224223
| ty::Slice(..)
225224
| ty::RawPtr(..)

compiler/rustc_hir_analysis/src/variance/constraints.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,6 @@ impl<'a, 'tcx> ConstraintContext<'a, 'tcx> {
214214
| ty::Int(_)
215215
| ty::Uint(_)
216216
| ty::Float(_)
217-
| ty::Str
218217
| ty::Never
219218
| ty::Foreign(..) => {
220219
// leaf type -- noop

compiler/rustc_hir_typeck/src/cast.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
101101
}
102102

103103
Ok(match *t.kind() {
104-
ty::Slice(_) | ty::Str => Some(PointerKind::Length),
104+
ty::Slice(_) => Some(PointerKind::Length),
105105
ty::Dynamic(ref tty, _, ty::Dyn) => Some(PointerKind::VTable(tty.principal_def_id())),
106106
ty::Adt(def, substs) if def.is_struct() => match def.non_enum_variant().fields.last() {
107107
None => Some(PointerKind::Thin),
@@ -1101,7 +1101,7 @@ impl<'a, 'tcx> CastCheck<'tcx> {
11011101
let derefed = fcx
11021102
.autoderef(self.expr_span, self.expr_ty)
11031103
.silence_errors()
1104-
.find(|t| matches!(t.0.kind(), ty::Str | ty::Slice(..)));
1104+
.find(|t| matches!(t.0.kind(), ty::Slice(..)) || t.0.is_str());
11051105

11061106
if let Some((deref_ty, _)) = derefed {
11071107
// Give a note about what the expr derefs to.

compiler/rustc_hir_typeck/src/demand.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1224,7 +1224,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
12241224

12251225
match (&expr.kind, expected.kind(), checked_ty.kind()) {
12261226
(_, &ty::Ref(_, exp, _), &ty::Ref(_, check, _)) => match (exp.kind(), check.kind()) {
1227-
(&ty::Str, &ty::Array(arr, _) | &ty::Slice(arr)) if arr == self.tcx.types.u8 => {
1227+
(&ty::Adt(def, _), &ty::Array(arr, _) | &ty::Slice(arr)) if def.is_str() && arr == self.tcx.types.u8 => {
12281228
if let hir::ExprKind::Lit(_) = expr.kind
12291229
&& let Ok(src) = sm.span_to_snippet(sp)
12301230
&& replace_prefix(&src, "b\"", "\"").is_some()
@@ -1240,7 +1240,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
12401240
));
12411241
}
12421242
}
1243-
(&ty::Array(arr, _) | &ty::Slice(arr), &ty::Str) if arr == self.tcx.types.u8 => {
1243+
(&ty::Array(arr, _) | &ty::Slice(arr), &ty::Adt(def, _)) if def.is_str() && arr == self.tcx.types.u8 => {
12441244
if let hir::ExprKind::Lit(_) = expr.kind
12451245
&& let Ok(src) = sm.span_to_snippet(sp)
12461246
&& replace_prefix(&src, "\"", "b\"").is_some()

compiler/rustc_hir_typeck/src/expectation.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,8 @@ impl<'a, 'tcx> Expectation<'tcx> {
7474
/// for examples of where this comes up,.
7575
pub(super) fn rvalue_hint(fcx: &FnCtxt<'a, 'tcx>, ty: Ty<'tcx>) -> Expectation<'tcx> {
7676
match fcx.tcx.struct_tail_without_normalization(ty).kind() {
77-
ty::Slice(_) | ty::Str | ty::Dynamic(..) => ExpectRvalueLikeUnsized(ty),
77+
ty::Slice(_) | ty::Dynamic(..) => ExpectRvalueLikeUnsized(ty),
78+
ty::Adt(def, _) if def.is_str() => ExpectRvalueLikeUnsized(ty),
7879
_ => ExpectHasType(ty),
7980
}
8081
}

compiler/rustc_hir_typeck/src/expr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2402,7 +2402,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
24022402
ty::RawPtr(..) => {
24032403
self.suggest_first_deref_field(&mut err, expr, base, ident);
24042404
}
2405-
ty::Adt(def, _) if !def.is_enum() => {
2405+
ty::Adt(def, _) if !def.is_enum() && !def.is_str() => {
24062406
self.suggest_fields_on_recordish(&mut err, def, ident, expr.span);
24072407
}
24082408
ty::Param(param_ty) => {

compiler/rustc_hir_typeck/src/method/probe.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -689,7 +689,6 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {
689689
| ty::Int(_)
690690
| ty::Uint(_)
691691
| ty::Float(_)
692-
| ty::Str
693692
| ty::Array(..)
694693
| ty::Slice(_)
695694
| ty::RawPtr(_)

compiler/rustc_hir_typeck/src/method/suggest.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2131,7 +2131,6 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
21312131
| ty::Uint(_)
21322132
| ty::Float(_)
21332133
| ty::Adt(_, _)
2134-
| ty::Str
21352134
| ty::Alias(ty::Projection, _)
21362135
| ty::Param(_) => format!("{deref_ty}"),
21372136
// we need to test something like <&[_]>::len or <(&[u32])>::len

0 commit comments

Comments
 (0)