]> git.lizzy.rs Git - rust.git/blobdiff - tests/ui/non_copy_const.rs
Auto merge of #3603 - xfix:random-state-lint, r=phansch
[rust.git] / tests / ui / non_copy_const.rs
index 4e086333b0ca5262cec15570c6a404cd05d1ba6e..591e1994ee3e10315c8b84f75e2273bf3e78fa1b 100644 (file)
@@ -1,13 +1,20 @@
-#![feature(tool_lints)]
+// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
 
 #![feature(const_string_new, const_vec_new)]
 #![allow(clippy::ref_in_deref, dead_code)]
 
-use std::sync::atomic::{ATOMIC_USIZE_INIT, AtomicUsize, Ordering};
-use std::cell::Cell;
-use std::sync::Once;
 use std::borrow::Cow;
+use std::cell::Cell;
 use std::fmt::Display;
+use std::sync::atomic::{AtomicUsize, Ordering, ATOMIC_USIZE_INIT};
+use std::sync::Once;
 
 const ATOMIC: AtomicUsize = AtomicUsize::new(5); //~ ERROR interior mutable
 const CELL: Cell<usize> = Cell::new(6); //~ ERROR interior mutable
@@ -15,7 +22,9 @@
 //~^ ERROR interior mutable
 
 macro_rules! declare_const {
-    ($name:ident: $ty:ty = $e:expr) => { const $name: $ty = $e; };
+    ($name:ident: $ty:ty = $e:expr) => {
+        const $name: $ty = $e;
+    };
 }
 declare_const!(_ONCE: Once = Once::new()); //~ ERROR interior mutable
 
@@ -126,7 +135,7 @@ fn main() {
     let _ = ATOMIC_TUPLE.0[0]; //~ ERROR interior mutability
     let _ = ATOMIC_TUPLE.1.into_iter();
     let _ = ATOMIC_TUPLE.2;
-    let _ = &{ATOMIC_TUPLE};
+    let _ = &{ ATOMIC_TUPLE };
 
     CELL.set(2); //~ ERROR interior mutability
     assert_eq!(CELL.get(), 6); //~ ERROR interior mutability