rust/src
bors 7b57f122b9 Auto merge of #3533 - Luv-Ray:file-descriptors-to-refcount-references, r=RalfJung
Make file descriptors into refcount references

fixes #3525

Remove `fn dup` in `trait FileDescription`, define `struct FileDescriptor(Rc<RefCell<dyn FileDescription>>)`, and use `BTreeMap<i32, FileDescriptor>` in `FdTable`.

---

There are some refactors similar to the following form:
```rust
{  // origin:
    if let Some(file_descriptor) = this.machine.fds.get_mut(fd) {
        // write file_descriptor
        this.try_unwrap_io_result(result)
    } else {
        this.fd_not_found()
    }
}
{  // now:
    let Some(mut file_descriptor) = this.machine.fds.get_mut(fd) else {
        return this.fd_not_found();
    };
    // write file_descriptor
    drop(file_descriptor);
    this.try_unwrap_io_result(result)
}
```
The origin form can't compile because as using `RefCell` to get interior mutability, `fn get_mut` return `Option<std::cell::RefMut<'_, dyn FileDescription>>` instead of `Option<&mut dyn FileDescription>` now, and the `deref_mut` on `file_descriptor: RefMut` will cause borrow `this` as mutable more than once at a time.
So this form of refactors and manual drops are are implemented to avoid borrowing `this` at the same time.
2024-05-04 09:52:39 +00:00
..
bootstrap Rollup merge of #124613 - GuillaumeGomez:fmt-run-make, r=onur-ozkan 2024-05-03 15:26:11 +02:00
ci Output run_type from the matrix calculation job 2024-04-29 21:33:17 +02:00
doc Auto merge of #124404 - jonathanpallant:arm-target-changes-new, r=chrisnc 2024-05-01 22:22:51 +00:00
etc introduce x vendor 2024-04-22 17:07:49 +03:00
librustdoc Rollup merge of #124475 - GKFX:more-dependency-pruning, r=oli-obk 2024-04-29 18:03:23 +01:00
llvm-project@5399a24c66 Update LLVM to 1deeee3 2024-04-17 06:28:22 +08:00
rustdoc-json-types Fix some typos in comments 2024-04-25 10:47:24 +08:00
tools Auto merge of #3533 - Luv-Ray:file-descriptors-to-refcount-references, r=RalfJung 2024-05-04 09:52:39 +00:00
README.md Remove stale reference to the test suite location 2023-01-13 11:49:06 +00:00
stage0.json Bump stage0 to next beta 2024-05-01 21:01:51 -04:00
version Bump version to 1.80 2024-04-27 19:03:50 -04:00

This directory contains some source code for the Rust project, including:

  • The bootstrapping build system
  • Various submodules for tools, like cargo, tidy, etc.

For more information on how various parts of the compiler work, see the rustc dev guide.