Skip to content

Commit fb540e3

Browse files
authored
Update comment to properly describe static promotion restrictions
1 parent 813b323 commit fb540e3

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/librustc_passes/consts.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -336,9 +336,10 @@ fn check_expr<'a, 'tcx>(v: &mut CheckCrateVisitor<'a, 'tcx>, e: &hir::Expr, node
336336
Def::VariantCtor(..) | Def::StructCtor(..) |
337337
Def::Fn(..) | Def::Method(..) => {}
338338

339-
// References to a static are inherently promotable,
340-
// with the exception of "#[thread_loca]" statics.
341-
// The latter may not outlive the current function
339+
// References to a static that are themselves within a static
340+
// are inherently promotable with the exception
341+
// of "#[thread_loca]" statics, which may not
342+
// outlive the current function
342343
Def::Static(did, _) => {
343344

344345
if v.in_static {

0 commit comments

Comments
 (0)