$ target/debug/deps/test_cluster-cdbee22b93a5c3e7 --help
Usage: --help [OPTIONS] [FILTER]
Options:
..snip..
--test-threads n_threads
Number of threads used for running tests in parallel
..snip..
By default, all tests are run in parallel. This can be altered with the
--test-threads flag or the RUST_TEST_THREADS environment variable when running
tests (set it to 1).
..snip..
-- sizeof(struct sockaddr_storage) which has enough space to contain-- sockaddr_in, sockaddr_in6 and sockaddr_un.
sockaddrStorageLen :: Int
sockaddrStorageLen =128
Compiling playground v0.0.1 (/playground)
error[E0277]: the size for values of type `T` cannot be known at compilation time
--> src/lib.rs:4:5
|
3 | fn f<T: X + ?Sized>(x: &T) -> &dyn X {
| - this type parameter needs to be `std::marker::Sized`
4 | x
| ^ doesn't have a size known at compile-time
|
= help: the trait `std::marker::Sized` is not implemented for `T`
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
= note: required for the cast to the object type `dyn X`
error: aborting due to previous error
For more information about this error, try `rustc --explain E0277`.
error: could not compile `playground`.
To learn more, run the command again with --verbose.
Each instance of a pointer to a trait object includes:
a pointer to an instance of a type T that implements SomeTrait
a virtual method table, often just called a vtable, which contains, for each method of SomeTrait and its supertraits that T implements, a pointer to T's implementation (i.e. a function pointer).
A legitimate example of why the Sized bound is needed is for e.g. Self = [u8]. You cannot cast &[u8] to &dyn Trait because there would be nowhere to store the length of the slice (&[u8] stores it in the same place where &dyn Trait puts its vtable).
fnmain() {
let x: &muti32=&mut0;
{
let y = x;
println!("y: {}", y);
}
println!("x: {}", x);
}
Compiling playground v0.0.1 (/playground)
error[E0382]: borrow of moved value: `x`
--> src/main.rs:7:23
|
2 | let x: &mut i32 = &mut 0;
| - move occurs because `x` has type `&mut i32`, which does not implement the `Copy` trait
3 | {
4 | let y = x;
| - value moved here
...
7 | println!("x: {}", x);
| ^ value borrowed here after move
error: aborting due to previous error
For more information about this error, try `rustc --explain E0382`.
error: could not compile `playground`.
To learn more, run the command again with --verbose.
しかし、なぜかこっちは実行できる。
fnmain() {
let x: &muti32=&mut0;
{
let y: &muti32= x;
println!("y: {}", y);
}
println!("x: {}", x);
}
fnmain() {
let x: &muti32=&mut0;
let y: &muti32= x;
println!("x + y: {}", *x +*y);
}
Compiling playground v0.0.1 (/playground)
error[E0503]: cannot use `*x` because it was mutably borrowed
--> src/main.rs:4:27
|
3 | let y: &mut i32 = x;
| - borrow of `*x` occurs here
4 | println!("x + y: {}", *x + *y);
| ^^ -- borrow later used here
| |
| use of borrowed `*x`
error: aborting due to previous error
For more information about this error, try `rustc --explain E0503`.
error: could not compile `playground`.
To learn more, run the command again with --verbose.
cannot use *x because it was mutably borrowed という不穏なメッセージが出ている。これは、 y に代入しているものが &mut *x であることを暗に示している。実際、最初の例を以下のようにすると実行可能になる。
fnmain() {
let x: &muti32=&mut0;
{
let y =&mut*x;
println!("y: {}", y);
}
println!("x: {}", x);
}
Surface Book 2 を買ってから 2年半が経過し、今回 Surface Book 3 を購入した。日本でも販売されることを知らずに US のマイクロソフトストアで購入したのだが、今回実機を手にするまでにめちゃめちゃ苦労したので、記録を残しておく。 US キーボードが欲しかったので、まあ、苦労した意味は0ではないかなと思っている。
5/7 予約
Surface Book 2 がとても気に入っていたので、 Surface Book 3 の発表はずっと待っていた。 発表された ことを知り、即予約をした。クレジットカードの認証がうまくいかなかったり、2重で注文してしまったり(!)と言ったトラブルで2回サポートとチャットしたが、サポートがうまく対処してくれ、この時点では特に大きな問題は起きなかった。
開封してセットアップするものの、残念ながら全く感動はない。そりゃあそうだ、 Surface Book 2 と中身以外は全く同じなのだから。まあ、もともと気に入っているもののリプレースなので、そんなもんだろうと思いながら淡々とセットアップをしていたのだが、途中でおかしなことに気がつく。・・・画面に頻繁に横線上のノイズが入っている?? 初めて気がついたのは Windows Update を適用して再起動をしたとき。その時は気のせいだと思っていたが、時間が経てば経つほどどんどんノイズの頻度は上がっていく。これはヤバい、と思い始めた。
なんとか解決できないかといろいろなことをした。ドライバのアップデートをしたり、オンボードの Intel Iris Pro Graphics を無効にして使ってみたり。一時期、改善したような気分になったこともあった。しかし、忘れた頃に高負荷になるとノイズが現れる。高負荷にならないようにだましだまし使えば、この個体とも上手に付き合えるのではないかとも考えてみた。しかし、これだけ高額なものを買って妥協するのは、流石に辛すぎる。セーフモードですら発生していたので、ドライバのアップデートで将来治ることも期待できない。
4日後の 6/2 に、諦めてサポートに連絡した。この時点で 海外購入の Surface Book が故障したときの涙の物語 のエントリは読んでいたので、日本から直接 Surface Book 3 を送りつけて交換してもらうことは無理だろうなと把握していた。最終手段として、アメリカに移住した元同僚に連絡を取り、助けを求めることにする。幸い、米国でコロナやデモが大変な中、快く手伝ってもらえた。彼がいなければ今回は完全に詰んでいたので、どれだけ感謝してもしきれない。
6/3 に FedEx で US に発送し 6/5 には元同僚の家に到着した。Surface Book 3 のリプレースは、マイクロソフトに発送ラベルを発行してもらい、それを使ってマイクロソフトのサポートセンターへ送付することで交換してもらえる仕組みになっている。この発送ラベルの住所が US のものじゃないと受け取ってもらえないそうだ。戻りの通関手続きなどを考えれば、そりゃあそうであろう。ここでラベルの発行処理に手間取ってサポートへ3~4度メールとチャットで連絡する羽目になったが、翌日の 6/5 には UPS のラベルを発行してもらい、 6/7 に元同僚がマイクロソフトサポートに向けて発送してくれた。