From 66ed1812cfaf3c7dd47643140f8e1380204f7234 Mon Sep 17 00:00:00 2001 From: Ezra Shaw Date: Tue, 20 Dec 2022 23:30:14 +1300 Subject: docs/test: add UI test and long-form error docs for E0462 --- src/test/ui/error-codes/E0462.rs | 11 +++++++++++ src/test/ui/error-codes/E0462.stderr | 13 +++++++++++++ src/test/ui/error-codes/auxiliary/found-staticlib.rs | 4 ++++ src/tools/tidy/src/error_codes_check.rs | 4 ++-- 4 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 src/test/ui/error-codes/E0462.rs create mode 100644 src/test/ui/error-codes/E0462.stderr create mode 100644 src/test/ui/error-codes/auxiliary/found-staticlib.rs (limited to 'src') diff --git a/src/test/ui/error-codes/E0462.rs b/src/test/ui/error-codes/E0462.rs new file mode 100644 index 00000000000..f839ee783b5 --- /dev/null +++ b/src/test/ui/error-codes/E0462.rs @@ -0,0 +1,11 @@ +// aux-build:found-staticlib.rs + +// normalize-stderr-test: "\.nll/" -> "/" +// normalize-stderr-test: "\\\?\\" -> "" +// normalize-stderr-test: "(lib)?found_staticlib\.[a-z]+" -> "libfound_staticlib.somelib" + +extern crate found_staticlib; //~ ERROR E0462 + +fn main() { + found_staticlib::foo(); +} diff --git a/src/test/ui/error-codes/E0462.stderr b/src/test/ui/error-codes/E0462.stderr new file mode 100644 index 00000000000..43e27965ffc --- /dev/null +++ b/src/test/ui/error-codes/E0462.stderr @@ -0,0 +1,13 @@ +error[E0462]: found staticlib `found_staticlib` instead of rlib or dylib + --> $DIR/E0462.rs:7:1 + | +LL | extern crate found_staticlib; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: the following crate versions were found: + crate `found_staticlib`: $TEST_BUILD_DIR/error-codes/E0462/auxiliary/libfound_staticlib.somelib + = help: please recompile that crate using --crate-type lib + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0462`. diff --git a/src/test/ui/error-codes/auxiliary/found-staticlib.rs b/src/test/ui/error-codes/auxiliary/found-staticlib.rs new file mode 100644 index 00000000000..04e2c59789d --- /dev/null +++ b/src/test/ui/error-codes/auxiliary/found-staticlib.rs @@ -0,0 +1,4 @@ +// no-prefer-dynamic +#![crate_type = "staticlib"] + +pub fn foo() {} diff --git a/src/tools/tidy/src/error_codes_check.rs b/src/tools/tidy/src/error_codes_check.rs index 1b119e4113e..49fc2ceb3a2 100644 --- a/src/tools/tidy/src/error_codes_check.rs +++ b/src/tools/tidy/src/error_codes_check.rs @@ -11,8 +11,8 @@ use regex::Regex; // A few of those error codes can't be tested but all the others can and *should* be tested! const EXEMPTED_FROM_TEST: &[&str] = &[ - "E0313", "E0461", "E0462", "E0465", "E0476", "E0490", "E0514", "E0519", "E0523", "E0554", - "E0640", "E0717", "E0729", "E0789", + "E0313", "E0461", "E0465", "E0476", "E0490", "E0514", "E0519", "E0523", "E0554", "E0640", + "E0717", "E0729", "E0789", ]; // Some error codes don't have any tests apparently... -- cgit 1.4.1-3-g733a5