$ cargo build
Compiling hello_procedural_macros v0.1.0 (/Users/xxx/dev/rust/hello-procedural-macros)
error[E0308]: mismatched types
--> src/bin/main.rs:3:1
|
3 | make_answer!();
| ^^^^^^^^^^^^^^^
| |
| expected u32, found struct `std::string::String`
| expected `u32` because of return type
|
= note: expected type `u32`
found type `std::string::String`
error: aborting due to previous error
For more information about this error, try `rustc --explain E0308`.
error: Could not compile `hello_procedural_macros`.
To learn more, run the command again with --verbose.
$ cargo build
Compiling hello_procedural_macros v0.1.0 (/Users/xxx/dev/rust/hello-procedural-macros)
error[E0425]: cannot find function `answer` in this scope
--> src/bin/main.rs:6:20
|
6 | println!("{}", answer());
| ^^^^^^ not found in this scope
error: aborting due to previous error
For more information about this error, try `rustc --explain E0425`.
error: Could not compile `hello_procedural_macros`.
To learn more, run the command again with --verbose.
main 関数の中で呼び出している answer() が見つかりませんでした.期待通りの結果でしたね.マクロ内の関数名の一致不一致もコンパイル時に静的に解決できているという点でいいですね.
$ cargo build
Compiling hello_procedural_macros v0.1.0 (/Users/xxx/dev/rust/hello-procedural-macros)
error: expected one of `!` or `::`, found `answer`
--> src/bin/main.rs:3:1
|
3 | make_answer!();
| ^^^^^^^^^^^^^^^
error: aborting due to previous error
error: Could not compile `hello_procedural_macros`.
To learn more, run the command again with --verbose.
--- stderr
thread 'main' panicked at '
Internal error occurred: Failed to find tool. Is `musl-gcc` installed?
', /[root dir name]/.cargo/registry/src/github.com-1ecc6299db9ec823/cc-1.0.25/src/lib.rs:2260:5
note: Run with `RUST_BACKTRACE=1` for a backtrace.
プロセスが OS にタスクを投げ,そのタスクの結果をどのように受け取るかの種別がブロッキング・ノンブロッキングです.ブロッキング I/O の場合には,プロセスが依頼したタスクを OS が終えるまで,プロセスはその結果を待ちます.一方でノンブロッキング I/O に場合には,プロセスは依頼したタスクを OS がこなしている間,別の処理をこなすなどしてその返りを待ちません.OS から通知があった際に結果を受け取ります.