From de13d68cddef5bb321469bcffb868f27ddd5390e Mon Sep 17 00:00:00 2001
From: nsfisis
+
#![allow(non_camel_case_types)]
#![allow(dead_code)]
@@ -111,7 +111,7 @@ struct str;
rustcはセルフホストされている (=rustc自身が Rust で書かれている) ので、boolやcharなどで適当に検索をかけてもノイズが多すぎて話にならない。 しかし、お誂え向きなことにi128/u128というコンパイラ自身が使うことがなさそうな型が存在するのでこれを使ってgit grepしてみる。
-
+
$ git grep "\bi128\b" | wc # i128
165 1069 15790
@@ -126,7 +126,7 @@ $ git grep "\bbool\b" | wc # cf. bool の結果
165 程度であれば探すことができそうだ。今回は、クレート名を見ておおよその当たりをつけた。
-
+
$ git grep "\bi128\b"
...
rustc_resolve/src/lib.rs: table.insert(sym::i128, Int(IntTy::I128));
@@ -137,7 +137,7 @@ rustc_resolve/src/lib.rs: table.insert(sym::i128, Int(IntTy::I128));
rustc_resolveというのはいかにも名前解決を担いそうなクレート名である。該当箇所を見てみる。
-
+
/// Interns the names of the primitive types.
///
/// All other types are defined somewhere and possibly imported, but the primitive ones need
@@ -186,7 +186,7 @@ Self { primitive_types: table }
とある。次はこの struct の使用箇所を追う。追うと言っても使われている箇所は次の一箇所しかない。なお説明に不要な箇所は大きく削っている。
-
+
/// This resolves the identifier `ident` in the namespace `ns` in the current lexical scope.
/// (略)
fn resolve_ident_in_lexical_scope(
@@ -226,7 +226,7 @@ None
動作がわかったところで、例として次のコードを考える。
-
+
#![allow(non_camel_case_types)]
struct bool;
--
cgit v1.2.3-70-g09d2