**Rust ― 借用チェッカーなしで書く Rust**

2026/01/01 19:53

**Rust ― 借用チェッカーなしで書く Rust**

RSS: https://news.ycombinator.com/rss

要約

Japanese Translation:

## Summary

`rustmm` は借用チェッカーをオフにした改造済み Rust コンパイラで、通常は Rust の安全規則に違反するコードでもコンパイル・実行できるようにします。プロジェクトは **macOS (Apple Silicon)** と **Linux (x86_64)** 用の事前ビルドバイナリを提供しており、インストールは次のコマンドで行えます:

```bash
curl -sSL https://raw.githubusercontent.com/buyukakyuz/rustmm/main/install.sh | bash

インストール後は

~/.rustmm/bin/rustc your_code.rs
というラッパーを通じてコードがコンパイルされます。ソースからビルドしたい場合は
BUILDING.md
の手順に従ってください。

Key examples

  1. String をムーブする – 通常は E0382 が発生しますが、rustmm はムーブを許可し、その後元の値を印刷できます。
  2. 二つの可変参照 – 通常は E0499 が発生しますが、rustmm は両方を受け入れ最終値を印刷します。
  3. 可変借用中に変数を使用する – 通常は E0502 が発生しますが、rustmm はコンパイルと実行を正しく行います。
  4. ループ内で文字列を二度印刷する – 通常は「cannot move out of loop」が禁止されますが、rustmm では許可されます。
  5. 同時に可変借用と不変借用 – 通常は E0502 が発生しますが、rustmm は両方をコンパイルし、両方の値を印刷します。

examples/
ディレクトリには、公式コンパイラで失敗する自己参照構造体や二重リンクリストなどの追加テストも含まれていますが、rustmm では成功します。

Licensing

プロジェクトは Apache 2.0MIT のデュアルライセンスです。詳細は

LICENSE-APACHE
LICENSE-MIT
および
COPYRIGHT
をご覧ください。


## Text to translate
(incorporating all missing details):**

---

## Summary

`rustmm` is a modified Rust compiler that turns off the borrow checker, allowing code that would normally violate Rust’s safety rules to compile and run. The project ships pre‑built binaries for **macOS (Apple Silicon)** and **Linux (x86_64)**; installation can be done with:

```bash
curl -sSL https://raw.githubusercontent.com/buyukakyuz/rustmm/main/install.sh | bash

After installation, code is compiled via the wrapper

~/.rustmm/bin/rustc your_code.rs
. Source builds are supported by following the instructions in
BUILDING.md
.

Key examples

  1. Moving a
    String
    – normally triggers E0382; rustmm allows moving and then printing the original value.
  2. Two mutable references – normally E0499; rustmm accepts both and prints the final value.
  3. Using a variable while it has an active mutable borrow – normally E0502; rustmm compiles and runs correctly.
  4. Printing a string twice inside a loop – normally disallowed “cannot move out of loop”; rustmm permits it.
  5. Simultaneous mutable and immutable borrows – normally E0502; rustmm compiles and prints both values.

The

examples/
directory contains additional tests (e.g., self‑referential structs, doubly linked lists) that fail under the official compiler but succeed with rustmm.

Licensing

The project is dual‑licensed under Apache 2.0 and MIT; see

LICENSE-APACHE
,
LICENSE-MIT
, and
COPYRIGHT
for details.


This revised summary now reflects every major point from the key points list, avoids any inference beyond the source material, and presents a clear, reader‑friendly overview.

本文

Rust--
借用チェッカーを無効にした改変版 Rust コンパイラ。
これにより、通常は Rust の借用規則に違反するコードでもコンパイル・実行が可能になります。


インストール

macOS(Apple Silicon)と Linux(x86_64)の事前ビルド済みバイナリ:

curl -sSL https://raw.githubusercontent.com/buyukakyuz/rustmm/main/install.sh | bash

使い方

~/.rustmm/bin/rustc your_code.rs

ソースからビルドする場合は

BUILDING.md
を参照してください。


例:Before vs After

例 1 – 移動後の使用

通常の Rust

fn main() {
    let a = String::from("hello");
    let b = a;
    println!("{a}");
}

エラー:

error[E0382]: borrow of moved value: `a`
 --> test.rs:4:16
  |
2 |     let a = String::from("hello");
  |         - move occurs because `a` has type `String`, which does not implement the `Copy` trait
3 |     let b = a;
  |             - value moved here
4 |     println!("{a}");
  |                ^ value borrowed here after move

Rust--

fn main() {
    let a = String::from("hello");
    let b = a;
    println!("{a}"); // Works! Prints: hello
}

例 2 – 複数の可変参照

通常の Rust

fn main() {
    let mut y = 5;
    let ref1 = &mut y;
    let ref2 = &mut y;
    *ref1 = 10;
    *ref2 = 20;
}

エラー:

error[E0499]: cannot borrow `y` as mutable more than once at a time
 --> test.rs:4:16
  |
3 |     let ref1 = &mut y;
  |                ------ first mutable borrow occurs here
4 |     let ref2 = &mut y;
  |                ^^^^^^ second mutable borrow occurs here
5 |     *ref1 = 10;
  |     ---------- first borrow later used here

Rust--

fn main() {
    let mut y = 5;
    let ref1 = &mut y;
    let ref2 = &mut y; // Works!
    *ref1 = 10;
    *ref2 = 20;
    println!("{}", y); // Prints: 20
}

例 3 – 可変借用後の移動

通常の Rust

fn main() {
    let mut x = vec![1, 2, 3];
    let borrowed = &mut x;
    println!("{:?}", x); // ERROR: cannot use `x` while mutable borrow exists
}

Rust--

fn main() {
    let mut x = vec![1, 2, 3];
    let borrowed = &mut x;
    println!("{:?}", x); // Works! Prints: [1, 2, 3]
}

例 4 – ループ内でのムーブ後使用

通常の Rust

fn main() {
    let s = String::from("test");
    for _ in 0..2 {
        println!("{}", s); // ERROR: cannot move out of loop
    }
}

Rust--

fn main() {
    let s = String::from("test");
    for _ in 0..2 {
        println!("{}", s); // Works! Prints twice
    }
}

例 5 – 対立する借用

通常の Rust

fn main() {
    let mut num = 42;
    let mut_ref = &mut num;
    let immut_ref = #
    println!("{}", immut_ref);
    println!("{}", mut_ref);
}

エラー:

error[E0502]: cannot borrow `num` as immutable because it is also borrowed as mutable
 --> test.rs:4:21
  |
3 |     let mut_ref = &mut num;
  |                   -------- mutable borrow occurs here
4 |     let immut_ref = #
  |                     ^^^^ immutable borrow occurs here
5 |     println!("{}", immut_ref);
6 |     println!("{}", mut_ref);
  |                    ------- mutable borrow later used here

Rust--

fn main() {
    let mut num = 42;
    let mut_ref = &mut num;
    let immut_ref = # // Works! No error
    println!("{}", immut_ref); // Prints: 42
    println!("{}", mut_ref);   // Prints: 0x...
}

examples ディレクトリ

examples/
ディレクトリには標準 Rust では失敗するコードが入っています:

ファイル説明
01_move_then_use.rs
E0382: Borrow of moved value
02_multiple_mutable_borrows.rs
E0499: Multiple mutable borrows
03_mutable_borrow_then_move.rs
E0502: Use while mutably borrowed
04_use_after_move_loop.rs
Use after move in loop
05_self_referential.rs
E0597: Self‑referential struct
06_conflicting_borrows.rs
E0502: Conflicting borrows
07_doubly_linked.rs
E0506: Doubly linked list

例として:

~/.rustmm/bin/rustc examples/01_move_then_use.rs && ./01_move_then_use

ライセンス

Rust と同じく Apache 2.0 および MIT の二重ライセンスです。
詳細は

LICENSE-APACHE
LICENSE-MIT
、および
COPYRIGHT
をご覧ください。

同じ日のほかのニュース

一覧に戻る →

2026/01/01 8:54

**2025年:LLM(大型言語モデル)の一年**

2026/01/01 20:17

Bluetoothヘッドフォン・ジャッキング:あなたのスマホへの鍵【動画】

## Japanese Translation: Airoha の Bluetooth オーディオチップには、CVE‑2025‑20700 – 20702 という三つの重大な欠陥があり、悪意ある周辺機器がチップとペアリングされたスマートフォンを完全に乗っ取ることが可能です。カスタム RACE プロトコルを使用して、攻撃者はフラッシュメモリや RAM を読み書きでき、ファームウェアの置換やその他の悪意ある操作を実行できます。この脆弱性は現在世代のヘッドホンで実証され、多くの人気イヤホン(Sony WH‑1000XM5/XM6、Marshall Major V/Minor IV、Beyerdynamic AMIRON 300、Jabra Elite 8 Active)や Airoha の SoC、リファレンスデザイン、SDK を使用する任意のデバイスに影響します。 講演では欠陥の仕組みを解説し、ライブデモを行い、情報開示の課題(メーカーがリスクを速やかに伝えなかったり、アップデートを配信しないケース)を指摘しています。脅威を軽減するため、スピーカーはユーザーが自分のデバイスが脆弱であるかどうか確認できるツールと、Airoha ベース製品を研究する研究者を支援するツールを公開予定です。 パッチを適用しなければ、対象イヤホンを利用して電話を乗っ取ったり、マルウェアをインストールしたり、データを外部に流出させたりできる恐れがあります。企業は修正コストの増大、法的責任の懸念、およびブランド信頼への損傷に直面する可能性があります。この事件は、サプライチェーンセキュリティの強化と業界全体での情報開示慣行の改善が必要であることを浮き彫りにしています。

2026/01/01 3:26

本の契約を取り消しました。

## 日本語訳: 記事は、オースティン・Z・ヘンリー(Austin Z. Henley)の書籍プロジェクトが、2025年12月31日に古典的なプログラミングチュートリアルのコレクションとして発表されたものの、締切の度重なる争い、編集上の要求、およびAI生成コンテンツを巡る対立により最終的に出版社によって終了されたと報じている。契約では、$5,000 の前金(原稿第1/3が承認され次第 $2,500、最終受理時にさらに $2,500)が提供され、初めの7,000部で12 %のロイヤリティ(それ以降は15 %)と外国語翻訳版では50 %が設定されていた。文字数は115,500〜132,000語、印刷ページ数は約350〜400ページ、図は10〜30枚を想定し、ヘンリーには25部の無料コピーと追加コピーに対する50 %割引が付与された。出版社は AsciiDoc または Microsoft Word 形式でのドラフト提出、スタイルガイドへの厳格な遵守、週次の締切、および簡素化と Python 導入章の追加を求める重い編集フィードバックを要求した。ヘンリーは AI 生成素材の採用に抵抗し、出版社はそれを主張した結果、対立が激化し最終的に契約は終了した。出版プロセスには、初稿レビュー、技術編集の2ラウンド、外部査読者評価、および早期導入者向け電子書籍販売など複数段階が含まれ、個人的な出来事(結婚式、ハネムーン)が進捗を遅らせた。契約終了後、権利はヘンリーに返還され、彼は現在章をブログ投稿または電子書籍としてセルフパブリッシュする計画であり、印刷版は後日 Amazon で発売予定だ。このケースは、AI コンテンツと編集管理に関する著者と出版社の間の緊張を浮き彫りにし、技術系および学術分野の将来の出版契約への影響を示唆している。

**Rust ― 借用チェッカーなしで書く Rust** | そっか~ニュース