rust/tests/ui/dyn-star/drop.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

29 lines
510 B
Rust
Raw Normal View History

//@ run-pass
//@ check-run-results
2024-11-20 02:46:56 +00:00
#![feature(dyn_star, pointer_like_trait)]
2022-08-30 19:44:00 +00:00
#![allow(incomplete_features)]
use std::fmt::Debug;
2024-11-20 02:46:56 +00:00
use std::marker::PointerLike;
#[derive(Debug)]
2024-11-20 02:46:56 +00:00
#[repr(transparent)]
struct Foo(#[allow(dead_code)] usize);
2024-11-20 02:46:56 +00:00
// FIXME(dyn_star): Make this into a derive.
impl PointerLike for Foo {}
impl Drop for Foo {
fn drop(&mut self) {
println!("destructor called");
}
}
fn make_dyn_star(i: Foo) {
2022-09-14 23:20:03 +00:00
let _dyn_i: dyn* Debug = i;
}
fn main() {
make_dyn_star(Foo(42));
}