rust/src/doc
bors c3605f8c80 Auto merge of #95897 - AzureMarker:feature/horizon-std, r=nagisa
STD support for the Nintendo 3DS

Rustc already supports compiling for the Nintendo 3DS using the `armv6k-nintendo-3ds` target (Tier 3). Until now though, only `core` and `alloc` were supported. This PR adds standard library support for the Nintendo 3DS. A notable exclusion is `std::thread` support, which will come in a follow-up PR as it requires more complicated changes.

This has been a joint effort by `@Meziu,` `@ian-h-chamberlain,` myself, and prior work by `@rust3ds` members.

### Background

The Nintendo 3DS (Horizon OS) is a mostly-UNIX looking system, with the caveat that it does not come with a full libc implementation out of the box. On the homebrew side (I'm not under NDA), the libc interface is partially implemented by the [devkitPro](https://devkitpro.org/wiki/devkitPro_pacman) toolchain and a user library like [`libctru`](https://github.com/devkitPro/libctru). This is important because there are [some possible legal barriers](https://github.com/rust-lang/rust/pull/88529#issuecomment-919938396) to linking directly to a library that uses the underlying platform APIs, since they might be considered a trade secret or under NDA.

To get around this, the standard library impl for the 3DS does not directly depend on any platform-level APIs. Instead, it expects standard libc functions to be linked in. The implementation of these libc functions is left to the user. Some functions are provided by the devkitPro toolchain, but in our testing, we used the following to fill in the other functions:
- [`libctru`] - provides more basic APIs, such as `nanosleep`. Linked in by way of [`ctru-sys`](https://github.com/Meziu/ctru-rs/tree/master/ctru-sys).
- [`pthread-3ds`](https://github.com/Meziu/pthread-3ds) - provides pthread APIs for `std::thread`. Implemented using [`libctru`].
- [`linker-fix-3ds`](https://github.com/Meziu/rust-linker-fix-3ds) - fulfills some other missing libc APIs. Implemented using [`libctru`].

For more details, see the `src/doc/rustc/src/platform-support/armv6k-nintendo-3ds.md` file added in this PR.

### Notes
We've already upstreamed changes to the [`libc`] crate to support this PR, as well as the upcoming threading PR. These changes have all been released as of 0.2.121, so we bump the crate version in this PR.
Edit: After some rebases, the version bump has already been merged so it doesn't appear in this PR.

A lot of the changes in this PR are straightforward, and follow in the footsteps of the ESP-IDF target: https://github.com/rust-lang/rust/pull/87666.

The 3DS does not support user space process spawning, so these APIs are unimplemented (similar to ESP-IDF).

[`libctru`]: https://github.com/devkitPro/libctru
[`libc`]: https://github.com/rust-lang/libc
2022-06-15 14:21:28 +00:00
..
book@396fdb69de Update books 2022-06-08 11:19:53 -07:00
edition-guide@c55611dd6c Update books 2022-03-01 09:10:58 -08:00
embedded-book@cbb494f96d Update books 2022-06-08 11:19:53 -07:00
man Drop time dependency from bootstrap 2022-02-07 09:11:08 -05:00
nomicon@3a43983b76 Update books 2022-06-08 11:19:53 -07:00
reference@683bfe5cd6 Update books 2022-06-08 11:19:53 -07:00
rust-by-example@dbb7e5e234 Update books 2022-06-08 11:19:53 -07:00
rustc Add platform-support page for armv6k-nintendo-3ds 2022-06-13 20:45:22 -07:00
rustc-dev-guide@6e4d6435db Update books 2022-06-08 11:19:53 -07:00
rustdoc Update the-doc-attribute.md 2022-06-11 03:10:29 +05:00
unstable-book Add user documentation for -Zvirtual-function-elimination 2022-06-14 14:50:53 +02:00
complement-design-faq.md Remove the FAQs in favor of the website 2015-12-23 14:03:45 -08:00
complement-lang-faq.md Remove the FAQs in favor of the website 2015-12-23 14:03:45 -08:00
complement-project-faq.md Remove the FAQs in favor of the website 2015-12-23 14:03:45 -08:00
favicon.inc doc: no shortcut in rel="icon" 2022-01-28 13:42:48 +01:00
footer.inc rustdoc: Improve playground run buttons 2016-10-15 18:32:03 +01:00
full-toc.inc doc: add webfonts and tweak the styles accordingly 2014-04-19 21:25:35 +09:00
grammar.md Remove legacy grammar 2019-09-30 07:46:10 +02:00
guide-crates.md Grammar tweak to old guide stub documents. 2015-01-16 22:25:22 -05:00
guide-error-handling.md Convert old doc links to current edition 2019-02-13 14:39:25 +00:00
guide-ffi.md Grammar tweak to old guide stub documents. 2015-01-16 22:25:22 -05:00
guide-macros.md Grammar tweak to old guide stub documents. 2015-01-16 22:25:22 -05:00
guide-ownership.md Convert old doc links to current edition 2019-02-13 14:39:25 +00:00
guide-plugins.md Add top level sections to the Unstable Book. 2017-04-18 21:26:09 -04:00
guide-pointers.md Convert old doc links to current edition 2019-02-13 14:39:25 +00:00
guide-strings.md Grammar tweak to old guide stub documents. 2015-01-16 22:25:22 -05:00
guide-tasks.md Fix broken link in old rust guide 2015-03-04 23:18:24 +00:00
guide-testing.md Convert old doc links to current edition 2019-02-13 14:39:25 +00:00
guide-unsafe.md Grammar tweak to old guide stub documents. 2015-01-16 22:25:22 -05:00
guide.md Grammar tweak to old guide stub documents. 2015-01-16 22:25:22 -05:00
index.md Add link to rust website 2020-11-04 11:06:42 +01:00
intro.md Remove the 30 minute intro 2015-04-18 17:55:31 -04:00
not_found.md Update location from a relative path to absolute 2022-01-07 01:29:20 -08:00
redirect.inc doc: no shortcut in rel="icon" 2022-01-28 13:42:48 +01:00
reference.md Update reference.md 2021-07-10 19:51:36 +02:00
robots.txt Block version-specific docs from search engines 2020-03-14 02:29:35 +00:00
rust.css override rustdoc.css {webkit,moz} box-sizing:unset 2021-06-29 13:05:00 +08:00
rust.md Avoid linking to a moved page in rust.html 2017-03-29 15:38:47 +02:00
rustdoc.md Move rustdoc.md into the book 2015-01-21 14:59:25 -05:00
tutorial.md Update tutorial.md 2018-05-17 12:25:24 -07:00
version_info.html.template Add alt tags for logos 2016-01-20 11:53:20 -05:00