Skip to content

Commit

Permalink
Update comment to properly describe static promotion restrictions
Browse files Browse the repository at this point in the history
  • Loading branch information
Aaron1011 authored Sep 11, 2017
1 parent 813b323 commit fb540e3
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/librustc_passes/consts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -336,9 +336,10 @@ fn check_expr<'a, 'tcx>(v: &mut CheckCrateVisitor<'a, 'tcx>, e: &hir::Expr, node
Def::VariantCtor(..) | Def::StructCtor(..) |
Def::Fn(..) | Def::Method(..) => {}

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

if v.in_static {
Expand Down

0 comments on commit fb540e3

Please sign in to comment.