From b985ab977f9cc2988c72e7db2f52ff89549516d9 Mon Sep 17 00:00:00 2001 From: Tshepang Mbambo Date: Fri, 6 Oct 2023 19:42:33 +0200 Subject: [PATCH 1/8] add missing option to config.example.toml --- config.example.toml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/config.example.toml b/config.example.toml index 3435a60d189a..7ef9a24db451 100644 --- a/config.example.toml +++ b/config.example.toml @@ -875,3 +875,6 @@ changelog-seen = 2 # Name of the AWS S3 bucket containing the document signatures file. #document-signatures-s3-bucket = "ferrocene-document-signatures" + +# Avoid "Unsigned draft" warning in Qualification docs, when they are not signed +#ignore-document-signatures = false From 14a75602e6f57b4000eae130bd110d9e62bfd51c Mon Sep 17 00:00:00 2001 From: Yuki Okushi Date: Mon, 9 Oct 2023 13:11:03 +0900 Subject: [PATCH 2/8] Say goodbye to GH Pages in favor of docs.rs Signed-off-by: Yuki Okushi --- .github/workflows/bors.yml | 20 ---------- .github/workflows/docs.yml | 37 ----------------- README.md | 3 +- ci/dox.sh | 82 -------------------------------------- src/lib.rs | 4 -- 5 files changed, 1 insertion(+), 145 deletions(-) delete mode 100644 .github/workflows/docs.yml delete mode 100644 ci/dox.sh diff --git a/.github/workflows/bors.yml b/.github/workflows/bors.yml index cc0bb667bdf2..e171f7e6789e 100644 --- a/.github/workflows/bors.yml +++ b/.github/workflows/bors.yml @@ -335,24 +335,6 @@ jobs: - name: Build with check-cfg run: LIBC_CI=1 LIBC_CHECK_CFG=1 cargo build -Z unstable-options -Z check-cfg=features,names,values,output - docs: - permissions: - actions: write # to cancel workflows (rust-lang/simpleinfra/github-actions/cancel-outdated-builds) - contents: read # to fetch code (actions/checkout) - - name: Generate documentation - runs-on: ubuntu-22.04 - needs: docker_linux_tier2 - steps: - - uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@HEAD - with: - github_token: "${{ secrets.GITHUB_TOKEN }}" - - uses: actions/checkout@v3 - - name: Setup Rust toolchain - run: sh ./ci/install-rust.sh - - name: Generate documentation - run: LIBC_CI=1 sh ci/dox.sh - # These jobs doesn't actually test anything, but they're only used to tell # bors the build completed, as there is no practical way to detect when a # workflow is successful listening to webhooks only. @@ -374,7 +356,6 @@ jobs: build_channels_linux, build_channels_macos, build_channels_windows, - docs, ] steps: @@ -396,7 +377,6 @@ jobs: build_channels_linux, build_channels_macos, build_channels_windows, - docs, ] steps: diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml deleted file mode 100644 index ff722bc96e74..000000000000 --- a/.github/workflows/docs.yml +++ /dev/null @@ -1,37 +0,0 @@ -name: Upload documentation to GitHub Pages - -on: - push: - branches: - - main - -# Sets permissions of `GITHUB_TOKEN` to allow deployment to GitHub Pages -permissions: - contents: read - pages: write - id-token: write - -jobs: - deploy: - environment: - name: github-pages - url: ${{ steps.deployment.outputs.page_url }} - runs-on: ubuntu-22.04 - steps: - - name: Checkout - uses: actions/checkout@v3 - - name: Setup Rust toolchain - run: TARGET=x86_64-unknown-linux-gnu sh ./ci/install-rust.sh - - name: Generate documentation - run: LIBC_CI=1 sh ci/dox.sh - - name: Setup Pages - uses: actions/configure-pages@v3 - - name: Fix permissions - run: rm -f ./target/doc/.lock - - name: Upload artifact - uses: actions/upload-pages-artifact@v2 - with: - path: 'target/doc' - - name: Deploy to GitHub Pages - id: deployment - uses: actions/deploy-pages@v2 diff --git a/README.md b/README.md index 43d706d0f2a6..29d2a4b6160f 100644 --- a/README.md +++ b/README.md @@ -60,7 +60,7 @@ newer Rust features are only available on newer Rust toolchains: ## Platform support -[Platform-specific documentation (HEAD)][docs.head]. +You can see the platform(target)-specific docs on [docs.rs], select a platform you want to see. See [`ci/build.sh`](https://github.com/rust-lang/libc/blob/HEAD/ci/build.sh) @@ -107,4 +107,3 @@ dual licensed as above, without any additional terms or conditions. [Documentation]: https://docs.rs/libc/badge.svg [docs.rs]: https://docs.rs/libc [License]: https://img.shields.io/crates/l/libc.svg -[docs.head]: https://rust-lang.github.io/libc/#platform-specific-documentation diff --git a/ci/dox.sh b/ci/dox.sh deleted file mode 100644 index 6dd1e4a2282c..000000000000 --- a/ci/dox.sh +++ /dev/null @@ -1,82 +0,0 @@ -#!/usr/bin/env sh - -# Builds documentation for all target triples that we have a registered URL for -# in liblibc. This scrapes the list of triples to document from `src/lib.rs` -# which has a bunch of `html_root_url` directives we pick up. - -set -ex - -TARGET_DOC_DIR="target/doc" -README="README.md" -PLATFORM_SUPPORT="platform-support.md" - -rm -rf "$TARGET_DOC_DIR" -mkdir -p "$TARGET_DOC_DIR" - -if ! rustc --version | grep -E "nightly" ; then - echo "Building the documentation requires a nightly Rust toolchain" - exit 1 -fi - -rustup component add rust-src - -# List all targets that do currently build successfully: -# shellcheck disable=SC1003 -grep '[\d|\w|-]* \\' ci/build.sh > targets -sed -i.bak 's/ \\//g' targets -grep '^[_a-zA-Z0-9-]*$' targets | sort > tmp && mv tmp targets - -# Create a markdown list of supported platforms in $PLATFORM_SUPPORT -rm $PLATFORM_SUPPORT || true - -printf '### Platform-specific documentation\n' >> $PLATFORM_SUPPORT - -while read -r target; do - echo "documenting ${target}" - - case "${target}" in - *apple*) - # FIXME: - # We can't build docs of apple targets from Linux yet. - continue - ;; - *) - ;; - esac - - rustup target add "${target}" || true - - # Enable extra configuration flags: - export RUSTDOCFLAGS="--cfg freebsd11" - - # If cargo doc fails, then try with unstable feature: - if ! cargo doc --target "${target}" \ - --no-default-features --features const-extern-fn,extra_traits ; then - cargo doc --target "${target}" \ - -Z build-std=core,alloc \ - --no-default-features --features const-extern-fn,extra_traits - fi - - mkdir -p "${TARGET_DOC_DIR}/${target}" - cp -r "target/${target}/doc" "${TARGET_DOC_DIR}/${target}" - - echo "* [${target}](${target}/doc/libc/index.html)" >> $PLATFORM_SUPPORT -done < targets - -# Replace
with the contents of $PLATFORM_SUPPORT -cp $README $TARGET_DOC_DIR -line=$(grep -n '
' $README | cut -d ":" -f 1) - -{ head -n "$((line-1))" $README; cat $PLATFORM_SUPPORT; tail -n "+$((line+1))" $README; } > $TARGET_DOC_DIR/$README - -cp $TARGET_DOC_DIR/$README $TARGET_DOC_DIR/index.md - -RUSTDOCFLAGS="--enable-index-page --index-page=${TARGET_DOC_DIR}/index.md -Zunstable-options" cargo doc - -# Tweak style -cp ci/rust.css $TARGET_DOC_DIR -sed -ie "8i " $TARGET_DOC_DIR/index.html -sed -ie "9i " $TARGET_DOC_DIR/index.html - -# Copy the licenses -cp LICENSE-* $TARGET_DOC_DIR/ diff --git a/src/lib.rs b/src/lib.rs index dc8f8312072e..1b6f0c077ab2 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,8 +1,4 @@ //! libc - Raw FFI bindings to platforms' system libraries -//! -//! [Documentation for other platforms][pd]. -//! -//! [pd]: https://rust-lang.github.io/libc/#platform-specific-documentation #![crate_name = "libc"] #![crate_type = "rlib"] #![allow( From 0a061968641e58c315dc5754420938d8d7895d3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=A2=81=E6=B5=A9?= Date: Mon, 9 Oct 2023 21:07:36 +0800 Subject: [PATCH 3/8] bugfix for teeos use Option MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 袁浩 --- src/teeos/mod.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/teeos/mod.rs b/src/teeos/mod.rs index 13d8ce1b8ffd..cffe04197657 100644 --- a/src/teeos/mod.rs +++ b/src/teeos/mod.rs @@ -8,6 +8,8 @@ // only supported on Rust > 1.59, so we can directly reexport c_void from core. pub use core::ffi::c_void; +use Option; + pub type c_schar = i8; pub type c_uchar = u8; From d4b9b0812281b108801426f607f7a9965067cc9b Mon Sep 17 00:00:00 2001 From: Tshepang Mbambo Date: Mon, 9 Oct 2023 16:50:30 +0200 Subject: [PATCH 4/8] add another reason why the config setting it useful See https://github.com/ferrocene/ferrocene/pull/32#discussion_r1349968209 --- config.example.toml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/config.example.toml b/config.example.toml index 7ef9a24db451..388ce5a2cdea 100644 --- a/config.example.toml +++ b/config.example.toml @@ -876,5 +876,8 @@ changelog-seen = 2 # Name of the AWS S3 bucket containing the document signatures file. #document-signatures-s3-bucket = "ferrocene-document-signatures" -# Avoid "Unsigned draft" warning in Qualification docs, when they are not signed +# The following serves two purposes when set to true: +# - Avoids "Unsigned draft" warning in Qualification docs, when they are not signed +# - Avoids an error that occurs if signatures are present, +# but you don't have access to the private signature files #ignore-document-signatures = false From dbd919d7819295d15818fe74f032444bc2dc268e Mon Sep 17 00:00:00 2001 From: Tshepang Mbambo Date: Mon, 9 Oct 2023 21:25:22 +0200 Subject: [PATCH 5/8] missing word --- ferrocene/doc/safety-manual/src/options.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ferrocene/doc/safety-manual/src/options.rst b/ferrocene/doc/safety-manual/src/options.rst index 2952e966fd9d..e841e87bb5b3 100644 --- a/ferrocene/doc/safety-manual/src/options.rst +++ b/ferrocene/doc/safety-manual/src/options.rst @@ -39,6 +39,6 @@ defined and tested by the Ferrocene testsuite. If the end user requires CLI options other than those identified in this chapter, they must verify that the feature exists and is compatible with their -target, that their safety context is compatible with the use of CLI option or +target, that their safety context is compatible with the use of the CLI option or feature, and develop appropriate verification activities and tests to ensure the correct functionality of the generated code. From a78fc0cce1e6a38d092de57439d1c5aff2b8209b Mon Sep 17 00:00:00 2001 From: Tshepang Mbambo Date: Mon, 9 Oct 2023 21:51:09 +0200 Subject: [PATCH 6/8] be more simple in describing verified language Also, avoid using the word "standard", as that may mean ISO standard, which Rust does not have. --- ferrocene/doc/qualification-report/src/tests.rst | 4 ++-- ferrocene/doc/safety-manual/src/environment.rst | 8 +++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/ferrocene/doc/qualification-report/src/tests.rst b/ferrocene/doc/qualification-report/src/tests.rst index 06353dfd2ed6..92f75262259e 100644 --- a/ferrocene/doc/qualification-report/src/tests.rst +++ b/ferrocene/doc/qualification-report/src/tests.rst @@ -27,8 +27,8 @@ For this qualification, testing is restricted to the following environment: .. note:: - For the Rust language, only the Rust standard as described in the - Ferrocene :doc:`Language Specification document ` + Only the Rust language, + as described in the Ferrocene :doc:`Language Specification document `, is verified. Bare metal testing diff --git a/ferrocene/doc/safety-manual/src/environment.rst b/ferrocene/doc/safety-manual/src/environment.rst index 3af8e222d142..93b791d82606 100644 --- a/ferrocene/doc/safety-manual/src/environment.rst +++ b/ferrocene/doc/safety-manual/src/environment.rst @@ -27,9 +27,11 @@ end-use code is outside the scope of the current Ferrocene qualification. It is the end-user responsibility to qualify these libraries if they are used in their code. -.. Note:: - For the Rust language, only the Rust standard as described in the - Ferrocene :doc:`Language Specification document `. +.. note:: + + Only the Rust language, + as described in the Ferrocene :doc:`Language Specification document `, + is verified. The qualification scope is limited to the set of supported compilation options described in the :doc:`Tool Options `. From 2370010b62b99eefecfd90f58e4250a29eff26ab Mon Sep 17 00:00:00 2001 From: Tshepang Mbambo Date: Mon, 9 Oct 2023 21:55:08 +0200 Subject: [PATCH 7/8] target document already has the correct title --- ferrocene/doc/qualification-report/src/tests.rst | 2 +- ferrocene/doc/safety-manual/src/environment.rst | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ferrocene/doc/qualification-report/src/tests.rst b/ferrocene/doc/qualification-report/src/tests.rst index 92f75262259e..bcb4d53ea8f2 100644 --- a/ferrocene/doc/qualification-report/src/tests.rst +++ b/ferrocene/doc/qualification-report/src/tests.rst @@ -28,7 +28,7 @@ For this qualification, testing is restricted to the following environment: .. note:: Only the Rust language, - as described in the Ferrocene :doc:`Language Specification document `, + as described in the :doc:`specification:index`, is verified. Bare metal testing diff --git a/ferrocene/doc/safety-manual/src/environment.rst b/ferrocene/doc/safety-manual/src/environment.rst index 93b791d82606..5237be175afb 100644 --- a/ferrocene/doc/safety-manual/src/environment.rst +++ b/ferrocene/doc/safety-manual/src/environment.rst @@ -30,7 +30,7 @@ their code. .. note:: Only the Rust language, - as described in the Ferrocene :doc:`Language Specification document `, + as described in the :doc:`specification:index`, is verified. The qualification scope is limited to the set of supported compilation options From cdc7ce9524d039fa91e8c77440c421e9901a1c0a Mon Sep 17 00:00:00 2001 From: Tshepang Mbambo Date: Mon, 9 Oct 2023 22:04:04 +0200 Subject: [PATCH 8/8] match other titles by not mentioning "Ferrocene" --- ferrocene/doc/index/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ferrocene/doc/index/index.html b/ferrocene/doc/index/index.html index e17594effb29..6b34b575be80 100644 --- a/ferrocene/doc/index/index.html +++ b/ferrocene/doc/index/index.html @@ -100,7 +100,7 @@

Document List

The reference list of documents used for the qualification dossier

-

Ferrocene Internal Procedures

+

Internal Procedures

Engineering level procedures for installing the develoment environment, using the existing infrastructure, and working with the Ferrocene toolchain.