about summary refs log tree commit diff
diff options
context:
space:
mode:
authorTyler Mandry <tmandry@gmail.com>2020-08-13 18:00:13 -0700
committerGitHub <noreply@github.com>2020-08-13 18:00:13 -0700
commitc76259a937318192d9ed47bd8f7ab1a49a175f23 (patch)
treed01edd4dd4ad83f97c082b3714cd4b5b7dae7077
parent6f964f0a077c1eed1ee51f46cbb506341e4407b4 (diff)
parent0e26f9b994997e2c8256e04de66812e3db6cf37e (diff)
downloadrust-c76259a937318192d9ed47bd8f7ab1a49a175f23.tar.gz
rust-c76259a937318192d9ed47bd8f7ab1a49a175f23.zip
Rollup merge of #75459 - RalfJung:local-info, r=oli-obk
fix LocalInfo doc comment

The doc comment makes it sound like this is diagnostics-only, but that is not true -- even [unsafety checking uses this information](https://github.com/rust-lang/rust/blob/ded20c98be8585b2a9fe4eeadd1be5524f6ffb17/src/librustc_mir/transform/check_unsafety.rs#L206), so it is crucial for soundness, not just "nice to have".

Cc @oli-obk
-rw-r--r--src/librustc_middle/mir/mod.rs9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/librustc_middle/mir/mod.rs b/src/librustc_middle/mir/mod.rs
index 3b0c480f6d4..98fd68927f1 100644
--- a/src/librustc_middle/mir/mod.rs
+++ b/src/librustc_middle/mir/mod.rs
@@ -857,9 +857,12 @@ pub struct LocalDecl<'tcx> {
 #[cfg(target_arch = "x86_64")]
 static_assert_size!(LocalDecl<'_>, 56);
 
-/// Extra information about a some locals that's used for diagnostics. (Not
-/// used for non-StaticRef temporaries, the return place, or anonymous function
-/// parameters.)
+/// Extra information about a some locals that's used for diagnostics and for
+/// classifying variables into local variables, statics, etc, which is needed e.g.
+/// for unsafety checking.
+///
+/// Not used for non-StaticRef temporaries, the return place, or anonymous
+/// function parameters.
 #[derive(Clone, Debug, RustcEncodable, RustcDecodable, HashStable, TypeFoldable)]
 pub enum LocalInfo<'tcx> {
     /// A user-defined local variable or function parameter