Please read the new rule regarding the restriction on the use of AI tools. ×

Rust question
Difference between en4 and en5, changed 59 character(s)
Hi everyone!↵

I have a question about the language Rust.↵

Suppose, I've created some struct:↵

```c++↵
struct A {↵
  x: T,↵
  y: P,↵
  ....↵
}↵
```↵

When it goes out of the scope, Drop is called, memory is cleaned by recursive calls Drop? for all fields.↵

But what if I implement trait Drop for it:↵

```c++↵
impl Drop for A {↵
   fn drop(&mut self) -> () {↵
      // nothing↵
   }↵
}↵
```↵
will the memory be also cleaned
 when i create an object of type A and it goes out of scope? Or i need to clean it in some other way? ↵

Sorry for my bad English(.

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en5 English yllo 2023-06-30 20:24:11 59
en4 English yllo 2023-06-30 20:14:36 0 (published)
en3 English yllo 2023-06-30 20:13:43 21
en2 English yllo 2023-06-30 20:11:58 12
en1 English yllo 2023-06-30 20:11:30 509 Initial revision (saved to drafts)