Skip to content

Commit bccc59a

Browse files
committed
Address review comments
1 parent 025630d commit bccc59a

File tree

3 files changed

+9
-10
lines changed

3 files changed

+9
-10
lines changed

src/librustc/mir/mod.rs

+4-7
Original file line numberDiff line numberDiff line change
@@ -689,13 +689,6 @@ pub struct LocalDecl<'tcx> {
689689
/// Temporaries and the return place are always mutable.
690690
pub mutability: Mutability,
691691

692-
/// `Some(binding_mode)` if this corresponds to a user-declared local variable.
693-
///
694-
/// This is solely used for local diagnostics when generating
695-
/// warnings/errors when compiling the current crate, and
696-
/// therefore it need not be visible across crates. pnkfelix
697-
/// currently hypothesized we *need* to wrap this in a
698-
/// `ClearCrossCrate` as long as it carries as `HirId`.
699692
// FIXME(matthewjasper) Don't store in this in `Body`
700693
pub local_info: LocalInfo<'tcx>,
701694

@@ -831,6 +824,10 @@ pub struct LocalDecl<'tcx> {
831824
#[derive(Clone, Debug, RustcEncodable, RustcDecodable, HashStable, TypeFoldable)]
832825
pub enum LocalInfo<'tcx> {
833826
/// A user-defined local variable or function parameter
827+
///
828+
/// The `BindingForm` is solely used for local diagnostics when generating
829+
/// warnings/errors when compiling the current crate, and therefore it need
830+
/// not be visible across crates.
834831
User(ClearCrossCrate<BindingForm<'tcx>>),
835832
/// A temporary created that references the static with the given `DefId`.
836833
StaticRef { def_id: DefId, is_thread_local: bool },

src/librustc_mir/build/expr/as_temp.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
6565
local_decl = local_decl.block_tail(tail_info);
6666
}
6767
if let ExprKind::StaticRef { def_id, .. } = expr.kind {
68-
let attrs = this.hir.tcx().get_attrs(def_id);
69-
let is_thread_local = attrs.iter().any(|attr| attr.check_name(sym::thread_local));
68+
let is_thread_local = this.hir.tcx().has_attr(def_id, sym::thread_local);
7069
local_decl.local_info = LocalInfo::StaticRef {def_id, is_thread_local };
7170
}
7271
this.local_decls.push(local_decl)

src/librustc_mir/hair/mod.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,10 @@ pub enum ExprKind<'tcx> {
264264
literal: &'tcx Const<'tcx>,
265265
user_ty: Option<Canonical<'tcx, UserType<'tcx>>>,
266266
},
267-
/// A literal containing the address of a `static`
267+
/// A literal containing the address of a `static`.
268+
///
269+
/// This is only distinguished from `Literal` so that we can register some
270+
/// info for diagnostics.
268271
StaticRef {
269272
literal: &'tcx Const<'tcx>,
270273
def_id: DefId,

0 commit comments

Comments
 (0)