]> git.lizzy.rs Git - rust.git/blobdiff - tests/ui/non_copy_const.rs
Auto merge of #4478 - tsurai:master, r=flip1995
[rust.git] / tests / ui / non_copy_const.rs
index 591e1994ee3e10315c8b84f75e2273bf3e78fa1b..46cbb3fee35abeaa59a0ea42a19403abb1d3fdea 100644 (file)
@@ -1,19 +1,10 @@
-// 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::borrow::Cow;
 use std::cell::Cell;
 use std::fmt::Display;
-use std::sync::atomic::{AtomicUsize, Ordering, ATOMIC_USIZE_INIT};
+use std::sync::atomic::{AtomicUsize, Ordering};
 use std::sync::Once;
 
 const ATOMIC: AtomicUsize = AtomicUsize::new(5); //~ ERROR interior mutable
@@ -36,7 +27,7 @@ macro_rules! declare_const {
 const COW: Cow<str> = Cow::Borrowed("abcdef");
 //^ note: a const item of Cow is used in the `postgres` package.
 
-const NO_ANN: &Display = &70;
+const NO_ANN: &dyn Display = &70;
 
 static STATIC_TUPLE: (AtomicUsize, String) = (ATOMIC, STRING);
 //^ there should be no lints on this line
@@ -104,9 +95,6 @@ fn main() {
     ATOMIC.store(1, Ordering::SeqCst); //~ ERROR interior mutability
     assert_eq!(ATOMIC.load(Ordering::SeqCst), 5); //~ ERROR interior mutability
 
-    ATOMIC_USIZE_INIT.store(2, Ordering::SeqCst); //~ ERROR interior mutability
-    assert_eq!(ATOMIC_USIZE_INIT.load(Ordering::SeqCst), 0); //~ ERROR interior mutability
-
     let _once = ONCE_INIT;
     let _once_ref = &ONCE_INIT; //~ ERROR interior mutability
     let _once_ref_2 = &&ONCE_INIT; //~ ERROR interior mutability