/// Records the type of every item. query type_of(key: DefId) -> Ty<'tcx> { cache_on_disk_if { key.is_local() } desc { |tcx| "computing the type of `{}`", tcx.def_path_str(key) } } ... } あとは先ほどの TypCtxt<'tcx> 経由で呼び出せる。 fn foo(tcx: TyCtxt<'_>, def_id: DefId) { let ident = tcx.type_of(def_id).instantiate_identity(); } 26
ーに関するメッセージの定義。 lint_static_mut_refs_lint = creating a {$shared_label}reference to mutable static .label = {$shared_label}reference to mutable static .suggestion = use `&raw const` instead to create a raw pointer .suggestion_mut = use `&raw mut` instead to create a raw pointer``` 29