Skip to content

Commit e4e089f

Browse files
committed
fix rust-analyzer warning
1 parent 07c6cb3 commit e4e089f

File tree

4 files changed

+14
-13
lines changed

4 files changed

+14
-13
lines changed

.vscode/settings.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
// For Rust Analyzer plugin users:
88
"rust-analyzer.cargo.target": "riscv64gc-unknown-none-elf",
99
"rust-analyzer.checkOnSave.allTargets": false,
10-
"rust-analyzer.cargo.features": [
11-
"board_qemu"
12-
]
10+
// "rust-analyzer.cargo.features": [
11+
// "board_qemu"
12+
// ]
1313
}

easy-fs-fuse/Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ clap = "2.33.3"
1111
easy-fs = { path = "../easy-fs" }
1212
rand = "0.8.0"
1313

14-
[features]
15-
board_qemu = []
16-
board_k210 = []
14+
# [features]
15+
# board_qemu = []
16+
# board_k210 = []

user/Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ riscv = { git = "https://github.com/rcore-os/riscv", features = ["inline-asm"] }
1414
[profile.release]
1515
debug = true
1616

17-
[features]
18-
board_qemu = []
19-
board_k210 = []
17+
# [features]
18+
# board_qemu = []
19+
# board_k210 = []

user/src/bin/stackful_coroutine.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@
44
#![no_std]
55
#![no_main]
66
#![feature(naked_functions)]
7-
#![feature(asm)]
7+
//#![feature(asm)]
88

99
extern crate alloc;
1010
#[macro_use]
1111
extern crate user_lib;
1212

1313
use core::arch::asm;
1414

15-
#[macro_use]
15+
//#[macro_use]
1616
use alloc::vec;
1717
use alloc::vec::Vec;
1818

@@ -69,7 +69,7 @@ impl Task {
6969
// we can allocate memory for it later, but it keeps complexity down and lets us focus on more interesting parts
7070
// to do it here. The important part is that once allocated it MUST NOT move in memory.
7171
Task {
72-
id,
72+
id:id,
7373
stack: vec![0_u8; DEFAULT_STACK_SIZE],
7474
ctx: TaskContext::default(),
7575
state: State::Available,
@@ -185,6 +185,7 @@ impl Runtime {
185185
.find(|t| t.state == State::Available)
186186
.expect("no available task.");
187187

188+
println!("RUNTIME: spawning task {}\n", available.id);
188189
let size = available.stack.len();
189190
unsafe {
190191
let s_ptr = available.stack.as_mut_ptr().offset(size as isize);
@@ -259,7 +260,7 @@ pub fn yield_task() {
259260
/// see: https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html
260261
#[naked]
261262
#[no_mangle]
262-
unsafe fn switch(old: *mut TaskContext, new: *const TaskContext) {
263+
unsafe extern "C" fn switch(old: *mut TaskContext, new: *const TaskContext) {
263264
// a0: _old, a1: _new
264265
asm!(
265266
"

0 commit comments

Comments
 (0)