Skip to content

Commit d3ed348

Browse files
committed
Auto merge of #56165 - RalfJung:drop-glue-type, r=eddyb,nikomatsakis
drop glue takes in mutable references, it should reflect that in its type When drop glue begins, it should retag, like all functions taking references do. But to do that, it needs to take the reference at a proper type: `&mut T`, not `*mut T`. Failing to retag can mean that the memory the reference points to remains frozen, and `EscapeToRaw` on a frozen location is a NOP, meaning later mutations cause a Stacked Borrows violation. Cc @nikomatsakis @gankro because Stacked Borrows Cc @eddyb for the changes to miri argument passing (the intention is to allow passing `*mut [u8]` when `&mut [u8]` is expected and vice versa)
2 parents aef4dbf + d9de72f commit d3ed348

13 files changed

+80
-52
lines changed

src/libcore/ptr.rs

+12-2
Original file line numberDiff line numberDiff line change
@@ -189,12 +189,22 @@ pub use intrinsics::write_bytes;
189189
/// i.e., you do not usually have to worry about such issues unless you call `drop_in_place`
190190
/// manually.
191191
#[stable(feature = "drop_in_place", since = "1.8.0")]
192+
#[inline(always)]
193+
pub unsafe fn drop_in_place<T: ?Sized>(to_drop: *mut T) {
194+
real_drop_in_place(&mut *to_drop)
195+
}
196+
197+
// The real `drop_in_place` -- the one that gets called implicitly when variables go
198+
// out of scope -- should have a safe reference and not a raw pointer as argument
199+
// type. When we drop a local variable, we access it with a pointer that behaves
200+
// like a safe reference; transmuting that to a raw pointer does not mean we can
201+
// actually access it with raw pointers.
192202
#[lang = "drop_in_place"]
193203
#[allow(unconditional_recursion)]
194-
pub unsafe fn drop_in_place<T: ?Sized>(to_drop: *mut T) {
204+
unsafe fn real_drop_in_place<T: ?Sized>(to_drop: &mut T) {
195205
// Code here does not matter - this is replaced by the
196206
// real drop glue by the compiler.
197-
drop_in_place(to_drop);
207+
real_drop_in_place(to_drop)
198208
}
199209

200210
/// Creates a null raw pointer.

src/librustc_mir/interpret/terminator.rs

+24-12
Original file line numberDiff line numberDiff line change
@@ -182,20 +182,28 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M>
182182
}
183183

184184
fn check_argument_compat(
185+
rust_abi: bool,
185186
caller: TyLayout<'tcx>,
186187
callee: TyLayout<'tcx>,
187188
) -> bool {
188189
if caller.ty == callee.ty {
189190
// No question
190191
return true;
191192
}
193+
if !rust_abi {
194+
// Don't risk anything
195+
return false;
196+
}
192197
// Compare layout
193198
match (&caller.abi, &callee.abi) {
199+
// Different valid ranges are okay (once we enforce validity,
200+
// that will take care to make it UB to leave the range, just
201+
// like for transmute).
194202
(layout::Abi::Scalar(ref caller), layout::Abi::Scalar(ref callee)) =>
195-
// Different valid ranges are okay (once we enforce validity,
196-
// that will take care to make it UB to leave the range, just
197-
// like for transmute).
198203
caller.value == callee.value,
204+
(layout::Abi::ScalarPair(ref caller1, ref caller2),
205+
layout::Abi::ScalarPair(ref callee1, ref callee2)) =>
206+
caller1.value == callee1.value && caller2.value == callee2.value,
199207
// Be conservative
200208
_ => false
201209
}
@@ -204,22 +212,22 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M>
204212
/// Pass a single argument, checking the types for compatibility.
205213
fn pass_argument(
206214
&mut self,
207-
skip_zst: bool,
215+
rust_abi: bool,
208216
caller_arg: &mut impl Iterator<Item=OpTy<'tcx, M::PointerTag>>,
209217
callee_arg: PlaceTy<'tcx, M::PointerTag>,
210218
) -> EvalResult<'tcx> {
211-
if skip_zst && callee_arg.layout.is_zst() {
219+
if rust_abi && callee_arg.layout.is_zst() {
212220
// Nothing to do.
213221
trace!("Skipping callee ZST");
214222
return Ok(());
215223
}
216224
let caller_arg = caller_arg.next()
217225
.ok_or_else(|| EvalErrorKind::FunctionArgCountMismatch)?;
218-
if skip_zst {
226+
if rust_abi {
219227
debug_assert!(!caller_arg.layout.is_zst(), "ZSTs must have been already filtered out");
220228
}
221229
// Now, check
222-
if !Self::check_argument_compat(caller_arg.layout, callee_arg.layout) {
230+
if !Self::check_argument_compat(rust_abi, caller_arg.layout, callee_arg.layout) {
223231
return err!(FunctionArgMismatch(caller_arg.layout.ty, callee_arg.layout.ty));
224232
}
225233
// We allow some transmutes here
@@ -319,7 +327,7 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M>
319327
// Figure out how to pass which arguments.
320328
// We have two iterators: Where the arguments come from,
321329
// and where they go to.
322-
let skip_zst = match caller_abi {
330+
let rust_abi = match caller_abi {
323331
Abi::Rust | Abi::RustCall => true,
324332
_ => false
325333
};
@@ -344,7 +352,7 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M>
344352
};
345353
// Skip ZSTs
346354
let mut caller_iter = caller_args.iter()
347-
.filter(|op| !skip_zst || !op.layout.is_zst())
355+
.filter(|op| !rust_abi || !op.layout.is_zst())
348356
.map(|op| *op);
349357

350358
// Now we have to spread them out across the callee's locals,
@@ -359,11 +367,11 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M>
359367
// Must be a tuple
360368
for i in 0..dest.layout.fields.count() {
361369
let dest = self.place_field(dest, i as u64)?;
362-
self.pass_argument(skip_zst, &mut caller_iter, dest)?;
370+
self.pass_argument(rust_abi, &mut caller_iter, dest)?;
363371
}
364372
} else {
365373
// Normal argument
366-
self.pass_argument(skip_zst, &mut caller_iter, dest)?;
374+
self.pass_argument(rust_abi, &mut caller_iter, dest)?;
367375
}
368376
}
369377
// Now we should have no more caller args
@@ -374,7 +382,11 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M>
374382
// Don't forget to check the return type!
375383
if let Some(caller_ret) = dest {
376384
let callee_ret = self.eval_place(&mir::Place::Local(mir::RETURN_PLACE))?;
377-
if !Self::check_argument_compat(caller_ret.layout, callee_ret.layout) {
385+
if !Self::check_argument_compat(
386+
rust_abi,
387+
caller_ret.layout,
388+
callee_ret.layout,
389+
) {
378390
return err!(FunctionRetMismatch(
379391
caller_ret.layout.ty, callee_ret.layout.ty
380392
));

src/librustc_mir/shim.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -226,8 +226,13 @@ fn build_drop_shim<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
226226
// The first argument (index 0), but add 1 for the return value.
227227
let dropee_ptr = Place::Local(Local::new(1+0));
228228
if tcx.sess.opts.debugging_opts.mir_emit_retag {
229-
// We use raw ptr operations, better prepare the alias tracking for that
229+
// Function arguments should be retagged
230230
mir.basic_blocks_mut()[START_BLOCK].statements.insert(0, Statement {
231+
source_info,
232+
kind: StatementKind::Retag { fn_entry: true, place: dropee_ptr.clone() },
233+
});
234+
// We use raw ptr operations, better prepare the alias tracking for that
235+
mir.basic_blocks_mut()[START_BLOCK].statements.insert(1, Statement {
231236
source_info,
232237
kind: StatementKind::EscapeToRaw(Operand::Copy(dropee_ptr.clone())),
233238
})

src/test/codegen-units/item-collection/drop_in_place_intrinsic.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
#![feature(start)]
1616

17-
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<drop_in_place_intrinsic::StructWithDtor[0]> @@ drop_in_place_intrinsic-cgu.0[Internal]
17+
//~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0]<drop_in_place_intrinsic::StructWithDtor[0]> @@ drop_in_place_intrinsic-cgu.0[Internal]
1818
struct StructWithDtor(u32);
1919

2020
impl Drop for StructWithDtor {
@@ -26,7 +26,7 @@ impl Drop for StructWithDtor {
2626
#[start]
2727
fn start(_: isize, _: *const *const u8) -> isize {
2828

29-
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<[drop_in_place_intrinsic::StructWithDtor[0]; 2]> @@ drop_in_place_intrinsic-cgu.0[Internal]
29+
//~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0]<[drop_in_place_intrinsic::StructWithDtor[0]; 2]> @@ drop_in_place_intrinsic-cgu.0[Internal]
3030
let x = [StructWithDtor(0), StructWithDtor(1)];
3131

3232
drop_slice_in_place(&x);
@@ -41,6 +41,7 @@ fn drop_slice_in_place(x: &[StructWithDtor]) {
4141
// not have drop-glue for the unsized [StructWithDtor]. This has to be
4242
// generated though when the drop_in_place() intrinsic is used.
4343
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<[drop_in_place_intrinsic::StructWithDtor[0]]> @@ drop_in_place_intrinsic-cgu.0[Internal]
44+
//~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0]<[drop_in_place_intrinsic::StructWithDtor[0]]> @@ drop_in_place_intrinsic-cgu.0[Internal]
4445
::std::ptr::drop_in_place(x as *const _ as *mut [StructWithDtor]);
4546
}
4647
}

src/test/codegen-units/item-collection/generic-drop-glue.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ enum EnumNoDrop<T1, T2> {
4747
struct NonGenericNoDrop(i32);
4848

4949
struct NonGenericWithDrop(i32);
50-
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<generic_drop_glue::NonGenericWithDrop[0]> @@ generic_drop_glue-cgu.0[Internal]
50+
//~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0]<generic_drop_glue::NonGenericWithDrop[0]> @@ generic_drop_glue-cgu.0[Internal]
5151

5252
impl Drop for NonGenericWithDrop {
5353
//~ MONO_ITEM fn generic_drop_glue::{{impl}}[2]::drop[0]
@@ -57,11 +57,11 @@ impl Drop for NonGenericWithDrop {
5757
//~ MONO_ITEM fn generic_drop_glue::start[0]
5858
#[start]
5959
fn start(_: isize, _: *const *const u8) -> isize {
60-
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<generic_drop_glue::StructWithDrop[0]<i8, char>> @@ generic_drop_glue-cgu.0[Internal]
60+
//~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0]<generic_drop_glue::StructWithDrop[0]<i8, char>> @@ generic_drop_glue-cgu.0[Internal]
6161
//~ MONO_ITEM fn generic_drop_glue::{{impl}}[0]::drop[0]<i8, char>
6262
let _ = StructWithDrop { x: 0i8, y: 'a' }.x;
6363

64-
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<generic_drop_glue::StructWithDrop[0]<&str, generic_drop_glue::NonGenericNoDrop[0]>> @@ generic_drop_glue-cgu.0[Internal]
64+
//~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0]<generic_drop_glue::StructWithDrop[0]<&str, generic_drop_glue::NonGenericNoDrop[0]>> @@ generic_drop_glue-cgu.0[Internal]
6565
//~ MONO_ITEM fn generic_drop_glue::{{impl}}[0]::drop[0]<&str, generic_drop_glue::NonGenericNoDrop[0]>
6666
let _ = StructWithDrop { x: "&str", y: NonGenericNoDrop(0) }.y;
6767

@@ -70,17 +70,17 @@ fn start(_: isize, _: *const *const u8) -> isize {
7070

7171
// This is supposed to generate drop-glue because it contains a field that
7272
// needs to be dropped.
73-
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<generic_drop_glue::StructNoDrop[0]<generic_drop_glue::NonGenericWithDrop[0], f64>> @@ generic_drop_glue-cgu.0[Internal]
73+
//~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0]<generic_drop_glue::StructNoDrop[0]<generic_drop_glue::NonGenericWithDrop[0], f64>> @@ generic_drop_glue-cgu.0[Internal]
7474
let _ = StructNoDrop { x: NonGenericWithDrop(0), y: 0f64 }.y;
7575

76-
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<generic_drop_glue::EnumWithDrop[0]<i32, i64>> @@ generic_drop_glue-cgu.0[Internal]
76+
//~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0]<generic_drop_glue::EnumWithDrop[0]<i32, i64>> @@ generic_drop_glue-cgu.0[Internal]
7777
//~ MONO_ITEM fn generic_drop_glue::{{impl}}[1]::drop[0]<i32, i64>
7878
let _ = match EnumWithDrop::A::<i32, i64>(0) {
7979
EnumWithDrop::A(x) => x,
8080
EnumWithDrop::B(x) => x as i32
8181
};
8282

83-
//~MONO_ITEM fn core::ptr[0]::drop_in_place[0]<generic_drop_glue::EnumWithDrop[0]<f64, f32>> @@ generic_drop_glue-cgu.0[Internal]
83+
//~MONO_ITEM fn core::ptr[0]::real_drop_in_place[0]<generic_drop_glue::EnumWithDrop[0]<f64, f32>> @@ generic_drop_glue-cgu.0[Internal]
8484
//~ MONO_ITEM fn generic_drop_glue::{{impl}}[1]::drop[0]<f64, f32>
8585
let _ = match EnumWithDrop::B::<f64, f32>(1.0) {
8686
EnumWithDrop::A(x) => x,

src/test/codegen-units/item-collection/instantiation-through-vtable.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,13 @@ impl<T> Trait for Struct<T> {
3434
fn start(_: isize, _: *const *const u8) -> isize {
3535
let s1 = Struct { _a: 0u32 };
3636

37-
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<instantiation_through_vtable::Struct[0]<u32>> @@ instantiation_through_vtable-cgu.0[Internal]
37+
//~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0]<instantiation_through_vtable::Struct[0]<u32>> @@ instantiation_through_vtable-cgu.0[Internal]
3838
//~ MONO_ITEM fn instantiation_through_vtable::{{impl}}[0]::foo[0]<u32>
3939
//~ MONO_ITEM fn instantiation_through_vtable::{{impl}}[0]::bar[0]<u32>
4040
let _ = &s1 as &Trait;
4141

4242
let s1 = Struct { _a: 0u64 };
43-
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<instantiation_through_vtable::Struct[0]<u64>> @@ instantiation_through_vtable-cgu.0[Internal]
43+
//~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0]<instantiation_through_vtable::Struct[0]<u64>> @@ instantiation_through_vtable-cgu.0[Internal]
4444
//~ MONO_ITEM fn instantiation_through_vtable::{{impl}}[0]::foo[0]<u64>
4545
//~ MONO_ITEM fn instantiation_through_vtable::{{impl}}[0]::bar[0]<u64>
4646
let _ = &s1 as &Trait;

src/test/codegen-units/item-collection/non-generic-drop-glue.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
#![deny(dead_code)]
1616
#![feature(start)]
1717

18-
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<non_generic_drop_glue::StructWithDrop[0]> @@ non_generic_drop_glue-cgu.0[Internal]
18+
//~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0]<non_generic_drop_glue::StructWithDrop[0]> @@ non_generic_drop_glue-cgu.0[Internal]
1919
struct StructWithDrop {
2020
x: i32
2121
}
@@ -29,7 +29,7 @@ struct StructNoDrop {
2929
x: i32
3030
}
3131

32-
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<non_generic_drop_glue::EnumWithDrop[0]> @@ non_generic_drop_glue-cgu.0[Internal]
32+
//~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0]<non_generic_drop_glue::EnumWithDrop[0]> @@ non_generic_drop_glue-cgu.0[Internal]
3333
enum EnumWithDrop {
3434
A(i32)
3535
}

src/test/codegen-units/item-collection/transitive-drop-glue.rs

+9-9
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@
1515
#![deny(dead_code)]
1616
#![feature(start)]
1717

18-
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<transitive_drop_glue::Root[0]> @@ transitive_drop_glue-cgu.0[Internal]
18+
//~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0]<transitive_drop_glue::Root[0]> @@ transitive_drop_glue-cgu.0[Internal]
1919
struct Root(Intermediate);
20-
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<transitive_drop_glue::Intermediate[0]> @@ transitive_drop_glue-cgu.0[Internal]
20+
//~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0]<transitive_drop_glue::Intermediate[0]> @@ transitive_drop_glue-cgu.0[Internal]
2121
struct Intermediate(Leaf);
22-
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<transitive_drop_glue::Leaf[0]> @@ transitive_drop_glue-cgu.0[Internal]
22+
//~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0]<transitive_drop_glue::Leaf[0]> @@ transitive_drop_glue-cgu.0[Internal]
2323
struct Leaf;
2424

2525
impl Drop for Leaf {
@@ -40,15 +40,15 @@ impl<T> Drop for LeafGen<T> {
4040
fn start(_: isize, _: *const *const u8) -> isize {
4141
let _ = Root(Intermediate(Leaf));
4242

43-
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<transitive_drop_glue::RootGen[0]<u32>> @@ transitive_drop_glue-cgu.0[Internal]
44-
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<transitive_drop_glue::IntermediateGen[0]<u32>> @@ transitive_drop_glue-cgu.0[Internal]
45-
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<transitive_drop_glue::LeafGen[0]<u32>> @@ transitive_drop_glue-cgu.0[Internal]
43+
//~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0]<transitive_drop_glue::RootGen[0]<u32>> @@ transitive_drop_glue-cgu.0[Internal]
44+
//~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0]<transitive_drop_glue::IntermediateGen[0]<u32>> @@ transitive_drop_glue-cgu.0[Internal]
45+
//~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0]<transitive_drop_glue::LeafGen[0]<u32>> @@ transitive_drop_glue-cgu.0[Internal]
4646
//~ MONO_ITEM fn transitive_drop_glue::{{impl}}[1]::drop[0]<u32>
4747
let _ = RootGen(IntermediateGen(LeafGen(0u32)));
4848

49-
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<transitive_drop_glue::RootGen[0]<i16>> @@ transitive_drop_glue-cgu.0[Internal]
50-
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<transitive_drop_glue::IntermediateGen[0]<i16>> @@ transitive_drop_glue-cgu.0[Internal]
51-
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<transitive_drop_glue::LeafGen[0]<i16>> @@ transitive_drop_glue-cgu.0[Internal]
49+
//~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0]<transitive_drop_glue::RootGen[0]<i16>> @@ transitive_drop_glue-cgu.0[Internal]
50+
//~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0]<transitive_drop_glue::IntermediateGen[0]<i16>> @@ transitive_drop_glue-cgu.0[Internal]
51+
//~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0]<transitive_drop_glue::LeafGen[0]<i16>> @@ transitive_drop_glue-cgu.0[Internal]
5252
//~ MONO_ITEM fn transitive_drop_glue::{{impl}}[1]::drop[0]<i16>
5353
let _ = RootGen(IntermediateGen(LeafGen(0i16)));
5454

src/test/codegen-units/item-collection/tuple-drop-glue.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
#![deny(dead_code)]
1616
#![feature(start)]
1717

18-
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<tuple_drop_glue::Dropped[0]> @@ tuple_drop_glue-cgu.0[Internal]
18+
//~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0]<tuple_drop_glue::Dropped[0]> @@ tuple_drop_glue-cgu.0[Internal]
1919
struct Dropped;
2020

2121
impl Drop for Dropped {
@@ -26,11 +26,11 @@ impl Drop for Dropped {
2626
//~ MONO_ITEM fn tuple_drop_glue::start[0]
2727
#[start]
2828
fn start(_: isize, _: *const *const u8) -> isize {
29-
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<(u32, tuple_drop_glue::Dropped[0])> @@ tuple_drop_glue-cgu.0[Internal]
29+
//~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0]<(u32, tuple_drop_glue::Dropped[0])> @@ tuple_drop_glue-cgu.0[Internal]
3030
let x = (0u32, Dropped);
3131

32-
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<(i16, (tuple_drop_glue::Dropped[0], bool))> @@ tuple_drop_glue-cgu.0[Internal]
33-
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<(tuple_drop_glue::Dropped[0], bool)> @@ tuple_drop_glue-cgu.0[Internal]
32+
//~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0]<(i16, (tuple_drop_glue::Dropped[0], bool))> @@ tuple_drop_glue-cgu.0[Internal]
33+
//~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0]<(tuple_drop_glue::Dropped[0], bool)> @@ tuple_drop_glue-cgu.0[Internal]
3434
let x = (0i16, (Dropped, true));
3535

3636
0

src/test/codegen-units/item-collection/unsizing.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,13 @@ impl<T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<Wrapper<U>> for Wrapper<T>
5959
fn start(_: isize, _: *const *const u8) -> isize {
6060
// simple case
6161
let bool_sized = &true;
62-
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<bool> @@ unsizing-cgu.0[Internal]
62+
//~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0]<bool> @@ unsizing-cgu.0[Internal]
6363
//~ MONO_ITEM fn unsizing::{{impl}}[0]::foo[0]
6464
let _bool_unsized = bool_sized as &Trait;
6565

6666
let char_sized = &'a';
6767

68-
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<char> @@ unsizing-cgu.0[Internal]
68+
//~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0]<char> @@ unsizing-cgu.0[Internal]
6969
//~ MONO_ITEM fn unsizing::{{impl}}[1]::foo[0]
7070
let _char_unsized = char_sized as &Trait;
7171

@@ -75,13 +75,13 @@ fn start(_: isize, _: *const *const u8) -> isize {
7575
_b: 2,
7676
_c: 3.0f64
7777
};
78-
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<f64> @@ unsizing-cgu.0[Internal]
78+
//~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0]<f64> @@ unsizing-cgu.0[Internal]
7979
//~ MONO_ITEM fn unsizing::{{impl}}[2]::foo[0]
8080
let _struct_unsized = struct_sized as &Struct<Trait>;
8181

8282
// custom coercion
8383
let wrapper_sized = Wrapper(&0u32);
84-
//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<u32> @@ unsizing-cgu.0[Internal]
84+
//~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0]<u32> @@ unsizing-cgu.0[Internal]
8585
//~ MONO_ITEM fn unsizing::{{impl}}[3]::foo[0]
8686
let _wrapper_sized = wrapper_sized as Wrapper<Trait>;
8787

0 commit comments

Comments
 (0)