diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:19:13 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:19:13 +0000 |
commit | 218caa410aa38c29984be31a5229b9fa717560ee (patch) | |
tree | c54bd55eeb6e4c508940a30e94c0032fbd45d677 /tests/ui/static/auxiliary | |
parent | Releasing progress-linux version 1.67.1+dfsg1-1~progress7.99u1. (diff) | |
download | rustc-218caa410aa38c29984be31a5229b9fa717560ee.tar.xz rustc-218caa410aa38c29984be31a5229b9fa717560ee.zip |
Merging upstream version 1.68.2+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/ui/static/auxiliary')
-rw-r--r-- | tests/ui/static/auxiliary/extern-statics.rs | 4 | ||||
-rw-r--r-- | tests/ui/static/auxiliary/issue_24843.rs | 1 | ||||
-rw-r--r-- | tests/ui/static/auxiliary/nested_item.rs | 30 | ||||
-rw-r--r-- | tests/ui/static/auxiliary/static-priv-by-default.rs | 27 | ||||
-rw-r--r-- | tests/ui/static/auxiliary/static_priv_by_default.rs | 51 |
5 files changed, 113 insertions, 0 deletions
diff --git a/tests/ui/static/auxiliary/extern-statics.rs b/tests/ui/static/auxiliary/extern-statics.rs new file mode 100644 index 000000000..c090bc79f --- /dev/null +++ b/tests/ui/static/auxiliary/extern-statics.rs @@ -0,0 +1,4 @@ +extern "C" { + pub static XA: u8; + pub static mut XB: u8; +} diff --git a/tests/ui/static/auxiliary/issue_24843.rs b/tests/ui/static/auxiliary/issue_24843.rs new file mode 100644 index 000000000..6ca04f860 --- /dev/null +++ b/tests/ui/static/auxiliary/issue_24843.rs @@ -0,0 +1 @@ +pub static TEST_STR: &'static str = "Hello world"; diff --git a/tests/ui/static/auxiliary/nested_item.rs b/tests/ui/static/auxiliary/nested_item.rs new file mode 100644 index 000000000..9db9d19d6 --- /dev/null +++ b/tests/ui/static/auxiliary/nested_item.rs @@ -0,0 +1,30 @@ +// original problem +pub fn foo<T>() -> isize { + { + static foo: isize = 2; + foo + } +} + +// issue 8134 +struct Foo; +impl Foo { + pub fn foo<T>(&self) { + static X: usize = 1; + } +} + +// issue 8134 +pub struct Parser<T>(T); +impl<T: std::iter::Iterator<Item=char>> Parser<T> { + fn in_doctype(&mut self) { + static DOCTYPEPattern: [char; 6] = ['O', 'C', 'T', 'Y', 'P', 'E']; + } +} + +struct Bar; +impl Foo { + pub fn bar<T>(&self) { + static X: usize = 1; + } +} diff --git a/tests/ui/static/auxiliary/static-priv-by-default.rs b/tests/ui/static/auxiliary/static-priv-by-default.rs new file mode 100644 index 000000000..41f368f46 --- /dev/null +++ b/tests/ui/static/auxiliary/static-priv-by-default.rs @@ -0,0 +1,27 @@ +// 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/tests/ui/static/auxiliary/static_priv_by_default.rs b/tests/ui/static/auxiliary/static_priv_by_default.rs new file mode 100644 index 000000000..39f912066 --- /dev/null +++ b/tests/ui/static/auxiliary/static_priv_by_default.rs @@ -0,0 +1,51 @@ +#![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; |