summaryrefslogtreecommitdiffstats
path: root/vendor/displaydoc/tests/no_std
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:18:32 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:18:32 +0000
commit4547b622d8d29df964fa2914213088b148c498fc (patch)
tree9fc6b25f3c3add6b745be9a2400a6e96140046e9 /vendor/displaydoc/tests/no_std
parentReleasing progress-linux version 1.66.0+dfsg1-1~progress7.99u1. (diff)
downloadrustc-4547b622d8d29df964fa2914213088b148c498fc.tar.xz
rustc-4547b622d8d29df964fa2914213088b148c498fc.zip
Merging upstream version 1.67.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/displaydoc/tests/no_std')
-rw-r--r--vendor/displaydoc/tests/no_std/enum_prefix.rs36
-rw-r--r--vendor/displaydoc/tests/no_std/enum_prefix_missing.rs35
-rw-r--r--vendor/displaydoc/tests/no_std/enum_prefix_missing.stderr19
-rw-r--r--vendor/displaydoc/tests/no_std/multi_line.rs37
-rw-r--r--vendor/displaydoc/tests/no_std/multi_line.stderr19
-rw-r--r--vendor/displaydoc/tests/no_std/multi_line_allow.rs38
-rw-r--r--vendor/displaydoc/tests/no_std/with.rs32
-rw-r--r--vendor/displaydoc/tests/no_std/without.rs28
-rw-r--r--vendor/displaydoc/tests/no_std/without.stderr19
9 files changed, 263 insertions, 0 deletions
diff --git a/vendor/displaydoc/tests/no_std/enum_prefix.rs b/vendor/displaydoc/tests/no_std/enum_prefix.rs
new file mode 100644
index 000000000..1c5479118
--- /dev/null
+++ b/vendor/displaydoc/tests/no_std/enum_prefix.rs
@@ -0,0 +1,36 @@
+#![cfg_attr(not(feature = "std"), feature(lang_items, start))]
+#![cfg_attr(not(feature = "std"), no_std)]
+
+#[cfg_attr(not(feature = "std"), start)]
+fn start(_argc: isize, _argv: *const *const u8) -> isize {
+ 0
+}
+#[lang = "eh_personality"]
+#[no_mangle]
+#[cfg(not(feature = "std"))]
+pub extern "C" fn rust_eh_personality() {}
+#[panic_handler]
+#[cfg(not(feature = "std"))]
+fn panic(_info: &core::panic::PanicInfo) -> ! {
+ unsafe {
+ libc::abort();
+ }
+}
+
+use displaydoc::Display;
+
+/// this type is pretty swell
+#[derive(Display)]
+#[prefix_enum_doc_attributes]
+enum TestType {
+ /// this variant is too
+ Variant1,
+
+ /// this variant is two
+ Variant2,
+}
+
+static_assertions::assert_impl_all!(label; TestType, core::fmt::Display);
+
+#[cfg(feature = "std")]
+fn main() {}
diff --git a/vendor/displaydoc/tests/no_std/enum_prefix_missing.rs b/vendor/displaydoc/tests/no_std/enum_prefix_missing.rs
new file mode 100644
index 000000000..5cd9e6df8
--- /dev/null
+++ b/vendor/displaydoc/tests/no_std/enum_prefix_missing.rs
@@ -0,0 +1,35 @@
+#![cfg_attr(not(feature = "std"), feature(lang_items, start))]
+#![cfg_attr(not(feature = "std"), no_std)]
+
+#[cfg_attr(not(feature = "std"), start)]
+fn start(_argc: isize, _argv: *const *const u8) -> isize {
+ 0
+}
+#[lang = "eh_personality"]
+#[no_mangle]
+#[cfg(not(feature = "std"))]
+pub extern "C" fn rust_eh_personality() {}
+#[panic_handler]
+#[cfg(not(feature = "std"))]
+fn panic(_info: &core::panic::PanicInfo) -> ! {
+ unsafe {
+ libc::abort();
+ }
+}
+
+use displaydoc::Display;
+
+#[derive(Display)]
+#[prefix_enum_doc_attributes]
+enum TestType {
+ /// this variant is too
+ Variant1,
+
+ /// this variant is two
+ Variant2,
+}
+
+static_assertions::assert_impl_all!(label; TestType, core::fmt::Display);
+
+#[cfg(feature = "std")]
+fn main() {}
diff --git a/vendor/displaydoc/tests/no_std/enum_prefix_missing.stderr b/vendor/displaydoc/tests/no_std/enum_prefix_missing.stderr
new file mode 100644
index 000000000..a0db21694
--- /dev/null
+++ b/vendor/displaydoc/tests/no_std/enum_prefix_missing.stderr
@@ -0,0 +1,19 @@
+error: proc-macro derive panicked
+ --> $DIR/enum_prefix_missing.rs:22:10
+ |
+22 | #[derive(Display)]
+ | ^^^^^^^
+ |
+ = help: message: Missing doc comment on enum with #[prefix_enum_doc_attributes]. Please remove the attribute or add a doc comment to the enum itself.
+
+error[E0277]: `TestType` doesn't implement `Display`
+ --> $DIR/enum_prefix_missing.rs:32:44
+ |
+32 | static_assertions::assert_impl_all!(label; TestType, core::fmt::Display);
+ | -------------------------------------------^^^^^^^^----------------------
+ | | |
+ | | `TestType` cannot be formatted with the default formatter
+ | required by this bound in `assert_impl_all`
+ |
+ = help: the trait `Display` is not implemented for `TestType`
+ = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead
diff --git a/vendor/displaydoc/tests/no_std/multi_line.rs b/vendor/displaydoc/tests/no_std/multi_line.rs
new file mode 100644
index 000000000..cadb83e70
--- /dev/null
+++ b/vendor/displaydoc/tests/no_std/multi_line.rs
@@ -0,0 +1,37 @@
+#![cfg_attr(not(feature = "std"), feature(lang_items, start))]
+#![cfg_attr(not(feature = "std"), no_std)]
+
+#[cfg_attr(not(feature = "std"), start)]
+fn start(_argc: isize, _argv: *const *const u8) -> isize {
+ 0
+}
+#[lang = "eh_personality"]
+#[no_mangle]
+#[cfg(not(feature = "std"))]
+pub extern "C" fn rust_eh_personality() {}
+#[panic_handler]
+#[cfg(not(feature = "std"))]
+fn panic(_info: &core::panic::PanicInfo) -> ! {
+ unsafe {
+ libc::abort();
+ }
+}
+
+use displaydoc::Display;
+
+/// this type is pretty swell
+#[derive(Display)]
+enum TestType {
+ /// This one is okay
+ Variant1,
+
+ /// Multi
+ /// line
+ /// doc.
+ Variant2,
+}
+
+static_assertions::assert_impl_all!(label; TestType, core::fmt::Display);
+
+#[cfg(feature = "std")]
+fn main() {}
diff --git a/vendor/displaydoc/tests/no_std/multi_line.stderr b/vendor/displaydoc/tests/no_std/multi_line.stderr
new file mode 100644
index 000000000..e23d134c8
--- /dev/null
+++ b/vendor/displaydoc/tests/no_std/multi_line.stderr
@@ -0,0 +1,19 @@
+error: proc-macro derive panicked
+ --> $DIR/multi_line.rs:23:10
+ |
+23 | #[derive(Display)]
+ | ^^^^^^^
+ |
+ = help: message: Multi-line comments are disabled by default by displaydoc. Please consider using block doc comments (/** */) or adding the #[ignore_extra_doc_attributes] attribute to your type next to the derive.
+
+error[E0277]: `TestType` doesn't implement `Display`
+ --> $DIR/multi_line.rs:34:44
+ |
+34 | static_assertions::assert_impl_all!(label; TestType, core::fmt::Display);
+ | -------------------------------------------^^^^^^^^----------------------
+ | | |
+ | | `TestType` cannot be formatted with the default formatter
+ | required by this bound in `assert_impl_all`
+ |
+ = help: the trait `Display` is not implemented for `TestType`
+ = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead
diff --git a/vendor/displaydoc/tests/no_std/multi_line_allow.rs b/vendor/displaydoc/tests/no_std/multi_line_allow.rs
new file mode 100644
index 000000000..05bdcf9fb
--- /dev/null
+++ b/vendor/displaydoc/tests/no_std/multi_line_allow.rs
@@ -0,0 +1,38 @@
+#![cfg_attr(not(feature = "std"), feature(lang_items, start))]
+#![cfg_attr(not(feature = "std"), no_std)]
+
+#[cfg_attr(not(feature = "std"), start)]
+fn start(_argc: isize, _argv: *const *const u8) -> isize {
+ 0
+}
+#[lang = "eh_personality"]
+#[no_mangle]
+#[cfg(not(feature = "std"))]
+pub extern "C" fn rust_eh_personality() {}
+#[panic_handler]
+#[cfg(not(feature = "std"))]
+fn panic(_info: &core::panic::PanicInfo) -> ! {
+ unsafe {
+ libc::abort();
+ }
+}
+
+use displaydoc::Display;
+
+/// this type is pretty swell
+#[derive(Display)]
+#[ignore_extra_doc_attributes]
+enum TestType {
+ /// This one is okay
+ Variant1,
+
+ /// Multi
+ /// line
+ /// doc.
+ Variant2,
+}
+
+static_assertions::assert_impl_all!(label; TestType, core::fmt::Display);
+
+#[cfg(feature = "std")]
+fn main() {}
diff --git a/vendor/displaydoc/tests/no_std/with.rs b/vendor/displaydoc/tests/no_std/with.rs
new file mode 100644
index 000000000..7de3da67f
--- /dev/null
+++ b/vendor/displaydoc/tests/no_std/with.rs
@@ -0,0 +1,32 @@
+#![feature(lang_items, start)]
+#![no_std]
+
+#[start]
+#[cfg(not(feature = "std"))]
+fn start(_argc: isize, _argv: *const *const u8) -> isize {
+ 0
+}
+
+#[lang = "eh_personality"]
+#[no_mangle]
+#[cfg(not(feature = "std"))]
+pub extern "C" fn rust_eh_personality() {}
+
+#[panic_handler]
+#[cfg(not(feature = "std"))]
+fn panic(_info: &core::panic::PanicInfo) -> ! {
+ unsafe {
+ libc::abort();
+ }
+}
+
+#[cfg(feature = "std")]
+fn main() {}
+
+use displaydoc::Display;
+
+/// this type is pretty swell
+#[derive(Display)]
+struct FakeType;
+
+static_assertions::assert_impl_all!(label; FakeType, core::fmt::Display);
diff --git a/vendor/displaydoc/tests/no_std/without.rs b/vendor/displaydoc/tests/no_std/without.rs
new file mode 100644
index 000000000..32905aad9
--- /dev/null
+++ b/vendor/displaydoc/tests/no_std/without.rs
@@ -0,0 +1,28 @@
+#![cfg_attr(not(feature = "std"), feature(lang_items, start))]
+#![cfg_attr(not(feature = "std"), no_std)]
+
+#[cfg_attr(not(feature = "std"), start)]
+fn start(_argc: isize, _argv: *const *const u8) -> isize {
+ 0
+}
+#[lang = "eh_personality"]
+#[no_mangle]
+#[cfg(not(feature = "std"))]
+pub extern "C" fn rust_eh_personality() {}
+#[panic_handler]
+#[cfg(not(feature = "std"))]
+fn panic(_info: &core::panic::PanicInfo) -> ! {
+ unsafe {
+ libc::abort();
+ }
+}
+
+use displaydoc::Display;
+
+/// this type is pretty swell
+struct FakeType;
+
+static_assertions::assert_impl_all!(label; FakeType, core::fmt::Display);
+
+#[cfg(feature = "std")]
+fn main() {}
diff --git a/vendor/displaydoc/tests/no_std/without.stderr b/vendor/displaydoc/tests/no_std/without.stderr
new file mode 100644
index 000000000..81de13b74
--- /dev/null
+++ b/vendor/displaydoc/tests/no_std/without.stderr
@@ -0,0 +1,19 @@
+warning: unused import: `displaydoc::Display`
+ --> $DIR/without.rs:20:5
+ |
+20 | use displaydoc::Display;
+ | ^^^^^^^^^^^^^^^^^^^
+ |
+ = note: `#[warn(unused_imports)]` on by default
+
+error[E0277]: `FakeType` doesn't implement `Display`
+ --> $DIR/without.rs:25:44
+ |
+25 | static_assertions::assert_impl_all!(label; FakeType, core::fmt::Display);
+ | -------------------------------------------^^^^^^^^----------------------
+ | | |
+ | | `FakeType` cannot be formatted with the default formatter
+ | required by this bound in `assert_impl_all`
+ |
+ = help: the trait `Display` is not implemented for `FakeType`
+ = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead