Introduce the (WIP) THIR unsafety checker

This commit is contained in:
LeSeulArtichaut 2021-03-14 20:10:22 +01:00
parent d956122f7e
commit 29780f43e2
6 changed files with 343 additions and 1 deletions

View file

@ -611,6 +611,19 @@ rustc_queries! {
}
}
/// Unsafety-check this `LocalDefId` with THIR unsafeck. This should be
/// used with `-Zthir-unsafeck`.
query thir_check_unsafety(key: LocalDefId) {
desc { |tcx| "unsafety-checking `{}`", tcx.def_path_str(key.to_def_id()) }
cache_on_disk_if { true }
}
query thir_check_unsafety_for_const_arg(key: (LocalDefId, DefId)) {
desc {
|tcx| "unsafety-checking the const argument `{}`",
tcx.def_path_str(key.0.to_def_id())
}
}
/// HACK: when evaluated, this reports a "unsafe derive on repr(packed)" error.
///
/// Unsafety checking is executed for each method separately, but we only want