Skip to content
This repository has been archived by the owner on May 23, 2024. It is now read-only.

ices/99575.rs: fixed with errors #1392

Merged
merged 1 commit into from
Aug 20, 2022
Merged

ices/99575.rs: fixed with errors #1392

merged 1 commit into from
Aug 20, 2022

Conversation

github-actions[bot]
Copy link
Contributor

Issue: rust-lang/rust#99575

use std::pin::Pin;

fn main() {
    let a = Enum::A(Pin::new(Box::new(A())));
    let b = Enum::B(Pin::new(Box::new(B())));
    println!("{:?} {:?}", a, b);
}

#[derive(Debug)]
enum Enum {
    A(Pin<Box<A>>),
    B(Pin<Box<B>>),
}

#[derive(Debug)]
struct A();

impl Drop for Pin<Box<A>> {
    fn drop(&mut self) {}
}

#[derive(Debug)]
struct B();

// UNCOMMENT TO FIX COMPILER ERROR
// impl Drop for Pin<Box<B>> {
//     fn drop(&mut self) {}
// }
=== stdout ===
=== stderr ===
error[E0120]: the `Drop` trait may only be implemented for local structs, enums, and unions
  --> /home/runner/work/glacier/glacier/ices/99575.rs:18:15
   |
18 | impl Drop for Pin<Box<A>> {
   |               ^^^^^^^^^^^ must be a struct, enum, or union in the current crate

error: aborting due to previous error

For more information about this error, try `rustc --explain E0120`.
==============

=== stdout ===
=== stderr ===
error[E0120]: the `Drop` trait may only be implemented for local structs, enums, and unions
  --> /home/runner/work/glacier/glacier/ices/99575.rs:18:15
   |
18 | impl Drop for Pin<Box<A>> {
   |               ^^^^^^^^^^^ must be a struct, enum, or union in the current crate

error: aborting due to previous error

For more information about this error, try `rustc --explain E0120`.
==============
@JohnTitor JohnTitor merged commit 6f8e9c3 into master Aug 20, 2022
@JohnTitor JohnTitor deleted the autofix/ices/99575.rs branch August 20, 2022 08:23
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants