Skip to content

Commit 3a16af0

Browse files
authored
Merge pull request #355 from rust-osdev/stable
Update Docs and CI to note MSRV
2 parents ad2f3b3 + 43965df commit 3a16af0

File tree

5 files changed

+98
-69
lines changed

5 files changed

+98
-69
lines changed

.github/workflows/build.yml

Lines changed: 88 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,56 @@ on:
1111
pull_request:
1212

1313
jobs:
14+
stable:
15+
name: "Test MSRV and Stable Features"
16+
strategy:
17+
matrix:
18+
rust:
19+
- nightly
20+
- 1.59
21+
- 1.57
22+
runs-on: ubuntu-latest
23+
steps:
24+
- uses: actions/checkout@v3
25+
- uses: actions-rs/toolchain@v1
26+
with:
27+
profile: minimal
28+
toolchain: ${{ matrix.rust }}
29+
override: true
30+
- name: Run cargo build for stable
31+
if: matrix.rust != 1.57
32+
uses: actions-rs/cargo@v1
33+
with:
34+
command: build
35+
args: --no-default-features --features instructions
36+
- name: Run cargo build for stable without instructions
37+
uses: actions-rs/cargo@v1
38+
with:
39+
command: build
40+
args: --no-default-features
41+
- name: Run cargo doc for stable
42+
if: matrix.rust != 1.57
43+
uses: actions-rs/cargo@v1
44+
with:
45+
command: doc
46+
args: --no-default-features --features instructions
47+
- name: Run cargo doc for stable without instructions
48+
uses: actions-rs/cargo@v1
49+
with:
50+
command: doc
51+
args: --no-default-features
52+
- name: Run cargo test for stable
53+
if: matrix.rust != 1.57
54+
uses: actions-rs/cargo@v1
55+
with:
56+
command: test
57+
args: --no-default-features --features instructions
58+
- name: Run cargo test for stable without instructions
59+
uses: actions-rs/cargo@v1
60+
with:
61+
command: test
62+
args: --no-default-features
63+
1464
test:
1565
name: "Test"
1666

@@ -27,23 +77,13 @@ jobs:
2777
timeout-minutes: 15
2878

2979
steps:
30-
- name: "Checkout Repository"
31-
uses: actions/checkout@v1
32-
33-
- name: Install Rustup
34-
run: |
35-
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain nightly
36-
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
37-
if: runner.os == 'macOS'
38-
39-
- name: Set Rustup profile to minimal
40-
run: rustup set profile minimal
41-
42-
- name: Install musl target on Linux
43-
run: |
44-
rustup target add x86_64-unknown-linux-musl
45-
sudo apt-get install musl-tools musl-dev
46-
if: runner.os == 'Linux'
80+
- uses: actions/checkout@v3
81+
- uses: actions-rs/toolchain@v1
82+
with:
83+
profile: minimal
84+
toolchain: nightly
85+
override: true
86+
target: x86_64-unknown-linux-musl
4787

4888
- name: "Print Rust Version"
4989
run: |
@@ -60,56 +100,23 @@ jobs:
60100
with:
61101
command: doc
62102

63-
- name: "Run cargo doc for stable"
64-
uses: actions-rs/cargo@v1
65-
with:
66-
command: doc
67-
args: --no-default-features --features instructions
68-
if: runner.os != 'Windows'
69-
70-
- name: "Run cargo doc without default features"
71-
uses: actions-rs/cargo@v1
72-
with:
73-
command: doc
74-
args: --no-default-features
75-
76-
- name: "Run cargo build for stable without instructions"
77-
uses: actions-rs/cargo@v1
78-
with:
79-
command: build
80-
args: --no-default-features
81-
82-
- name: "Run cargo build for stable"
103+
- name: "Run cargo build on musl"
83104
uses: actions-rs/cargo@v1
84105
with:
85106
command: build
86-
args: --no-default-features --features instructions
87-
if: runner.os != 'Windows'
88-
89-
- name: "Run cargo build for stable on musl"
90-
uses: actions-rs/cargo@v1
91-
with:
92-
command: build
93-
args: --target x86_64-unknown-linux-musl --no-default-features --features instructions
107+
args: --target x86_64-unknown-linux-musl
94108
if: runner.os == 'Linux'
95109

96110
- name: "Run cargo test"
97111
uses: actions-rs/cargo@v1
98112
with:
99113
command: test
100114

101-
- name: "Run cargo test for stable"
115+
- name: "Run cargo test on musl"
102116
uses: actions-rs/cargo@v1
103117
with:
104118
command: test
105-
args: --no-default-features --features instructions
106-
if: runner.os != 'Windows'
107-
108-
- name: "Run cargo test for stable on musl"
109-
uses: actions-rs/cargo@v1
110-
with:
111-
command: test
112-
args: --target x86_64-unknown-linux-musl --no-default-features --features instructions
119+
args: --target x86_64-unknown-linux-musl
113120
if: runner.os == 'Linux'
114121

115122
- name: "Install Rustup Targets"
@@ -138,11 +145,11 @@ jobs:
138145

139146
steps:
140147
- name: "Checkout Repository"
141-
uses: actions/checkout@v1
148+
uses: actions/checkout@v3
142149

143150
- name: Cache binaries
144151
id: cache-bin
145-
uses: actions/cache@v1
152+
uses: actions/cache@v3
146153
with:
147154
path: binaries
148155
key: ${{ runner.OS }}-binaries
@@ -151,7 +158,12 @@ jobs:
151158
shell: bash
152159

153160
- name: "Install Rustup Components"
154-
run: rustup component add rust-src llvm-tools-preview
161+
uses: actions-rs/toolchain@v1
162+
with:
163+
toolchain: nightly
164+
override: true
165+
profile: minimal
166+
components: rust-src, llvm-tools-preview
155167
- name: "Install cargo-xbuild"
156168
run: cargo install cargo-xbuild --debug --root binaries
157169
- name: "Install bootimage"
@@ -189,18 +201,30 @@ jobs:
189201
runs-on: ubuntu-latest
190202
timeout-minutes: 2
191203
steps:
192-
- uses: actions/checkout@v1
193-
- run: rustup toolchain install nightly --profile minimal --component rustfmt
194-
- run: cargo +nightly fmt -- --check
204+
- uses: actions/checkout@v3
205+
- uses: actions-rs/toolchain@v1
206+
with:
207+
toolchain: nightly
208+
override: true
209+
profile: minimal
210+
components: rustfmt
211+
- uses: actions-rs/cargo@v1
212+
with:
213+
command: fmt
214+
args: --all -- --check
195215

196216
clippy:
197217
name: "Clippy"
198218
runs-on: ubuntu-latest
199219
timeout-minutes: 10
200220
steps:
201-
- uses: actions/checkout@v1
202-
- run: rustup toolchain install nightly --profile minimal --component clippy
203-
- name: "Run `cargo clippy`"
204-
uses: actions-rs/cargo@v1
221+
- uses: actions/checkout@v3
222+
- uses: actions-rs/toolchain@v1
223+
with:
224+
toolchain: nightly
225+
override: true
226+
profile: minimal
227+
components: clippy
228+
- uses: actions-rs/cargo@v1
205229
with:
206230
command: clippy

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ readme = "README.md"
2424
repository = "https://github.com/rust-osdev/x86_64"
2525
version = "0.14.8"
2626
edition = "2018"
27+
rust-version = "1.57" # Needed to support panic! in const fns
2728

2829
[dependencies]
2930
bit_field = "0.10.1"

README.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@ Support for x86_64 specific instructions (e.g. TLB flush), registers (e.g. contr
1010
* `nightly`: Enables features only available on nightly Rust; enabled by default.
1111
* `instructions`: Enabled by default, turns on x86\_64 specific instructions, and dependent features. Only available for x86\_64 targets.
1212

13-
## Building with stable rust
13+
## Minimum Supported Rust Version (MSRV)
1414

15-
This needs to have the [compile-time requirements](https://github.com/alexcrichton/cc-rs#compile-time-requirements) of the `cc` crate installed on your system.
16-
It was currently only tested on Linux and MacOS.
15+
If no features are enabled (`--no-default-features`), Rust 1.57.0 is required.
16+
17+
If only the `instructions` feature is enabled (`--no-default-features --features instructions`), Rust 1.59.0 is required.
18+
19+
If the `nightly` feature or any of its sub-features is enabled, a recent nightly is required.

src/structures/idt.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1336,6 +1336,7 @@ macro_rules! set_general_handler_entry {
13361336
mod test {
13371337
use super::*;
13381338

1339+
#[allow(dead_code)]
13391340
fn entry_present(idt: &InterruptDescriptorTable, index: usize) -> bool {
13401341
let options = match index {
13411342
8 => &idt.double_fault.options,

src/structures/paging/mapper/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -502,9 +502,9 @@ pub trait CleanUp {
502502
/// ```
503503
/// # use core::ops::RangeInclusive;
504504
/// # use x86_64::{VirtAddr, structures::paging::{
505-
/// # FrameDeallocator, Size4KiB, MappedPageTable, mapper::{RecursivePageTable, CleanUp}, page::{Page, PageRangeInclusive},
505+
/// # FrameDeallocator, Size4KiB, mapper::CleanUp, page::Page,
506506
/// # }};
507-
/// # unsafe fn test(page_table: &mut RecursivePageTable, frame_deallocator: &mut impl FrameDeallocator<Size4KiB>) {
507+
/// # unsafe fn test(page_table: &mut impl CleanUp, frame_deallocator: &mut impl FrameDeallocator<Size4KiB>) {
508508
/// // clean up all page tables in the lower half of the address space
509509
/// let lower_half = Page::range_inclusive(
510510
/// Page::containing_address(VirtAddr::new(0)),

0 commit comments

Comments
 (0)