From 64d98f8ee037282c35007b64c2649055c56af1db Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:19:03 +0200 Subject: Merging upstream version 1.68.2+dfsg1. Signed-off-by: Daniel Baumann --- src/test/ui/static/auxiliary/extern-statics.rs | 4 - src/test/ui/static/auxiliary/issue_24843.rs | 1 - src/test/ui/static/auxiliary/nested_item.rs | 30 -------- .../ui/static/auxiliary/static-priv-by-default.rs | 27 ------- .../ui/static/auxiliary/static_priv_by_default.rs | 51 ------------- src/test/ui/static/bad-const-type.rs | 4 - src/test/ui/static/bad-const-type.stderr | 11 --- src/test/ui/static/issue-24843.rs | 8 -- src/test/ui/static/issue-34194.rs | 11 --- src/test/ui/static/issue-5216.rs | 10 --- src/test/ui/static/issue-5216.stderr | 28 ------- src/test/ui/static/nested_item_main.rs | 10 --- .../ui/static/refer-to-other-statics-by-value.rs | 8 -- .../ui/static/safe-extern-statics-mut.mir.stderr | 35 --------- src/test/ui/static/safe-extern-statics-mut.rs | 17 ----- .../ui/static/safe-extern-statics-mut.thir.stderr | 35 --------- src/test/ui/static/safe-extern-statics.mir.stderr | 35 --------- src/test/ui/static/safe-extern-statics.rs | 17 ----- src/test/ui/static/safe-extern-statics.thir.stderr | 35 --------- src/test/ui/static/static-closures.rs | 4 - src/test/ui/static/static-closures.stderr | 9 --- src/test/ui/static/static-drop-scope.rs | 37 --------- src/test/ui/static/static-drop-scope.stderr | 89 ---------------------- src/test/ui/static/static-extern-type.rs | 27 ------- src/test/ui/static/static-items-cant-move.rs | 19 ----- src/test/ui/static/static-items-cant-move.stderr | 9 --- src/test/ui/static/static-lifetime-bound.rs | 6 -- src/test/ui/static/static-lifetime-bound.stderr | 22 ------ src/test/ui/static/static-lifetime.rs | 6 -- src/test/ui/static/static-lifetime.stderr | 16 ---- src/test/ui/static/static-method-privacy.rs | 10 --- src/test/ui/static/static-method-privacy.stderr | 12 --- src/test/ui/static/static-mut-bad-types.rs | 7 -- src/test/ui/static/static-mut-bad-types.stderr | 12 --- .../static-mut-foreign-requires-unsafe.mir.stderr | 27 ------- .../static/static-mut-foreign-requires-unsafe.rs | 12 --- .../static-mut-foreign-requires-unsafe.thir.stderr | 27 ------- src/test/ui/static/static-mut-not-constant.rs | 6 -- src/test/ui/static/static-mut-not-constant.stderr | 9 --- src/test/ui/static/static-mut-not-pat.rs | 43 ----------- src/test/ui/static/static-mut-not-pat.stderr | 21 ----- .../static/static-mut-requires-unsafe.mir.stderr | 27 ------- src/test/ui/static/static-mut-requires-unsafe.rs | 10 --- .../static/static-mut-requires-unsafe.thir.stderr | 27 ------- src/test/ui/static/static-priv-by-default2.rs | 30 -------- src/test/ui/static/static-priv-by-default2.stderr | 27 ------- src/test/ui/static/static-reference-to-fn-1.rs | 24 ------ src/test/ui/static/static-reference-to-fn-1.stderr | 12 --- src/test/ui/static/static-reference-to-fn-2.rs | 54 ------------- src/test/ui/static/static-reference-to-fn-2.stderr | 49 ------------ src/test/ui/static/static-region-bound.rs | 12 --- src/test/ui/static/static-region-bound.stderr | 13 ---- .../ui/static/static-vec-repeat-not-constant.rs | 6 -- .../static/static-vec-repeat-not-constant.stderr | 12 --- src/test/ui/static/static_sized_requirement.rs | 12 --- src/test/ui/static/thread-local-in-ctfe.rs | 23 ------ src/test/ui/static/thread-local-in-ctfe.stderr | 33 -------- 57 files changed, 1178 deletions(-) delete mode 100644 src/test/ui/static/auxiliary/extern-statics.rs delete mode 100644 src/test/ui/static/auxiliary/issue_24843.rs delete mode 100644 src/test/ui/static/auxiliary/nested_item.rs delete mode 100644 src/test/ui/static/auxiliary/static-priv-by-default.rs delete mode 100644 src/test/ui/static/auxiliary/static_priv_by_default.rs delete mode 100644 src/test/ui/static/bad-const-type.rs delete mode 100644 src/test/ui/static/bad-const-type.stderr delete mode 100644 src/test/ui/static/issue-24843.rs delete mode 100644 src/test/ui/static/issue-34194.rs delete mode 100644 src/test/ui/static/issue-5216.rs delete mode 100644 src/test/ui/static/issue-5216.stderr delete mode 100644 src/test/ui/static/nested_item_main.rs delete mode 100644 src/test/ui/static/refer-to-other-statics-by-value.rs delete mode 100644 src/test/ui/static/safe-extern-statics-mut.mir.stderr delete mode 100644 src/test/ui/static/safe-extern-statics-mut.rs delete mode 100644 src/test/ui/static/safe-extern-statics-mut.thir.stderr delete mode 100644 src/test/ui/static/safe-extern-statics.mir.stderr delete mode 100644 src/test/ui/static/safe-extern-statics.rs delete mode 100644 src/test/ui/static/safe-extern-statics.thir.stderr delete mode 100644 src/test/ui/static/static-closures.rs delete mode 100644 src/test/ui/static/static-closures.stderr delete mode 100644 src/test/ui/static/static-drop-scope.rs delete mode 100644 src/test/ui/static/static-drop-scope.stderr delete mode 100644 src/test/ui/static/static-extern-type.rs delete mode 100644 src/test/ui/static/static-items-cant-move.rs delete mode 100644 src/test/ui/static/static-items-cant-move.stderr delete mode 100644 src/test/ui/static/static-lifetime-bound.rs delete mode 100644 src/test/ui/static/static-lifetime-bound.stderr delete mode 100644 src/test/ui/static/static-lifetime.rs delete mode 100644 src/test/ui/static/static-lifetime.stderr delete mode 100644 src/test/ui/static/static-method-privacy.rs delete mode 100644 src/test/ui/static/static-method-privacy.stderr delete mode 100644 src/test/ui/static/static-mut-bad-types.rs delete mode 100644 src/test/ui/static/static-mut-bad-types.stderr delete mode 100644 src/test/ui/static/static-mut-foreign-requires-unsafe.mir.stderr delete mode 100644 src/test/ui/static/static-mut-foreign-requires-unsafe.rs delete mode 100644 src/test/ui/static/static-mut-foreign-requires-unsafe.thir.stderr delete mode 100644 src/test/ui/static/static-mut-not-constant.rs delete mode 100644 src/test/ui/static/static-mut-not-constant.stderr delete mode 100644 src/test/ui/static/static-mut-not-pat.rs delete mode 100644 src/test/ui/static/static-mut-not-pat.stderr delete mode 100644 src/test/ui/static/static-mut-requires-unsafe.mir.stderr delete mode 100644 src/test/ui/static/static-mut-requires-unsafe.rs delete mode 100644 src/test/ui/static/static-mut-requires-unsafe.thir.stderr delete mode 100644 src/test/ui/static/static-priv-by-default2.rs delete mode 100644 src/test/ui/static/static-priv-by-default2.stderr delete mode 100644 src/test/ui/static/static-reference-to-fn-1.rs delete mode 100644 src/test/ui/static/static-reference-to-fn-1.stderr delete mode 100644 src/test/ui/static/static-reference-to-fn-2.rs delete mode 100644 src/test/ui/static/static-reference-to-fn-2.stderr delete mode 100644 src/test/ui/static/static-region-bound.rs delete mode 100644 src/test/ui/static/static-region-bound.stderr delete mode 100644 src/test/ui/static/static-vec-repeat-not-constant.rs delete mode 100644 src/test/ui/static/static-vec-repeat-not-constant.stderr delete mode 100644 src/test/ui/static/static_sized_requirement.rs delete mode 100644 src/test/ui/static/thread-local-in-ctfe.rs delete mode 100644 src/test/ui/static/thread-local-in-ctfe.stderr (limited to 'src/test/ui/static') diff --git a/src/test/ui/static/auxiliary/extern-statics.rs b/src/test/ui/static/auxiliary/extern-statics.rs deleted file mode 100644 index c090bc79f..000000000 --- a/src/test/ui/static/auxiliary/extern-statics.rs +++ /dev/null @@ -1,4 +0,0 @@ -extern "C" { - pub static XA: u8; - pub static mut XB: u8; -} diff --git a/src/test/ui/static/auxiliary/issue_24843.rs b/src/test/ui/static/auxiliary/issue_24843.rs deleted file mode 100644 index 6ca04f860..000000000 --- a/src/test/ui/static/auxiliary/issue_24843.rs +++ /dev/null @@ -1 +0,0 @@ -pub static TEST_STR: &'static str = "Hello world"; diff --git a/src/test/ui/static/auxiliary/nested_item.rs b/src/test/ui/static/auxiliary/nested_item.rs deleted file mode 100644 index 9db9d19d6..000000000 --- a/src/test/ui/static/auxiliary/nested_item.rs +++ /dev/null @@ -1,30 +0,0 @@ -// original problem -pub fn foo() -> isize { - { - static foo: isize = 2; - foo - } -} - -// issue 8134 -struct Foo; -impl Foo { - pub fn foo(&self) { - static X: usize = 1; - } -} - -// issue 8134 -pub struct Parser(T); -impl> Parser { - fn in_doctype(&mut self) { - static DOCTYPEPattern: [char; 6] = ['O', 'C', 'T', 'Y', 'P', 'E']; - } -} - -struct Bar; -impl Foo { - pub fn bar(&self) { - static X: usize = 1; - } -} diff --git a/src/test/ui/static/auxiliary/static-priv-by-default.rs b/src/test/ui/static/auxiliary/static-priv-by-default.rs deleted file mode 100644 index 41f368f46..000000000 --- a/src/test/ui/static/auxiliary/static-priv-by-default.rs +++ /dev/null @@ -1,27 +0,0 @@ -// aux-build:static_priv_by_default.rs - -extern crate static_priv_by_default; - -mod child { - pub mod childs_child { - static private: isize = 0; - pub static public: isize = 0; - } -} - -fn foo(_: isize) {} - -fn full_ref() { - foo(static_priv_by_default::private); //~ ERROR: static `private` is private - foo(static_priv_by_default::public); - foo(child::childs_child::private); //~ ERROR: static `private` is private - foo(child::childs_child::public); -} - -fn medium_ref() { - use child::childs_child; - foo(childs_child::private); //~ ERROR: static `private` is private - foo(childs_child::public); -} - -fn main() {} diff --git a/src/test/ui/static/auxiliary/static_priv_by_default.rs b/src/test/ui/static/auxiliary/static_priv_by_default.rs deleted file mode 100644 index 39f912066..000000000 --- a/src/test/ui/static/auxiliary/static_priv_by_default.rs +++ /dev/null @@ -1,51 +0,0 @@ -#![crate_type = "lib"] - -static private: isize = 0; -pub static public: isize = 0; - -pub struct A(()); - -impl A { - fn foo() {} -} - -mod foo { - pub static a: isize = 0; - pub fn b() {} - pub struct c; - pub enum d {} - pub type e = isize; - - pub struct A(()); - - impl A { - fn foo() {} - } - - // these are public so the parent can re-export them. - pub static reexported_a: isize = 0; - pub fn reexported_b() {} - pub struct reexported_c; - pub enum reexported_d {} - pub type reexported_e = isize; -} - -pub mod bar { - pub use foo::reexported_a as e; - pub use foo::reexported_b as f; - pub use foo::reexported_c as g; - pub use foo::reexported_d as h; - pub use foo::reexported_e as i; -} - -pub static a: isize = 0; -pub fn b() {} -pub struct c; -pub enum d {} -pub type e = isize; - -static j: isize = 0; -fn k() {} -struct l; -enum m {} -type n = isize; diff --git a/src/test/ui/static/bad-const-type.rs b/src/test/ui/static/bad-const-type.rs deleted file mode 100644 index 934ee353d..000000000 --- a/src/test/ui/static/bad-const-type.rs +++ /dev/null @@ -1,4 +0,0 @@ -static i: String = 10; -//~^ ERROR mismatched types -//~| expected struct `String`, found integer -fn main() { println!("{}", i); } diff --git a/src/test/ui/static/bad-const-type.stderr b/src/test/ui/static/bad-const-type.stderr deleted file mode 100644 index dcc1ee07c..000000000 --- a/src/test/ui/static/bad-const-type.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0308]: mismatched types - --> $DIR/bad-const-type.rs:1:20 - | -LL | static i: String = 10; - | ^^- help: try using a conversion method: `.to_string()` - | | - | expected struct `String`, found integer - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/static/issue-24843.rs b/src/test/ui/static/issue-24843.rs deleted file mode 100644 index 0b3397e21..000000000 --- a/src/test/ui/static/issue-24843.rs +++ /dev/null @@ -1,8 +0,0 @@ -// aux-build: issue_24843.rs -// check-pass - -extern crate issue_24843; - -static _TEST_STR_2: &'static str = &issue_24843::TEST_STR; - -fn main() {} diff --git a/src/test/ui/static/issue-34194.rs b/src/test/ui/static/issue-34194.rs deleted file mode 100644 index 6dce556e9..000000000 --- a/src/test/ui/static/issue-34194.rs +++ /dev/null @@ -1,11 +0,0 @@ -// build-pass -#![allow(dead_code)] - -struct A { - a: &'static (), -} - -static B: &'static A = &A { a: &() }; -static C: &'static A = &B; - -fn main() {} diff --git a/src/test/ui/static/issue-5216.rs b/src/test/ui/static/issue-5216.rs deleted file mode 100644 index 4072a57cb..000000000 --- a/src/test/ui/static/issue-5216.rs +++ /dev/null @@ -1,10 +0,0 @@ -fn f() { } -struct S(Box); -pub static C: S = S(f); //~ ERROR mismatched types - - -fn g() { } -type T = Box; -pub static D: T = g; //~ ERROR mismatched types - -fn main() {} diff --git a/src/test/ui/static/issue-5216.stderr b/src/test/ui/static/issue-5216.stderr deleted file mode 100644 index 1afff28f0..000000000 --- a/src/test/ui/static/issue-5216.stderr +++ /dev/null @@ -1,28 +0,0 @@ -error[E0308]: mismatched types - --> $DIR/issue-5216.rs:3:21 - | -LL | pub static C: S = S(f); - | - ^ expected struct `Box`, found fn item - | | - | arguments to this struct are incorrect - | - = note: expected struct `Box<(dyn FnMut() + Sync + 'static)>` - found fn item `fn() {f}` -note: tuple struct defined here - --> $DIR/issue-5216.rs:2:8 - | -LL | struct S(Box); - | ^ - -error[E0308]: mismatched types - --> $DIR/issue-5216.rs:8:19 - | -LL | pub static D: T = g; - | ^ expected struct `Box`, found fn item - | - = note: expected struct `Box<(dyn FnMut() + Sync + 'static)>` - found fn item `fn() {g}` - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/static/nested_item_main.rs b/src/test/ui/static/nested_item_main.rs deleted file mode 100644 index 2fe00aede..000000000 --- a/src/test/ui/static/nested_item_main.rs +++ /dev/null @@ -1,10 +0,0 @@ -// run-pass -// aux-build:nested_item.rs - - -extern crate nested_item; - -pub fn main() { - assert_eq!(2, nested_item::foo::<()>()); - assert_eq!(2, nested_item::foo::()); -} diff --git a/src/test/ui/static/refer-to-other-statics-by-value.rs b/src/test/ui/static/refer-to-other-statics-by-value.rs deleted file mode 100644 index 90f1980f8..000000000 --- a/src/test/ui/static/refer-to-other-statics-by-value.rs +++ /dev/null @@ -1,8 +0,0 @@ -// run-pass - -static A: usize = 42; -static B: usize = A; - -fn main() { - assert_eq!(B, 42); -} diff --git a/src/test/ui/static/safe-extern-statics-mut.mir.stderr b/src/test/ui/static/safe-extern-statics-mut.mir.stderr deleted file mode 100644 index cec5f9d9c..000000000 --- a/src/test/ui/static/safe-extern-statics-mut.mir.stderr +++ /dev/null @@ -1,35 +0,0 @@ -error[E0133]: use of mutable static is unsafe and requires unsafe function or block - --> $DIR/safe-extern-statics-mut.rs:13:13 - | -LL | let b = B; - | ^ use of mutable static - | - = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior - -error[E0133]: use of mutable static is unsafe and requires unsafe function or block - --> $DIR/safe-extern-statics-mut.rs:14:14 - | -LL | let rb = &B; - | ^^ use of mutable static - | - = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior - -error[E0133]: use of mutable static is unsafe and requires unsafe function or block - --> $DIR/safe-extern-statics-mut.rs:15:14 - | -LL | let xb = XB; - | ^^ use of mutable static - | - = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior - -error[E0133]: use of mutable static is unsafe and requires unsafe function or block - --> $DIR/safe-extern-statics-mut.rs:16:15 - | -LL | let xrb = &XB; - | ^^^ use of mutable static - | - = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior - -error: aborting due to 4 previous errors - -For more information about this error, try `rustc --explain E0133`. diff --git a/src/test/ui/static/safe-extern-statics-mut.rs b/src/test/ui/static/safe-extern-statics-mut.rs deleted file mode 100644 index 389a4589a..000000000 --- a/src/test/ui/static/safe-extern-statics-mut.rs +++ /dev/null @@ -1,17 +0,0 @@ -// aux-build:extern-statics.rs -// revisions: mir thir -// [thir]compile-flags: -Z thir-unsafeck - -extern crate extern_statics; -use extern_statics::*; - -extern "C" { - static mut B: u8; -} - -fn main() { - let b = B; //~ ERROR use of mutable static is unsafe - let rb = &B; //~ ERROR use of mutable static is unsafe - let xb = XB; //~ ERROR use of mutable static is unsafe - let xrb = &XB; //~ ERROR use of mutable static is unsafe -} diff --git a/src/test/ui/static/safe-extern-statics-mut.thir.stderr b/src/test/ui/static/safe-extern-statics-mut.thir.stderr deleted file mode 100644 index 8e6d2805a..000000000 --- a/src/test/ui/static/safe-extern-statics-mut.thir.stderr +++ /dev/null @@ -1,35 +0,0 @@ -error[E0133]: use of mutable static is unsafe and requires unsafe function or block - --> $DIR/safe-extern-statics-mut.rs:13:13 - | -LL | let b = B; - | ^ use of mutable static - | - = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior - -error[E0133]: use of mutable static is unsafe and requires unsafe function or block - --> $DIR/safe-extern-statics-mut.rs:14:15 - | -LL | let rb = &B; - | ^ use of mutable static - | - = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior - -error[E0133]: use of mutable static is unsafe and requires unsafe function or block - --> $DIR/safe-extern-statics-mut.rs:15:14 - | -LL | let xb = XB; - | ^^ use of mutable static - | - = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior - -error[E0133]: use of mutable static is unsafe and requires unsafe function or block - --> $DIR/safe-extern-statics-mut.rs:16:16 - | -LL | let xrb = &XB; - | ^^ use of mutable static - | - = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior - -error: aborting due to 4 previous errors - -For more information about this error, try `rustc --explain E0133`. diff --git a/src/test/ui/static/safe-extern-statics.mir.stderr b/src/test/ui/static/safe-extern-statics.mir.stderr deleted file mode 100644 index 102abd081..000000000 --- a/src/test/ui/static/safe-extern-statics.mir.stderr +++ /dev/null @@ -1,35 +0,0 @@ -error[E0133]: use of extern static is unsafe and requires unsafe function or block - --> $DIR/safe-extern-statics.rs:13:13 - | -LL | let a = A; - | ^ use of extern static - | - = note: extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will cause undefined behavior - -error[E0133]: use of extern static is unsafe and requires unsafe function or block - --> $DIR/safe-extern-statics.rs:14:14 - | -LL | let ra = &A; - | ^^ use of extern static - | - = note: extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will cause undefined behavior - -error[E0133]: use of extern static is unsafe and requires unsafe function or block - --> $DIR/safe-extern-statics.rs:15:14 - | -LL | let xa = XA; - | ^^ use of extern static - | - = note: extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will cause undefined behavior - -error[E0133]: use of extern static is unsafe and requires unsafe function or block - --> $DIR/safe-extern-statics.rs:16:15 - | -LL | let xra = &XA; - | ^^^ use of extern static - | - = note: extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will cause undefined behavior - -error: aborting due to 4 previous errors - -For more information about this error, try `rustc --explain E0133`. diff --git a/src/test/ui/static/safe-extern-statics.rs b/src/test/ui/static/safe-extern-statics.rs deleted file mode 100644 index 0aa90c442..000000000 --- a/src/test/ui/static/safe-extern-statics.rs +++ /dev/null @@ -1,17 +0,0 @@ -// aux-build:extern-statics.rs -// revisions: mir thir -// [thir]compile-flags: -Z thir-unsafeck - -extern crate extern_statics; -use extern_statics::*; - -extern "C" { - static A: u8; -} - -fn main() { - let a = A; //~ ERROR use of extern static is unsafe - let ra = &A; //~ ERROR use of extern static is unsafe - let xa = XA; //~ ERROR use of extern static is unsafe - let xra = &XA; //~ ERROR use of extern static is unsafe -} diff --git a/src/test/ui/static/safe-extern-statics.thir.stderr b/src/test/ui/static/safe-extern-statics.thir.stderr deleted file mode 100644 index 7fd2182c4..000000000 --- a/src/test/ui/static/safe-extern-statics.thir.stderr +++ /dev/null @@ -1,35 +0,0 @@ -error[E0133]: use of extern static is unsafe and requires unsafe function or block - --> $DIR/safe-extern-statics.rs:13:13 - | -LL | let a = A; - | ^ use of extern static - | - = note: extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will cause undefined behavior - -error[E0133]: use of extern static is unsafe and requires unsafe function or block - --> $DIR/safe-extern-statics.rs:14:15 - | -LL | let ra = &A; - | ^ use of extern static - | - = note: extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will cause undefined behavior - -error[E0133]: use of extern static is unsafe and requires unsafe function or block - --> $DIR/safe-extern-statics.rs:15:14 - | -LL | let xa = XA; - | ^^ use of extern static - | - = note: extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will cause undefined behavior - -error[E0133]: use of extern static is unsafe and requires unsafe function or block - --> $DIR/safe-extern-statics.rs:16:16 - | -LL | let xra = &XA; - | ^^ use of extern static - | - = note: extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will cause undefined behavior - -error: aborting due to 4 previous errors - -For more information about this error, try `rustc --explain E0133`. diff --git a/src/test/ui/static/static-closures.rs b/src/test/ui/static/static-closures.rs deleted file mode 100644 index 1bd518d6f..000000000 --- a/src/test/ui/static/static-closures.rs +++ /dev/null @@ -1,4 +0,0 @@ -fn main() { - static || {}; - //~^ ERROR closures cannot be static -} diff --git a/src/test/ui/static/static-closures.stderr b/src/test/ui/static/static-closures.stderr deleted file mode 100644 index 99235e26e..000000000 --- a/src/test/ui/static/static-closures.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0697]: closures cannot be static - --> $DIR/static-closures.rs:2:5 - | -LL | static || {}; - | ^^^^^^^^^ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0697`. diff --git a/src/test/ui/static/static-drop-scope.rs b/src/test/ui/static/static-drop-scope.rs deleted file mode 100644 index 34afa9873..000000000 --- a/src/test/ui/static/static-drop-scope.rs +++ /dev/null @@ -1,37 +0,0 @@ -struct WithDtor; - -impl Drop for WithDtor { - fn drop(&mut self) {} -} - -static PROMOTION_FAIL_S: Option<&'static WithDtor> = Some(&WithDtor); -//~^ ERROR destructor of -//~| ERROR temporary value dropped while borrowed - -const PROMOTION_FAIL_C: Option<&'static WithDtor> = Some(&WithDtor); -//~^ ERROR destructor of -//~| ERROR temporary value dropped while borrowed - -static EARLY_DROP_S: i32 = (WithDtor, 0).1; -//~^ ERROR destructor of - -const EARLY_DROP_C: i32 = (WithDtor, 0).1; -//~^ ERROR destructor of - -const fn const_drop(_: T) {} -//~^ ERROR destructor of - -const fn const_drop2(x: T) { - (x, ()).1 - //~^ ERROR destructor of -} - -const EARLY_DROP_C_OPTION: i32 = (Some(WithDtor), 0).1; -//~^ ERROR destructor of - -const HELPER: Option = Some(WithDtor); - -const EARLY_DROP_C_OPTION_CONSTANT: i32 = (HELPER, 0).1; -//~^ ERROR destructor of - -fn main () {} diff --git a/src/test/ui/static/static-drop-scope.stderr b/src/test/ui/static/static-drop-scope.stderr deleted file mode 100644 index cedcb7367..000000000 --- a/src/test/ui/static/static-drop-scope.stderr +++ /dev/null @@ -1,89 +0,0 @@ -error[E0493]: destructor of `WithDtor` cannot be evaluated at compile-time - --> $DIR/static-drop-scope.rs:7:60 - | -LL | static PROMOTION_FAIL_S: Option<&'static WithDtor> = Some(&WithDtor); - | ^^^^^^^^- value is dropped here - | | - | the destructor for this type cannot be evaluated in statics - -error[E0716]: temporary value dropped while borrowed - --> $DIR/static-drop-scope.rs:7:60 - | -LL | static PROMOTION_FAIL_S: Option<&'static WithDtor> = Some(&WithDtor); - | ------^^^^^^^^- - | | | | - | | | temporary value is freed at the end of this statement - | | creates a temporary value which is freed while still in use - | using this value as a static requires that borrow lasts for `'static` - -error[E0493]: destructor of `WithDtor` cannot be evaluated at compile-time - --> $DIR/static-drop-scope.rs:11:59 - | -LL | const PROMOTION_FAIL_C: Option<&'static WithDtor> = Some(&WithDtor); - | ^^^^^^^^- value is dropped here - | | - | the destructor for this type cannot be evaluated in constants - -error[E0716]: temporary value dropped while borrowed - --> $DIR/static-drop-scope.rs:11:59 - | -LL | const PROMOTION_FAIL_C: Option<&'static WithDtor> = Some(&WithDtor); - | ------^^^^^^^^- - | | | | - | | | temporary value is freed at the end of this statement - | | creates a temporary value which is freed while still in use - | using this value as a constant requires that borrow lasts for `'static` - -error[E0493]: destructor of `(WithDtor, i32)` cannot be evaluated at compile-time - --> $DIR/static-drop-scope.rs:15:28 - | -LL | static EARLY_DROP_S: i32 = (WithDtor, 0).1; - | ^^^^^^^^^^^^^ - value is dropped here - | | - | the destructor for this type cannot be evaluated in statics - -error[E0493]: destructor of `(WithDtor, i32)` cannot be evaluated at compile-time - --> $DIR/static-drop-scope.rs:18:27 - | -LL | const EARLY_DROP_C: i32 = (WithDtor, 0).1; - | ^^^^^^^^^^^^^ - value is dropped here - | | - | the destructor for this type cannot be evaluated in constants - -error[E0493]: destructor of `T` cannot be evaluated at compile-time - --> $DIR/static-drop-scope.rs:21:24 - | -LL | const fn const_drop(_: T) {} - | ^ - value is dropped here - | | - | the destructor for this type cannot be evaluated in constant functions - -error[E0493]: destructor of `(T, ())` cannot be evaluated at compile-time - --> $DIR/static-drop-scope.rs:25:5 - | -LL | (x, ()).1 - | ^^^^^^^ the destructor for this type cannot be evaluated in constant functions -LL | -LL | } - | - value is dropped here - -error[E0493]: destructor of `(Option, i32)` cannot be evaluated at compile-time - --> $DIR/static-drop-scope.rs:29:34 - | -LL | const EARLY_DROP_C_OPTION: i32 = (Some(WithDtor), 0).1; - | ^^^^^^^^^^^^^^^^^^^ - value is dropped here - | | - | the destructor for this type cannot be evaluated in constants - -error[E0493]: destructor of `(Option, i32)` cannot be evaluated at compile-time - --> $DIR/static-drop-scope.rs:34:43 - | -LL | const EARLY_DROP_C_OPTION_CONSTANT: i32 = (HELPER, 0).1; - | ^^^^^^^^^^^ - value is dropped here - | | - | the destructor for this type cannot be evaluated in constants - -error: aborting due to 10 previous errors - -Some errors have detailed explanations: E0493, E0716. -For more information about an error, try `rustc --explain E0493`. diff --git a/src/test/ui/static/static-extern-type.rs b/src/test/ui/static/static-extern-type.rs deleted file mode 100644 index 4fa48fa13..000000000 --- a/src/test/ui/static/static-extern-type.rs +++ /dev/null @@ -1,27 +0,0 @@ -// build-pass (FIXME(62277): could be check-pass?) -#![feature(extern_types)] - -pub mod a { - extern "C" { - pub type StartFn; - pub static start: StartFn; - } -} - -pub mod b { - #[repr(transparent)] - pub struct TransparentType(::a::StartFn); - extern "C" { - pub static start: TransparentType; - } -} - -pub mod c { - #[repr(C)] - pub struct CType(u32, ::b::TransparentType); - extern "C" { - pub static start: CType; - } -} - -fn main() {} diff --git a/src/test/ui/static/static-items-cant-move.rs b/src/test/ui/static/static-items-cant-move.rs deleted file mode 100644 index 3e7aaa0b0..000000000 --- a/src/test/ui/static/static-items-cant-move.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Verifies that static items can't be moved - -struct B; - -struct Foo { - foo: isize, - b: B, -} - -static BAR: Foo = Foo { foo: 5, b: B }; - - -fn test(f: Foo) { - let _f = Foo{foo: 4, ..f}; -} - -fn main() { - test(BAR); //~ ERROR cannot move out of static item -} diff --git a/src/test/ui/static/static-items-cant-move.stderr b/src/test/ui/static/static-items-cant-move.stderr deleted file mode 100644 index 235e9ee9b..000000000 --- a/src/test/ui/static/static-items-cant-move.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0507]: cannot move out of static item `BAR` - --> $DIR/static-items-cant-move.rs:18:10 - | -LL | test(BAR); - | ^^^ move occurs because `BAR` has type `Foo`, which does not implement the `Copy` trait - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0507`. diff --git a/src/test/ui/static/static-lifetime-bound.rs b/src/test/ui/static/static-lifetime-bound.rs deleted file mode 100644 index b5da91ec3..000000000 --- a/src/test/ui/static/static-lifetime-bound.rs +++ /dev/null @@ -1,6 +0,0 @@ -fn f<'a: 'static>(_: &'a i32) {} //~WARN unnecessary lifetime parameter `'a` - -fn main() { - let x = 0; - f(&x); //~ERROR does not live long enough -} diff --git a/src/test/ui/static/static-lifetime-bound.stderr b/src/test/ui/static/static-lifetime-bound.stderr deleted file mode 100644 index ef07a8931..000000000 --- a/src/test/ui/static/static-lifetime-bound.stderr +++ /dev/null @@ -1,22 +0,0 @@ -warning: unnecessary lifetime parameter `'a` - --> $DIR/static-lifetime-bound.rs:1:6 - | -LL | fn f<'a: 'static>(_: &'a i32) {} - | ^^ - | - = help: you can use the `'static` lifetime directly, in place of `'a` - -error[E0597]: `x` does not live long enough - --> $DIR/static-lifetime-bound.rs:5:7 - | -LL | f(&x); - | --^^- - | | | - | | borrowed value does not live long enough - | argument requires that `x` is borrowed for `'static` -LL | } - | - `x` dropped here while still borrowed - -error: aborting due to previous error; 1 warning emitted - -For more information about this error, try `rustc --explain E0597`. diff --git a/src/test/ui/static/static-lifetime.rs b/src/test/ui/static/static-lifetime.rs deleted file mode 100644 index ce1eeb610..000000000 --- a/src/test/ui/static/static-lifetime.rs +++ /dev/null @@ -1,6 +0,0 @@ -pub trait Arbitrary: Sized + 'static {} - -impl<'a, A: Clone> Arbitrary for ::std::borrow::Cow<'a, A> {} //~ ERROR lifetime bound - -fn main() { -} diff --git a/src/test/ui/static/static-lifetime.stderr b/src/test/ui/static/static-lifetime.stderr deleted file mode 100644 index 4af3370c7..000000000 --- a/src/test/ui/static/static-lifetime.stderr +++ /dev/null @@ -1,16 +0,0 @@ -error[E0478]: lifetime bound not satisfied - --> $DIR/static-lifetime.rs:3:20 - | -LL | impl<'a, A: Clone> Arbitrary for ::std::borrow::Cow<'a, A> {} - | ^^^^^^^^^ - | -note: lifetime parameter instantiated with the lifetime `'a` as defined here - --> $DIR/static-lifetime.rs:3:6 - | -LL | impl<'a, A: Clone> Arbitrary for ::std::borrow::Cow<'a, A> {} - | ^^ - = note: but lifetime parameter must outlive the static lifetime - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0478`. diff --git a/src/test/ui/static/static-method-privacy.rs b/src/test/ui/static/static-method-privacy.rs deleted file mode 100644 index 9ee59b320..000000000 --- a/src/test/ui/static/static-method-privacy.rs +++ /dev/null @@ -1,10 +0,0 @@ -mod a { - pub struct S; - impl S { - fn new() -> S { S } - } -} - -fn main() { - let _ = a::S::new(); //~ ERROR associated function `new` is private -} diff --git a/src/test/ui/static/static-method-privacy.stderr b/src/test/ui/static/static-method-privacy.stderr deleted file mode 100644 index 4be1b22fc..000000000 --- a/src/test/ui/static/static-method-privacy.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0624]: associated function `new` is private - --> $DIR/static-method-privacy.rs:9:19 - | -LL | fn new() -> S { S } - | ------------- private associated function defined here -... -LL | let _ = a::S::new(); - | ^^^ private associated function - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0624`. diff --git a/src/test/ui/static/static-mut-bad-types.rs b/src/test/ui/static/static-mut-bad-types.rs deleted file mode 100644 index 8a98b1b7f..000000000 --- a/src/test/ui/static/static-mut-bad-types.rs +++ /dev/null @@ -1,7 +0,0 @@ -static mut a: isize = 3; - -fn main() { - unsafe { - a = true; //~ ERROR: mismatched types - } -} diff --git a/src/test/ui/static/static-mut-bad-types.stderr b/src/test/ui/static/static-mut-bad-types.stderr deleted file mode 100644 index 983e1026f..000000000 --- a/src/test/ui/static/static-mut-bad-types.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0308]: mismatched types - --> $DIR/static-mut-bad-types.rs:5:13 - | -LL | static mut a: isize = 3; - | ----- expected due to this type -... -LL | a = true; - | ^^^^ expected `isize`, found `bool` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/static/static-mut-foreign-requires-unsafe.mir.stderr b/src/test/ui/static/static-mut-foreign-requires-unsafe.mir.stderr deleted file mode 100644 index a4659bc87..000000000 --- a/src/test/ui/static/static-mut-foreign-requires-unsafe.mir.stderr +++ /dev/null @@ -1,27 +0,0 @@ -error[E0133]: use of mutable static is unsafe and requires unsafe function or block - --> $DIR/static-mut-foreign-requires-unsafe.rs:9:5 - | -LL | a += 3; - | ^^^^^^ use of mutable static - | - = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior - -error[E0133]: use of mutable static is unsafe and requires unsafe function or block - --> $DIR/static-mut-foreign-requires-unsafe.rs:10:5 - | -LL | a = 4; - | ^^^^^ use of mutable static - | - = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior - -error[E0133]: use of mutable static is unsafe and requires unsafe function or block - --> $DIR/static-mut-foreign-requires-unsafe.rs:11:14 - | -LL | let _b = a; - | ^ use of mutable static - | - = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior - -error: aborting due to 3 previous errors - -For more information about this error, try `rustc --explain E0133`. diff --git a/src/test/ui/static/static-mut-foreign-requires-unsafe.rs b/src/test/ui/static/static-mut-foreign-requires-unsafe.rs deleted file mode 100644 index 4f96acb33..000000000 --- a/src/test/ui/static/static-mut-foreign-requires-unsafe.rs +++ /dev/null @@ -1,12 +0,0 @@ -// revisions: mir thir -// [thir]compile-flags: -Z thir-unsafeck - -extern "C" { - static mut a: i32; -} - -fn main() { - a += 3; //~ ERROR: requires unsafe - a = 4; //~ ERROR: requires unsafe - let _b = a; //~ ERROR: requires unsafe -} diff --git a/src/test/ui/static/static-mut-foreign-requires-unsafe.thir.stderr b/src/test/ui/static/static-mut-foreign-requires-unsafe.thir.stderr deleted file mode 100644 index 2c62d4d8f..000000000 --- a/src/test/ui/static/static-mut-foreign-requires-unsafe.thir.stderr +++ /dev/null @@ -1,27 +0,0 @@ -error[E0133]: use of mutable static is unsafe and requires unsafe function or block - --> $DIR/static-mut-foreign-requires-unsafe.rs:9:5 - | -LL | a += 3; - | ^ use of mutable static - | - = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior - -error[E0133]: use of mutable static is unsafe and requires unsafe function or block - --> $DIR/static-mut-foreign-requires-unsafe.rs:10:5 - | -LL | a = 4; - | ^ use of mutable static - | - = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior - -error[E0133]: use of mutable static is unsafe and requires unsafe function or block - --> $DIR/static-mut-foreign-requires-unsafe.rs:11:14 - | -LL | let _b = a; - | ^ use of mutable static - | - = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior - -error: aborting due to 3 previous errors - -For more information about this error, try `rustc --explain E0133`. diff --git a/src/test/ui/static/static-mut-not-constant.rs b/src/test/ui/static/static-mut-not-constant.rs deleted file mode 100644 index 2091fffd4..000000000 --- a/src/test/ui/static/static-mut-not-constant.rs +++ /dev/null @@ -1,6 +0,0 @@ -#![feature(box_syntax)] - -static mut a: Box = box 3; -//~^ ERROR allocations are not allowed in statics - -fn main() {} diff --git a/src/test/ui/static/static-mut-not-constant.stderr b/src/test/ui/static/static-mut-not-constant.stderr deleted file mode 100644 index a0fa24515..000000000 --- a/src/test/ui/static/static-mut-not-constant.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0010]: allocations are not allowed in statics - --> $DIR/static-mut-not-constant.rs:3:28 - | -LL | static mut a: Box = box 3; - | ^^^^^ allocation not allowed in statics - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0010`. diff --git a/src/test/ui/static/static-mut-not-pat.rs b/src/test/ui/static/static-mut-not-pat.rs deleted file mode 100644 index ce5ae164c..000000000 --- a/src/test/ui/static/static-mut-not-pat.rs +++ /dev/null @@ -1,43 +0,0 @@ -// Constants (static variables) can be used to match in patterns, but mutable -// statics cannot. This ensures that there's some form of error if this is -// attempted. - -static mut a: isize = 3; - -fn main() { - // If they can't be matched against, then it's possible to capture the same - // name as a variable, hence this should be an unreachable pattern situation - // instead of spitting out a custom error about some identifier collisions - // (we should allow shadowing) - match 4 { - a => {} //~ ERROR match bindings cannot shadow statics - _ => {} - } -} - -struct NewBool(bool); -enum Direction { - North, - East, - South, - West -} -const NEW_FALSE: NewBool = NewBool(false); -struct Foo { - bar: Option, - baz: NewBool -} - -static mut STATIC_MUT_FOO: Foo = Foo { bar: Some(Direction::West), baz: NEW_FALSE }; - -fn mutable_statics() { - match (Foo { bar: Some(Direction::North), baz: NewBool(true) }) { - Foo { bar: None, baz: NewBool(true) } => (), - STATIC_MUT_FOO => (), - //~^ ERROR match bindings cannot shadow statics - Foo { bar: Some(Direction::South), .. } => (), - Foo { bar: Some(EAST), .. } => (), - Foo { bar: Some(Direction::North), baz: NewBool(true) } => (), - Foo { bar: Some(EAST), baz: NewBool(false) } => () - } -} diff --git a/src/test/ui/static/static-mut-not-pat.stderr b/src/test/ui/static/static-mut-not-pat.stderr deleted file mode 100644 index 33c1cd6a5..000000000 --- a/src/test/ui/static/static-mut-not-pat.stderr +++ /dev/null @@ -1,21 +0,0 @@ -error[E0530]: match bindings cannot shadow statics - --> $DIR/static-mut-not-pat.rs:13:9 - | -LL | static mut a: isize = 3; - | ------------------------ the static `a` is defined here -... -LL | a => {} - | ^ cannot be named the same as a static - -error[E0530]: match bindings cannot shadow statics - --> $DIR/static-mut-not-pat.rs:36:9 - | -LL | static mut STATIC_MUT_FOO: Foo = Foo { bar: Some(Direction::West), baz: NEW_FALSE }; - | ------------------------------------------------------------------------------------ the static `STATIC_MUT_FOO` is defined here -... -LL | STATIC_MUT_FOO => (), - | ^^^^^^^^^^^^^^ cannot be named the same as a static - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0530`. diff --git a/src/test/ui/static/static-mut-requires-unsafe.mir.stderr b/src/test/ui/static/static-mut-requires-unsafe.mir.stderr deleted file mode 100644 index 0d4ce056f..000000000 --- a/src/test/ui/static/static-mut-requires-unsafe.mir.stderr +++ /dev/null @@ -1,27 +0,0 @@ -error[E0133]: use of mutable static is unsafe and requires unsafe function or block - --> $DIR/static-mut-requires-unsafe.rs:7:5 - | -LL | a += 3; - | ^^^^^^ use of mutable static - | - = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior - -error[E0133]: use of mutable static is unsafe and requires unsafe function or block - --> $DIR/static-mut-requires-unsafe.rs:8:5 - | -LL | a = 4; - | ^^^^^ use of mutable static - | - = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior - -error[E0133]: use of mutable static is unsafe and requires unsafe function or block - --> $DIR/static-mut-requires-unsafe.rs:9:14 - | -LL | let _b = a; - | ^ use of mutable static - | - = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior - -error: aborting due to 3 previous errors - -For more information about this error, try `rustc --explain E0133`. diff --git a/src/test/ui/static/static-mut-requires-unsafe.rs b/src/test/ui/static/static-mut-requires-unsafe.rs deleted file mode 100644 index ea3ba0950..000000000 --- a/src/test/ui/static/static-mut-requires-unsafe.rs +++ /dev/null @@ -1,10 +0,0 @@ -// revisions: mir thir -// [thir]compile-flags: -Z thir-unsafeck - -static mut a: isize = 3; - -fn main() { - a += 3; //~ ERROR: requires unsafe - a = 4; //~ ERROR: requires unsafe - let _b = a; //~ ERROR: requires unsafe -} diff --git a/src/test/ui/static/static-mut-requires-unsafe.thir.stderr b/src/test/ui/static/static-mut-requires-unsafe.thir.stderr deleted file mode 100644 index 1a1cf1427..000000000 --- a/src/test/ui/static/static-mut-requires-unsafe.thir.stderr +++ /dev/null @@ -1,27 +0,0 @@ -error[E0133]: use of mutable static is unsafe and requires unsafe function or block - --> $DIR/static-mut-requires-unsafe.rs:7:5 - | -LL | a += 3; - | ^ use of mutable static - | - = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior - -error[E0133]: use of mutable static is unsafe and requires unsafe function or block - --> $DIR/static-mut-requires-unsafe.rs:8:5 - | -LL | a = 4; - | ^ use of mutable static - | - = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior - -error[E0133]: use of mutable static is unsafe and requires unsafe function or block - --> $DIR/static-mut-requires-unsafe.rs:9:14 - | -LL | let _b = a; - | ^ use of mutable static - | - = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior - -error: aborting due to 3 previous errors - -For more information about this error, try `rustc --explain E0133`. diff --git a/src/test/ui/static/static-priv-by-default2.rs b/src/test/ui/static/static-priv-by-default2.rs deleted file mode 100644 index bbbdb253b..000000000 --- a/src/test/ui/static/static-priv-by-default2.rs +++ /dev/null @@ -1,30 +0,0 @@ -// aux-build:static_priv_by_default.rs - -extern crate static_priv_by_default; - -mod child { - pub mod childs_child { - static private: isize = 0; - pub static public: isize = 0; - } -} - -fn foo(_: T) {} - -fn test1() { - use child::childs_child::private; - //~^ ERROR: static `private` is private - use child::childs_child::public; - - foo(private); -} - -fn test2() { - use static_priv_by_default::private; - //~^ ERROR: static `private` is private - use static_priv_by_default::public; - - foo(private); -} - -fn main() {} diff --git a/src/test/ui/static/static-priv-by-default2.stderr b/src/test/ui/static/static-priv-by-default2.stderr deleted file mode 100644 index b14e096d6..000000000 --- a/src/test/ui/static/static-priv-by-default2.stderr +++ /dev/null @@ -1,27 +0,0 @@ -error[E0603]: static `private` is private - --> $DIR/static-priv-by-default2.rs:15:30 - | -LL | use child::childs_child::private; - | ^^^^^^^ private static - | -note: the static `private` is defined here - --> $DIR/static-priv-by-default2.rs:7:9 - | -LL | static private: isize = 0; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error[E0603]: static `private` is private - --> $DIR/static-priv-by-default2.rs:23:33 - | -LL | use static_priv_by_default::private; - | ^^^^^^^ private static - | -note: the static `private` is defined here - --> $DIR/auxiliary/static_priv_by_default.rs:3:1 - | -LL | static private: isize = 0; - | ^^^^^^^^^^^^^^^^^^^^^ - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0603`. diff --git a/src/test/ui/static/static-reference-to-fn-1.rs b/src/test/ui/static/static-reference-to-fn-1.rs deleted file mode 100644 index c15634dbf..000000000 --- a/src/test/ui/static/static-reference-to-fn-1.rs +++ /dev/null @@ -1,24 +0,0 @@ -struct A<'a> { - func: &'a fn() -> Option -} - -impl<'a> A<'a> { - fn call(&self) -> Option { - (*self.func)() - } -} - -fn foo() -> Option { - None -} - -fn create() -> A<'static> { - A { - func: &foo, //~ ERROR mismatched types - } -} - -fn main() { - let a = create(); - a.call(); -} diff --git a/src/test/ui/static/static-reference-to-fn-1.stderr b/src/test/ui/static/static-reference-to-fn-1.stderr deleted file mode 100644 index 67b478bdb..000000000 --- a/src/test/ui/static/static-reference-to-fn-1.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0308]: mismatched types - --> $DIR/static-reference-to-fn-1.rs:17:15 - | -LL | func: &foo, - | ^^^^ expected fn pointer, found fn item - | - = note: expected reference `&fn() -> Option` - found reference `&fn() -> Option {foo}` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/static/static-reference-to-fn-2.rs b/src/test/ui/static/static-reference-to-fn-2.rs deleted file mode 100644 index 6693667c0..000000000 --- a/src/test/ui/static/static-reference-to-fn-2.rs +++ /dev/null @@ -1,54 +0,0 @@ -fn id(x: T) -> T { x } - -struct StateMachineIter<'a> { - statefn: &'a StateMachineFunc<'a> -} - -type StateMachineFunc<'a> = fn(&mut StateMachineIter<'a>) -> Option<&'static str>; - -impl<'a> Iterator for StateMachineIter<'a> { - type Item = &'static str; - - fn next(&mut self) -> Option<&'static str> { - return (*self.statefn)(self); - } -} - -fn state1(self_: &mut StateMachineIter) -> Option<&'static str> { - self_.statefn = &id(state2 as StateMachineFunc); - //~^ ERROR temporary value dropped while borrowed - return Some("state1"); -} - -fn state2(self_: &mut StateMachineIter) -> Option<(&'static str)> { - self_.statefn = &id(state3 as StateMachineFunc); - //~^ ERROR temporary value dropped while borrowed - return Some("state2"); -} - -fn state3(self_: &mut StateMachineIter) -> Option<(&'static str)> { - self_.statefn = &id(finished as StateMachineFunc); - //~^ ERROR temporary value dropped while borrowed - return Some("state3"); -} - -fn finished(_: &mut StateMachineIter) -> Option<(&'static str)> { - return None; -} - -fn state_iter() -> StateMachineIter<'static> { - StateMachineIter { - //~^ ERROR cannot return value referencing temporary value - statefn: &id(state1 as StateMachineFunc) - } -} - - -fn main() { - let mut it = state_iter(); - println!("{:?}",it.next()); - println!("{:?}",it.next()); - println!("{:?}",it.next()); - println!("{:?}",it.next()); - println!("{:?}",it.next()); -} diff --git a/src/test/ui/static/static-reference-to-fn-2.stderr b/src/test/ui/static/static-reference-to-fn-2.stderr deleted file mode 100644 index 133d8ec2e..000000000 --- a/src/test/ui/static/static-reference-to-fn-2.stderr +++ /dev/null @@ -1,49 +0,0 @@ -error[E0716]: temporary value dropped while borrowed - --> $DIR/static-reference-to-fn-2.rs:18:22 - | -LL | fn state1(self_: &mut StateMachineIter) -> Option<&'static str> { - | ----- has type `&mut StateMachineIter<'1>` -LL | self_.statefn = &id(state2 as StateMachineFunc); - | -----------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- temporary value is freed at the end of this statement - | | | - | | creates a temporary value which is freed while still in use - | assignment requires that borrow lasts for `'1` - -error[E0716]: temporary value dropped while borrowed - --> $DIR/static-reference-to-fn-2.rs:24:22 - | -LL | fn state2(self_: &mut StateMachineIter) -> Option<(&'static str)> { - | ----- has type `&mut StateMachineIter<'1>` -LL | self_.statefn = &id(state3 as StateMachineFunc); - | -----------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- temporary value is freed at the end of this statement - | | | - | | creates a temporary value which is freed while still in use - | assignment requires that borrow lasts for `'1` - -error[E0716]: temporary value dropped while borrowed - --> $DIR/static-reference-to-fn-2.rs:30:22 - | -LL | fn state3(self_: &mut StateMachineIter) -> Option<(&'static str)> { - | ----- has type `&mut StateMachineIter<'1>` -LL | self_.statefn = &id(finished as StateMachineFunc); - | -----------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- temporary value is freed at the end of this statement - | | | - | | creates a temporary value which is freed while still in use - | assignment requires that borrow lasts for `'1` - -error[E0515]: cannot return value referencing temporary value - --> $DIR/static-reference-to-fn-2.rs:40:5 - | -LL | / StateMachineIter { -LL | | -LL | | statefn: &id(state1 as StateMachineFunc) - | | ------------------------------ temporary value created here -LL | | } - | |_____^ returns a value referencing data owned by the current function - | - = help: use `.collect()` to allocate the iterator - -error: aborting due to 4 previous errors - -Some errors have detailed explanations: E0515, E0716. -For more information about an error, try `rustc --explain E0515`. diff --git a/src/test/ui/static/static-region-bound.rs b/src/test/ui/static/static-region-bound.rs deleted file mode 100644 index d70706e57..000000000 --- a/src/test/ui/static/static-region-bound.rs +++ /dev/null @@ -1,12 +0,0 @@ -fn id(x: T) -> T { x } - -fn f(_: T) {} - -fn main() { - - let x: Box<_> = Box::new(3); - f(x); - - let x = &id(3); //~ ERROR temporary value dropped while borrowed - f(x); -} diff --git a/src/test/ui/static/static-region-bound.stderr b/src/test/ui/static/static-region-bound.stderr deleted file mode 100644 index 1a607e3c0..000000000 --- a/src/test/ui/static/static-region-bound.stderr +++ /dev/null @@ -1,13 +0,0 @@ -error[E0716]: temporary value dropped while borrowed - --> $DIR/static-region-bound.rs:10:14 - | -LL | let x = &id(3); - | ^^^^^ creates a temporary value which is freed while still in use -LL | f(x); - | ---- argument requires that borrow lasts for `'static` -LL | } - | - temporary value is freed at the end of this statement - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0716`. diff --git a/src/test/ui/static/static-vec-repeat-not-constant.rs b/src/test/ui/static/static-vec-repeat-not-constant.rs deleted file mode 100644 index 61c87b144..000000000 --- a/src/test/ui/static/static-vec-repeat-not-constant.rs +++ /dev/null @@ -1,6 +0,0 @@ -fn foo() -> isize { 23 } - -static a: [isize; 2] = [foo(); 2]; -//~^ ERROR: E0015 - -fn main() {} diff --git a/src/test/ui/static/static-vec-repeat-not-constant.stderr b/src/test/ui/static/static-vec-repeat-not-constant.stderr deleted file mode 100644 index dec012318..000000000 --- a/src/test/ui/static/static-vec-repeat-not-constant.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0015]: cannot call non-const fn `foo` in statics - --> $DIR/static-vec-repeat-not-constant.rs:3:25 - | -LL | static a: [isize; 2] = [foo(); 2]; - | ^^^^^ - | - = note: calls in statics are limited to constant functions, tuple structs and tuple variants - = note: consider wrapping this expression in `Lazy::new(|| ...)` from the `once_cell` crate: https://crates.io/crates/once_cell - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0015`. diff --git a/src/test/ui/static/static_sized_requirement.rs b/src/test/ui/static/static_sized_requirement.rs deleted file mode 100644 index 3943b2608..000000000 --- a/src/test/ui/static/static_sized_requirement.rs +++ /dev/null @@ -1,12 +0,0 @@ -// build-pass (FIXME(62277): could be check-pass?) - -#![feature(no_core, lang_items)] -#![no_core] -#![crate_type = "lib"] - -#[lang = "sized"] -trait Sized {} - -extern "C" { - pub static A: u32; -} diff --git a/src/test/ui/static/thread-local-in-ctfe.rs b/src/test/ui/static/thread-local-in-ctfe.rs deleted file mode 100644 index 547e5445a..000000000 --- a/src/test/ui/static/thread-local-in-ctfe.rs +++ /dev/null @@ -1,23 +0,0 @@ -#![feature(thread_local)] - -#[thread_local] -static A: u32 = 1; - -static B: u32 = A; -//~^ ERROR thread-local statics cannot be accessed at compile-time - -static C: &u32 = &A; -//~^ ERROR thread-local statics cannot be accessed at compile-time - -const D: u32 = A; -//~^ ERROR thread-local statics cannot be accessed at compile-time - -const E: &u32 = &A; -//~^ ERROR thread-local statics cannot be accessed at compile-time - -const fn f() -> u32 { - A - //~^ ERROR thread-local statics cannot be accessed at compile-time -} - -fn main() {} diff --git a/src/test/ui/static/thread-local-in-ctfe.stderr b/src/test/ui/static/thread-local-in-ctfe.stderr deleted file mode 100644 index fd9676046..000000000 --- a/src/test/ui/static/thread-local-in-ctfe.stderr +++ /dev/null @@ -1,33 +0,0 @@ -error[E0625]: thread-local statics cannot be accessed at compile-time - --> $DIR/thread-local-in-ctfe.rs:6:17 - | -LL | static B: u32 = A; - | ^ - -error[E0625]: thread-local statics cannot be accessed at compile-time - --> $DIR/thread-local-in-ctfe.rs:9:19 - | -LL | static C: &u32 = &A; - | ^ - -error[E0625]: thread-local statics cannot be accessed at compile-time - --> $DIR/thread-local-in-ctfe.rs:12:16 - | -LL | const D: u32 = A; - | ^ - -error[E0625]: thread-local statics cannot be accessed at compile-time - --> $DIR/thread-local-in-ctfe.rs:15:18 - | -LL | const E: &u32 = &A; - | ^ - -error[E0625]: thread-local statics cannot be accessed at compile-time - --> $DIR/thread-local-in-ctfe.rs:19:5 - | -LL | A - | ^ - -error: aborting due to 5 previous errors - -For more information about this error, try `rustc --explain E0625`. -- cgit v1.2.3