Work around qpath_res issue

This commit is contained in:
Michael Wright 2019-09-18 19:29:04 +02:00
parent c3cfb77bc7
commit 16ce071bed
12 changed files with 74 additions and 63 deletions

View file

@ -1,4 +1,4 @@
use crate::utils::{is_copy, match_def_path, paths, span_note_and_lint};
use crate::utils::{is_copy, match_def_path, paths, qpath_res, span_note_and_lint};
use if_chain::if_chain;
use rustc::hir::*;
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
@ -114,7 +114,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for DropForgetRef {
if let ExprKind::Call(ref path, ref args) = expr.node;
if let ExprKind::Path(ref qpath) = path.node;
if args.len() == 1;
if let Some(def_id) = cx.tables.qpath_res(qpath, path.hir_id).opt_def_id();
if let Some(def_id) = qpath_res(cx, qpath, path.hir_id).opt_def_id();
then {
let lint;
let msg;

View file

@ -1,6 +1,6 @@
use std::convert::TryFrom;
use crate::utils::{iter_input_pats, snippet, snippet_opt, span_lint, type_is_unsafe_function};
use crate::utils::{iter_input_pats, qpath_res, snippet, snippet_opt, span_lint, type_is_unsafe_function};
use matches::matches;
use rustc::hir;
use rustc::hir::def::Res;
@ -318,7 +318,7 @@ impl<'a, 'tcx> hir::intravisit::Visitor<'tcx> for DerefVisitor<'a, 'tcx> {
impl<'a, 'tcx> DerefVisitor<'a, 'tcx> {
fn check_arg(&self, ptr: &hir::Expr) {
if let hir::ExprKind::Path(ref qpath) = ptr.node {
if let Res::Local(id) = self.cx.tables.qpath_res(qpath, ptr.hir_id) {
if let Res::Local(id) = qpath_res(self.cx, qpath, ptr.hir_id) {
if self.ptrs.contains(&id) {
span_lint(
self.cx,

View file

@ -1,4 +1,4 @@
use crate::utils::{higher, snippet, span_lint_and_then};
use crate::utils::{higher, qpath_res, snippet, span_lint_and_then};
use if_chain::if_chain;
use rustc::hir;
use rustc::hir::def::Res;
@ -145,7 +145,7 @@ impl<'a, 'tcx> hir::intravisit::Visitor<'tcx> for UsedVisitor<'a, 'tcx> {
fn visit_expr(&mut self, expr: &'tcx hir::Expr) {
if_chain! {
if let hir::ExprKind::Path(ref qpath) = expr.node;
if let Res::Local(local_id) = self.cx.tables.qpath_res(qpath, expr.hir_id);
if let Res::Local(local_id) = qpath_res(self.cx, qpath, expr.hir_id);
if self.id == local_id;
then {
self.used = true;
@ -170,7 +170,7 @@ fn check_assign<'a, 'tcx>(
if let hir::StmtKind::Semi(ref expr) = expr.node;
if let hir::ExprKind::Assign(ref var, ref value) = expr.node;
if let hir::ExprKind::Path(ref qpath) = var.node;
if let Res::Local(local_id) = cx.tables.qpath_res(qpath, var.hir_id);
if let Res::Local(local_id) = qpath_res(cx, qpath, var.hir_id);
if decl == local_id;
then {
let mut v = UsedVisitor {

View file

@ -11,7 +11,7 @@ use rustc::{declare_lint_pass, declare_tool_lint};
// use rustc::middle::region::CodeExtent;
use crate::consts::{constant, Constant};
use crate::utils::usage::mutated_variables;
use crate::utils::{is_type_diagnostic_item, sext, sugg};
use crate::utils::{is_type_diagnostic_item, qpath_res, sext, sugg};
use rustc::middle::expr_use_visitor::*;
use rustc::middle::mem_categorization::cmt_;
use rustc::middle::mem_categorization::Categorization;
@ -754,7 +754,7 @@ fn same_var<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, expr: &Expr, var: HirId) -> bo
if let ExprKind::Path(ref qpath) = expr.node;
if let QPath::Resolved(None, ref path) = *qpath;
if path.segments.len() == 1;
if let Res::Local(local_id) = cx.tables.qpath_res(qpath, expr.hir_id);
if let Res::Local(local_id) = qpath_res(cx, qpath, expr.hir_id);
// our variable!
if local_id == var;
then {
@ -1618,7 +1618,7 @@ fn check_for_mutability(cx: &LateContext<'_, '_>, bound: &Expr) -> Option<HirId>
if let ExprKind::Path(ref qpath) = bound.node;
if let QPath::Resolved(None, _) = *qpath;
then {
let res = cx.tables.qpath_res(qpath, bound.hir_id);
let res = qpath_res(cx, qpath, bound.hir_id);
if let Res::Local(node_id) = res {
let node_str = cx.tcx.hir().get(node_id);
if_chain! {
@ -1762,7 +1762,7 @@ impl<'a, 'tcx> VarVisitor<'a, 'tcx> {
if self.prefer_mutable {
self.indexed_mut.insert(seqvar.segments[0].ident.name);
}
let res = self.cx.tables.qpath_res(seqpath, seqexpr.hir_id);
let res = qpath_res(self.cx, seqpath, seqexpr.hir_id);
match res {
Res::Local(hir_id) => {
let parent_id = self.cx.tcx.hir().get_parent_item(expr.hir_id);
@ -1824,7 +1824,7 @@ impl<'a, 'tcx> Visitor<'tcx> for VarVisitor<'a, 'tcx> {
if let QPath::Resolved(None, ref path) = *qpath;
if path.segments.len() == 1;
then {
if let Res::Local(local_id) = self.cx.tables.qpath_res(qpath, expr.hir_id) {
if let Res::Local(local_id) = qpath_res(self.cx, qpath, expr.hir_id) {
if local_id == self.var {
self.nonindex = true;
} else {
@ -2163,7 +2163,7 @@ impl<'a, 'tcx> Visitor<'tcx> for InitializeVisitor<'a, 'tcx> {
fn var_def_id(cx: &LateContext<'_, '_>, expr: &Expr) -> Option<HirId> {
if let ExprKind::Path(ref qpath) = expr.node {
let path_res = cx.tables.qpath_res(qpath, expr.hir_id);
let path_res = qpath_res(cx, qpath, expr.hir_id);
if let Res::Local(node_id) = path_res {
return Some(node_id);
}
@ -2355,7 +2355,7 @@ impl<'a, 'tcx> VarCollectorVisitor<'a, 'tcx> {
if_chain! {
if let ExprKind::Path(ref qpath) = ex.node;
if let QPath::Resolved(None, _) = *qpath;
let res = self.cx.tables.qpath_res(qpath, ex.hir_id);
let res = qpath_res(self.cx, qpath, ex.hir_id);
then {
match res {
Res::Local(node_id) => {

View file

@ -1,4 +1,4 @@
use crate::utils::{match_def_path, paths, span_lint};
use crate::utils::{match_def_path, paths, qpath_res, span_lint};
use rustc::hir::{Expr, ExprKind};
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
use rustc::{declare_lint_pass, declare_tool_lint};
@ -29,7 +29,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MemForget {
fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, e: &'tcx Expr) {
if let ExprKind::Call(ref path_expr, ref args) = e.node {
if let ExprKind::Path(ref qpath) = path_expr.node {
if let Some(def_id) = cx.tables.qpath_res(qpath, path_expr.hir_id).opt_def_id() {
if let Some(def_id) = qpath_res(cx, qpath, path_expr.hir_id).opt_def_id() {
if match_def_path(cx, def_id, &paths::MEM_FORGET) {
let forgot_ty = cx.tables.expr_ty(&args[0]);

View file

@ -1,4 +1,4 @@
use crate::utils::{has_drop, snippet_opt, span_lint, span_lint_and_sugg};
use crate::utils::{has_drop, qpath_res, snippet_opt, span_lint, span_lint_and_sugg};
use rustc::hir::def::{DefKind, Res};
use rustc::hir::{BinOpKind, BlockCheckMode, Expr, ExprKind, Stmt, StmtKind, UnsafeSource};
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
@ -67,7 +67,7 @@ fn has_no_effect(cx: &LateContext<'_, '_>, expr: &Expr) -> bool {
},
ExprKind::Call(ref callee, ref args) => {
if let ExprKind::Path(ref qpath) = callee.node {
let res = cx.tables.qpath_res(qpath, callee.hir_id);
let res = qpath_res(cx, qpath, callee.hir_id);
match res {
Res::Def(DefKind::Struct, ..) | Res::Def(DefKind::Variant, ..) | Res::Def(DefKind::Ctor(..), _) => {
!has_drop(cx, cx.tables.expr_ty(expr)) && args.iter().all(|arg| has_no_effect(cx, arg))
@ -145,7 +145,7 @@ fn reduce_expression<'a>(cx: &LateContext<'_, '_>, expr: &'a Expr) -> Option<Vec
},
ExprKind::Call(ref callee, ref args) => {
if let ExprKind::Path(ref qpath) = callee.node {
let res = cx.tables.qpath_res(qpath, callee.hir_id);
let res = qpath_res(cx, qpath, callee.hir_id);
match res {
Res::Def(DefKind::Struct, ..) | Res::Def(DefKind::Variant, ..) | Res::Def(DefKind::Ctor(..), _)
if !has_drop(cx, cx.tables.expr_ty(expr)) =>

View file

@ -14,7 +14,7 @@ use rustc_errors::Applicability;
use rustc_typeck::hir_ty_to_ty;
use syntax_pos::{InnerSpan, Span, DUMMY_SP};
use crate::utils::{in_constant, is_copy, span_lint_and_then};
use crate::utils::{in_constant, is_copy, qpath_res, span_lint_and_then};
declare_clippy_lint! {
/// **What it does:** Checks for declaration of `const` items which is interior
@ -195,7 +195,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NonCopyConst {
}
// Make sure it is a const item.
match cx.tables.qpath_res(qpath, expr.hir_id) {
match qpath_res(cx, qpath, expr.hir_id) {
Res::Def(DefKind::Const, _) | Res::Def(DefKind::AssocConst, _) => {},
_ => return,
};

View file

@ -24,7 +24,7 @@ use crate::consts::{constant, Constant};
use crate::utils::paths;
use crate::utils::{
clip, comparisons, differing_macro_contexts, higher, in_constant, int_bits, last_path_segment, match_def_path,
match_path, multispan_sugg, same_tys, sext, snippet, snippet_opt, snippet_with_applicability,
match_path, multispan_sugg, qpath_res, same_tys, sext, snippet, snippet_opt, snippet_with_applicability,
snippet_with_macro_callsite, span_help_and_lint, span_lint, span_lint_and_sugg, span_lint_and_then, unsext,
};
@ -218,7 +218,7 @@ fn match_type_parameter(cx: &LateContext<'_, '_>, qpath: &QPath, path: &[&str])
_ => None,
});
if let TyKind::Path(ref qpath) = ty.node;
if let Some(did) = cx.tables.qpath_res(qpath, ty.hir_id).opt_def_id();
if let Some(did) = qpath_res(cx, qpath, ty.hir_id).opt_def_id();
if match_def_path(cx, did, path);
then {
return true;
@ -240,7 +240,7 @@ fn check_ty(cx: &LateContext<'_, '_>, hir_ty: &hir::Ty, is_local: bool) {
match hir_ty.node {
TyKind::Path(ref qpath) if !is_local => {
let hir_id = hir_ty.hir_id;
let res = cx.tables.qpath_res(qpath, hir_id);
let res = qpath_res(cx, qpath, hir_id);
if let Some(def_id) = res.opt_def_id() {
if Some(def_id) == cx.tcx.lang_items().owned_box() {
if match_type_parameter(cx, qpath, &paths::VEC) {
@ -263,7 +263,7 @@ fn check_ty(cx: &LateContext<'_, '_>, hir_ty: &hir::Ty, is_local: bool) {
});
// ty is now _ at this point
if let TyKind::Path(ref ty_qpath) = ty.node;
let res = cx.tables.qpath_res(ty_qpath, ty.hir_id);
let res = qpath_res(cx, ty_qpath, ty.hir_id);
if let Some(def_id) = res.opt_def_id();
if Some(def_id) == cx.tcx.lang_items().owned_box();
// At this point, we know ty is Box<T>, now get T
@ -369,7 +369,7 @@ fn check_ty_rptr(cx: &LateContext<'_, '_>, hir_ty: &hir::Ty, is_local: bool, lt:
match mut_ty.ty.node {
TyKind::Path(ref qpath) => {
let hir_id = mut_ty.ty.hir_id;
let def = cx.tables.qpath_res(qpath, hir_id);
let def = qpath_res(cx, qpath, hir_id);
if_chain! {
if let Some(def_id) = def.opt_def_id();
if Some(def_id) == cx.tcx.lang_items().owned_box();

View file

@ -273,6 +273,19 @@ pub fn path_to_res(cx: &LateContext<'_, '_>, path: &[&str]) -> Option<(def::Res)
}
}
pub fn qpath_res(cx: &LateContext<'_, '_>, qpath: &hir::QPath, id: hir::HirId) -> Res {
match qpath {
hir::QPath::Resolved(_, path) => path.res,
hir::QPath::TypeRelative(..) => {
if cx.tcx.has_typeck_tables(id.owner_def_id()) {
cx.tcx.typeck_tables_of(id.owner_def_id()).qpath_res(qpath, id)
} else {
Res::Err
}
},
}
}
/// Convenience function to get the `DefId` of a trait by path.
/// It could be a trait or trait alias.
pub fn get_trait_def_id(cx: &LateContext<'_, '_>, path: &[&str]) -> Option<DefId> {

View file

@ -12,4 +12,3 @@ fn repro() {
fn main() {
repro();
}

View file

@ -1,4 +1,3 @@
#![feature(const_string_new, const_vec_new)]
#![allow(clippy::ref_in_deref, dead_code)]
use std::borrow::Cow;

View file

@ -1,5 +1,5 @@
error: a const item should never be interior mutable
--> $DIR/non_copy_const.rs:10:1
--> $DIR/non_copy_const.rs:9:1
|
LL | const ATOMIC: AtomicUsize = AtomicUsize::new(5); //~ ERROR interior mutable
| -----^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -9,7 +9,7 @@ LL | const ATOMIC: AtomicUsize = AtomicUsize::new(5); //~ ERROR interior mutable
= note: `#[deny(clippy::declare_interior_mutable_const)]` on by default
error: a const item should never be interior mutable
--> $DIR/non_copy_const.rs:11:1
--> $DIR/non_copy_const.rs:10:1
|
LL | const CELL: Cell<usize> = Cell::new(6); //~ ERROR interior mutable
| -----^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -17,7 +17,7 @@ LL | const CELL: Cell<usize> = Cell::new(6); //~ ERROR interior mutable
| help: make this a static item: `static`
error: a const item should never be interior mutable
--> $DIR/non_copy_const.rs:12:1
--> $DIR/non_copy_const.rs:11:1
|
LL | const ATOMIC_TUPLE: ([AtomicUsize; 1], Vec<AtomicUsize>, u8) = ([ATOMIC], Vec::new(), 7);
| -----^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -25,7 +25,7 @@ LL | const ATOMIC_TUPLE: ([AtomicUsize; 1], Vec<AtomicUsize>, u8) = ([ATOMIC], V
| help: make this a static item: `static`
error: a const item should never be interior mutable
--> $DIR/non_copy_const.rs:17:9
--> $DIR/non_copy_const.rs:16:9
|
LL | const $name: $ty = $e;
| ^^^^^^^^^^^^^^^^^^^^^^
@ -34,49 +34,49 @@ LL | declare_const!(_ONCE: Once = Once::new()); //~ ERROR interior mutable
| ------------------------------------------ in this macro invocation
error: a const item should never be interior mutable
--> $DIR/non_copy_const.rs:41:5
--> $DIR/non_copy_const.rs:40:5
|
LL | const ATOMIC: AtomicUsize; //~ ERROR interior mutable
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
error: a const item should never be interior mutable
--> $DIR/non_copy_const.rs:45:5
--> $DIR/non_copy_const.rs:44:5
|
LL | const INPUT: T;
| ^^^^^^^^^^^^^^^
|
help: consider requiring `T` to be `Copy`
--> $DIR/non_copy_const.rs:45:18
--> $DIR/non_copy_const.rs:44:18
|
LL | const INPUT: T;
| ^
error: a const item should never be interior mutable
--> $DIR/non_copy_const.rs:48:5
--> $DIR/non_copy_const.rs:47:5
|
LL | const ASSOC: Self::NonCopyType;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: consider requiring `<Self as Trait<T>>::NonCopyType` to be `Copy`
--> $DIR/non_copy_const.rs:48:18
--> $DIR/non_copy_const.rs:47:18
|
LL | const ASSOC: Self::NonCopyType;
| ^^^^^^^^^^^^^^^^^
error: a const item should never be interior mutable
--> $DIR/non_copy_const.rs:52:5
--> $DIR/non_copy_const.rs:51:5
|
LL | const AN_INPUT: T = Self::INPUT;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: consider requiring `T` to be `Copy`
--> $DIR/non_copy_const.rs:52:21
--> $DIR/non_copy_const.rs:51:21
|
LL | const AN_INPUT: T = Self::INPUT;
| ^
error: a const item should never be interior mutable
--> $DIR/non_copy_const.rs:17:9
--> $DIR/non_copy_const.rs:16:9
|
LL | const $name: $ty = $e;
| ^^^^^^^^^^^^^^^^^^^^^^
@ -85,49 +85,49 @@ LL | declare_const!(ANOTHER_INPUT: T = Self::INPUT); //~ ERROR interior muta
| ----------------------------------------------- in this macro invocation
error: a const item should never be interior mutable
--> $DIR/non_copy_const.rs:61:5
--> $DIR/non_copy_const.rs:60:5
|
LL | const SELF_2: Self;
| ^^^^^^^^^^^^^^^^^^^
|
help: consider requiring `Self` to be `Copy`
--> $DIR/non_copy_const.rs:61:19
--> $DIR/non_copy_const.rs:60:19
|
LL | const SELF_2: Self;
| ^^^^
error: a const item should never be interior mutable
--> $DIR/non_copy_const.rs:82:5
--> $DIR/non_copy_const.rs:81:5
|
LL | const ASSOC_3: AtomicUsize = AtomicUsize::new(14); //~ ERROR interior mutable
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: a const item should never be interior mutable
--> $DIR/non_copy_const.rs:85:5
--> $DIR/non_copy_const.rs:84:5
|
LL | const U_SELF: U = U::SELF_2;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: consider requiring `U` to be `Copy`
--> $DIR/non_copy_const.rs:85:19
--> $DIR/non_copy_const.rs:84:19
|
LL | const U_SELF: U = U::SELF_2;
| ^
error: a const item should never be interior mutable
--> $DIR/non_copy_const.rs:88:5
--> $DIR/non_copy_const.rs:87:5
|
LL | const T_ASSOC: T::NonCopyType = T::ASSOC;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: consider requiring `<T as Trait<u32>>::NonCopyType` to be `Copy`
--> $DIR/non_copy_const.rs:88:20
--> $DIR/non_copy_const.rs:87:20
|
LL | const T_ASSOC: T::NonCopyType = T::ASSOC;
| ^^^^^^^^^^^^^^
error: a const item with interior mutability should not be borrowed
--> $DIR/non_copy_const.rs:95:5
--> $DIR/non_copy_const.rs:94:5
|
LL | ATOMIC.store(1, Ordering::SeqCst); //~ ERROR interior mutability
| ^^^^^^
@ -136,7 +136,7 @@ LL | ATOMIC.store(1, Ordering::SeqCst); //~ ERROR interior mutability
= help: assign this const to a local or static variable, and use the variable here
error: a const item with interior mutability should not be borrowed
--> $DIR/non_copy_const.rs:96:16
--> $DIR/non_copy_const.rs:95:16
|
LL | assert_eq!(ATOMIC.load(Ordering::SeqCst), 5); //~ ERROR interior mutability
| ^^^^^^
@ -144,7 +144,7 @@ LL | assert_eq!(ATOMIC.load(Ordering::SeqCst), 5); //~ ERROR interior mutabi
= help: assign this const to a local or static variable, and use the variable here
error: a const item with interior mutability should not be borrowed
--> $DIR/non_copy_const.rs:99:22
--> $DIR/non_copy_const.rs:98:22
|
LL | let _once_ref = &ONCE_INIT; //~ ERROR interior mutability
| ^^^^^^^^^
@ -152,7 +152,7 @@ LL | let _once_ref = &ONCE_INIT; //~ ERROR interior mutability
= help: assign this const to a local or static variable, and use the variable here
error: a const item with interior mutability should not be borrowed
--> $DIR/non_copy_const.rs:100:25
--> $DIR/non_copy_const.rs:99:25
|
LL | let _once_ref_2 = &&ONCE_INIT; //~ ERROR interior mutability
| ^^^^^^^^^
@ -160,7 +160,7 @@ LL | let _once_ref_2 = &&ONCE_INIT; //~ ERROR interior mutability
= help: assign this const to a local or static variable, and use the variable here
error: a const item with interior mutability should not be borrowed
--> $DIR/non_copy_const.rs:101:27
--> $DIR/non_copy_const.rs:100:27
|
LL | let _once_ref_4 = &&&&ONCE_INIT; //~ ERROR interior mutability
| ^^^^^^^^^
@ -168,7 +168,7 @@ LL | let _once_ref_4 = &&&&ONCE_INIT; //~ ERROR interior mutability
= help: assign this const to a local or static variable, and use the variable here
error: a const item with interior mutability should not be borrowed
--> $DIR/non_copy_const.rs:102:26
--> $DIR/non_copy_const.rs:101:26
|
LL | let _once_mut = &mut ONCE_INIT; //~ ERROR interior mutability
| ^^^^^^^^^
@ -176,7 +176,7 @@ LL | let _once_mut = &mut ONCE_INIT; //~ ERROR interior mutability
= help: assign this const to a local or static variable, and use the variable here
error: a const item with interior mutability should not be borrowed
--> $DIR/non_copy_const.rs:113:14
--> $DIR/non_copy_const.rs:112:14
|
LL | let _ = &ATOMIC_TUPLE; //~ ERROR interior mutability
| ^^^^^^^^^^^^
@ -184,7 +184,7 @@ LL | let _ = &ATOMIC_TUPLE; //~ ERROR interior mutability
= help: assign this const to a local or static variable, and use the variable here
error: a const item with interior mutability should not be borrowed
--> $DIR/non_copy_const.rs:114:14
--> $DIR/non_copy_const.rs:113:14
|
LL | let _ = &ATOMIC_TUPLE.0; //~ ERROR interior mutability
| ^^^^^^^^^^^^
@ -192,7 +192,7 @@ LL | let _ = &ATOMIC_TUPLE.0; //~ ERROR interior mutability
= help: assign this const to a local or static variable, and use the variable here
error: a const item with interior mutability should not be borrowed
--> $DIR/non_copy_const.rs:115:19
--> $DIR/non_copy_const.rs:114:19
|
LL | let _ = &(&&&&ATOMIC_TUPLE).0; //~ ERROR interior mutability
| ^^^^^^^^^^^^
@ -200,7 +200,7 @@ LL | let _ = &(&&&&ATOMIC_TUPLE).0; //~ ERROR interior mutability
= help: assign this const to a local or static variable, and use the variable here
error: a const item with interior mutability should not be borrowed
--> $DIR/non_copy_const.rs:116:14
--> $DIR/non_copy_const.rs:115:14
|
LL | let _ = &ATOMIC_TUPLE.0[0]; //~ ERROR interior mutability
| ^^^^^^^^^^^^
@ -208,7 +208,7 @@ LL | let _ = &ATOMIC_TUPLE.0[0]; //~ ERROR interior mutability
= help: assign this const to a local or static variable, and use the variable here
error: a const item with interior mutability should not be borrowed
--> $DIR/non_copy_const.rs:117:13
--> $DIR/non_copy_const.rs:116:13
|
LL | let _ = ATOMIC_TUPLE.0[0].load(Ordering::SeqCst); //~ ERROR interior mutability
| ^^^^^^^^^^^^
@ -216,7 +216,7 @@ LL | let _ = ATOMIC_TUPLE.0[0].load(Ordering::SeqCst); //~ ERROR interior mu
= help: assign this const to a local or static variable, and use the variable here
error: a const item with interior mutability should not be borrowed
--> $DIR/non_copy_const.rs:123:13
--> $DIR/non_copy_const.rs:122:13
|
LL | let _ = ATOMIC_TUPLE.0[0]; //~ ERROR interior mutability
| ^^^^^^^^^^^^
@ -224,7 +224,7 @@ LL | let _ = ATOMIC_TUPLE.0[0]; //~ ERROR interior mutability
= help: assign this const to a local or static variable, and use the variable here
error: a const item with interior mutability should not be borrowed
--> $DIR/non_copy_const.rs:128:5
--> $DIR/non_copy_const.rs:127:5
|
LL | CELL.set(2); //~ ERROR interior mutability
| ^^^^
@ -232,7 +232,7 @@ LL | CELL.set(2); //~ ERROR interior mutability
= help: assign this const to a local or static variable, and use the variable here
error: a const item with interior mutability should not be borrowed
--> $DIR/non_copy_const.rs:129:16
--> $DIR/non_copy_const.rs:128:16
|
LL | assert_eq!(CELL.get(), 6); //~ ERROR interior mutability
| ^^^^
@ -240,7 +240,7 @@ LL | assert_eq!(CELL.get(), 6); //~ ERROR interior mutability
= help: assign this const to a local or static variable, and use the variable here
error: a const item with interior mutability should not be borrowed
--> $DIR/non_copy_const.rs:142:5
--> $DIR/non_copy_const.rs:141:5
|
LL | u64::ATOMIC.store(5, Ordering::SeqCst); //~ ERROR interior mutability
| ^^^^^^^^^^^
@ -248,7 +248,7 @@ LL | u64::ATOMIC.store(5, Ordering::SeqCst); //~ ERROR interior mutability
= help: assign this const to a local or static variable, and use the variable here
error: a const item with interior mutability should not be borrowed
--> $DIR/non_copy_const.rs:143:16
--> $DIR/non_copy_const.rs:142:16
|
LL | assert_eq!(u64::ATOMIC.load(Ordering::SeqCst), 9); //~ ERROR interior mutability
| ^^^^^^^^^^^