From f884f18151d63ac9ce7e573cadb165ecbe8d7f9b Mon Sep 17 00:00:00 2001 From: Zalathar Date: Sat, 7 Dec 2024 12:35:19 +1100 Subject: Move tests for `-l` and `#[link(..)]` into `tests/ui/link-native-libs` --- tests/ui/link-native-libs/empty-kind-1.rs | 6 +++++ tests/ui/link-native-libs/empty-kind-1.stderr | 2 ++ tests/ui/link-native-libs/empty-kind-2.rs | 6 +++++ tests/ui/link-native-libs/empty-kind-2.stderr | 2 ++ tests/ui/link-native-libs/link-arg-error.rs | 4 ++++ tests/ui/link-native-libs/link-arg-error.stderr | 2 ++ tests/ui/link-native-libs/link-arg-from-rs.rs | 7 ++++++ tests/ui/link-native-libs/link-arg-from-rs.stderr | 8 +++++++ tests/ui/link-native-libs/manual-link-bad-form.rs | 5 ++++ .../link-native-libs/manual-link-bad-form.stderr | 2 ++ tests/ui/link-native-libs/manual-link-bad-kind.rs | 5 ++++ .../link-native-libs/manual-link-bad-kind.stderr | 2 ++ .../manual-link-bad-search-path.rs | 5 ++++ .../manual-link-bad-search-path.stderr | 2 ++ tests/ui/link-native-libs/manual-link-framework.rs | 5 ++++ .../link-native-libs/manual-link-framework.stderr | 4 ++++ .../manual-link-unsupported-kind.rs | 5 ++++ .../manual-link-unsupported-kind.stderr | 2 ++ .../ui/link-native-libs/modifiers-bad.blank.stderr | 2 ++ .../modifiers-bad.no-prefix.stderr | 2 ++ .../modifiers-bad.prefix-only.stderr | 2 ++ tests/ui/link-native-libs/modifiers-bad.rs | 11 +++++++++ .../link-native-libs/modifiers-bad.unknown.stderr | 2 ++ tests/ui/link-native-libs/modifiers-override-2.rs | 3 +++ .../link-native-libs/modifiers-override-2.stderr | 2 ++ tests/ui/link-native-libs/modifiers-override-3.rs | 7 ++++++ .../link-native-libs/modifiers-override-3.stderr | 4 ++++ tests/ui/link-native-libs/modifiers-override.rs | 16 +++++++++++++ .../ui/link-native-libs/modifiers-override.stderr | 28 ++++++++++++++++++++++ tests/ui/link-native-libs/msvc-non-utf8-output.rs | 5 ++++ .../link-native-libs/msvc-non-utf8-output.stderr | 1 + .../ui/link-native-libs/suggest-libname-only-1.rs | 9 +++++++ .../link-native-libs/suggest-libname-only-1.stderr | 6 +++++ .../ui/link-native-libs/suggest-libname-only-2.rs | 9 +++++++ .../link-native-libs/suggest-libname-only-2.stderr | 6 +++++ tests/ui/manual/manual-link-bad-form.rs | 5 ---- tests/ui/manual/manual-link-bad-form.stderr | 2 -- tests/ui/manual/manual-link-bad-kind.rs | 5 ---- tests/ui/manual/manual-link-bad-kind.stderr | 2 -- tests/ui/manual/manual-link-bad-search-path.rs | 5 ---- tests/ui/manual/manual-link-bad-search-path.stderr | 2 -- tests/ui/manual/manual-link-framework.rs | 5 ---- tests/ui/manual/manual-link-framework.stderr | 4 ---- tests/ui/manual/manual-link-unsupported-kind.rs | 5 ---- .../ui/manual/manual-link-unsupported-kind.stderr | 2 -- tests/ui/native-library-link-flags/empty-kind-1.rs | 6 ----- .../native-library-link-flags/empty-kind-1.stderr | 2 -- tests/ui/native-library-link-flags/empty-kind-2.rs | 6 ----- .../native-library-link-flags/empty-kind-2.stderr | 2 -- .../ui/native-library-link-flags/link-arg-error.rs | 4 ---- .../link-arg-error.stderr | 2 -- .../native-library-link-flags/link-arg-from-rs.rs | 7 ------ .../link-arg-from-rs.stderr | 8 ------- .../modifiers-bad.blank.stderr | 2 -- .../modifiers-bad.no-prefix.stderr | 2 -- .../modifiers-bad.prefix-only.stderr | 2 -- .../ui/native-library-link-flags/modifiers-bad.rs | 11 --------- .../modifiers-bad.unknown.stderr | 2 -- .../modifiers-override-2.rs | 3 --- .../modifiers-override-2.stderr | 2 -- .../modifiers-override-3.rs | 7 ------ .../modifiers-override-3.stderr | 4 ---- .../modifiers-override.rs | 16 ------------- .../modifiers-override.stderr | 28 ---------------------- .../msvc-non-utf8-output.rs | 5 ---- .../msvc-non-utf8-output.stderr | 1 - .../suggest-libname-only-1.rs | 9 ------- .../suggest-libname-only-1.stderr | 6 ----- .../suggest-libname-only-2.rs | 9 ------- .../suggest-libname-only-2.stderr | 6 ----- 70 files changed, 189 insertions(+), 189 deletions(-) create mode 100644 tests/ui/link-native-libs/empty-kind-1.rs create mode 100644 tests/ui/link-native-libs/empty-kind-1.stderr create mode 100644 tests/ui/link-native-libs/empty-kind-2.rs create mode 100644 tests/ui/link-native-libs/empty-kind-2.stderr create mode 100644 tests/ui/link-native-libs/link-arg-error.rs create mode 100644 tests/ui/link-native-libs/link-arg-error.stderr create mode 100644 tests/ui/link-native-libs/link-arg-from-rs.rs create mode 100644 tests/ui/link-native-libs/link-arg-from-rs.stderr create mode 100644 tests/ui/link-native-libs/manual-link-bad-form.rs create mode 100644 tests/ui/link-native-libs/manual-link-bad-form.stderr create mode 100644 tests/ui/link-native-libs/manual-link-bad-kind.rs create mode 100644 tests/ui/link-native-libs/manual-link-bad-kind.stderr create mode 100644 tests/ui/link-native-libs/manual-link-bad-search-path.rs create mode 100644 tests/ui/link-native-libs/manual-link-bad-search-path.stderr create mode 100644 tests/ui/link-native-libs/manual-link-framework.rs create mode 100644 tests/ui/link-native-libs/manual-link-framework.stderr create mode 100644 tests/ui/link-native-libs/manual-link-unsupported-kind.rs create mode 100644 tests/ui/link-native-libs/manual-link-unsupported-kind.stderr create mode 100644 tests/ui/link-native-libs/modifiers-bad.blank.stderr create mode 100644 tests/ui/link-native-libs/modifiers-bad.no-prefix.stderr create mode 100644 tests/ui/link-native-libs/modifiers-bad.prefix-only.stderr create mode 100644 tests/ui/link-native-libs/modifiers-bad.rs create mode 100644 tests/ui/link-native-libs/modifiers-bad.unknown.stderr create mode 100644 tests/ui/link-native-libs/modifiers-override-2.rs create mode 100644 tests/ui/link-native-libs/modifiers-override-2.stderr create mode 100644 tests/ui/link-native-libs/modifiers-override-3.rs create mode 100644 tests/ui/link-native-libs/modifiers-override-3.stderr create mode 100644 tests/ui/link-native-libs/modifiers-override.rs create mode 100644 tests/ui/link-native-libs/modifiers-override.stderr create mode 100644 tests/ui/link-native-libs/msvc-non-utf8-output.rs create mode 100644 tests/ui/link-native-libs/msvc-non-utf8-output.stderr create mode 100644 tests/ui/link-native-libs/suggest-libname-only-1.rs create mode 100644 tests/ui/link-native-libs/suggest-libname-only-1.stderr create mode 100644 tests/ui/link-native-libs/suggest-libname-only-2.rs create mode 100644 tests/ui/link-native-libs/suggest-libname-only-2.stderr delete mode 100644 tests/ui/manual/manual-link-bad-form.rs delete mode 100644 tests/ui/manual/manual-link-bad-form.stderr delete mode 100644 tests/ui/manual/manual-link-bad-kind.rs delete mode 100644 tests/ui/manual/manual-link-bad-kind.stderr delete mode 100644 tests/ui/manual/manual-link-bad-search-path.rs delete mode 100644 tests/ui/manual/manual-link-bad-search-path.stderr delete mode 100644 tests/ui/manual/manual-link-framework.rs delete mode 100644 tests/ui/manual/manual-link-framework.stderr delete mode 100644 tests/ui/manual/manual-link-unsupported-kind.rs delete mode 100644 tests/ui/manual/manual-link-unsupported-kind.stderr delete mode 100644 tests/ui/native-library-link-flags/empty-kind-1.rs delete mode 100644 tests/ui/native-library-link-flags/empty-kind-1.stderr delete mode 100644 tests/ui/native-library-link-flags/empty-kind-2.rs delete mode 100644 tests/ui/native-library-link-flags/empty-kind-2.stderr delete mode 100644 tests/ui/native-library-link-flags/link-arg-error.rs delete mode 100644 tests/ui/native-library-link-flags/link-arg-error.stderr delete mode 100644 tests/ui/native-library-link-flags/link-arg-from-rs.rs delete mode 100644 tests/ui/native-library-link-flags/link-arg-from-rs.stderr delete mode 100644 tests/ui/native-library-link-flags/modifiers-bad.blank.stderr delete mode 100644 tests/ui/native-library-link-flags/modifiers-bad.no-prefix.stderr delete mode 100644 tests/ui/native-library-link-flags/modifiers-bad.prefix-only.stderr delete mode 100644 tests/ui/native-library-link-flags/modifiers-bad.rs delete mode 100644 tests/ui/native-library-link-flags/modifiers-bad.unknown.stderr delete mode 100644 tests/ui/native-library-link-flags/modifiers-override-2.rs delete mode 100644 tests/ui/native-library-link-flags/modifiers-override-2.stderr delete mode 100644 tests/ui/native-library-link-flags/modifiers-override-3.rs delete mode 100644 tests/ui/native-library-link-flags/modifiers-override-3.stderr delete mode 100644 tests/ui/native-library-link-flags/modifiers-override.rs delete mode 100644 tests/ui/native-library-link-flags/modifiers-override.stderr delete mode 100644 tests/ui/native-library-link-flags/msvc-non-utf8-output.rs delete mode 100644 tests/ui/native-library-link-flags/msvc-non-utf8-output.stderr delete mode 100644 tests/ui/native-library-link-flags/suggest-libname-only-1.rs delete mode 100644 tests/ui/native-library-link-flags/suggest-libname-only-1.stderr delete mode 100644 tests/ui/native-library-link-flags/suggest-libname-only-2.rs delete mode 100644 tests/ui/native-library-link-flags/suggest-libname-only-2.stderr diff --git a/tests/ui/link-native-libs/empty-kind-1.rs b/tests/ui/link-native-libs/empty-kind-1.rs new file mode 100644 index 00000000000..d9b8d8a7f7d --- /dev/null +++ b/tests/ui/link-native-libs/empty-kind-1.rs @@ -0,0 +1,6 @@ +// Unspecified kind should fail with an error + +//@ compile-flags: -l =mylib +//@ error-pattern: unknown library kind ``, expected one of: static, dylib, framework, link-arg + +fn main() {} diff --git a/tests/ui/link-native-libs/empty-kind-1.stderr b/tests/ui/link-native-libs/empty-kind-1.stderr new file mode 100644 index 00000000000..3e5b0549339 --- /dev/null +++ b/tests/ui/link-native-libs/empty-kind-1.stderr @@ -0,0 +1,2 @@ +error: unknown library kind ``, expected one of: static, dylib, framework, link-arg + diff --git a/tests/ui/link-native-libs/empty-kind-2.rs b/tests/ui/link-native-libs/empty-kind-2.rs new file mode 100644 index 00000000000..16cb3b917e4 --- /dev/null +++ b/tests/ui/link-native-libs/empty-kind-2.rs @@ -0,0 +1,6 @@ +// Unspecified kind should fail with an error + +//@ compile-flags: -l :+bundle=mylib +//@ error-pattern: unknown library kind ``, expected one of: static, dylib, framework, link-arg + +fn main() {} diff --git a/tests/ui/link-native-libs/empty-kind-2.stderr b/tests/ui/link-native-libs/empty-kind-2.stderr new file mode 100644 index 00000000000..3e5b0549339 --- /dev/null +++ b/tests/ui/link-native-libs/empty-kind-2.stderr @@ -0,0 +1,2 @@ +error: unknown library kind ``, expected one of: static, dylib, framework, link-arg + diff --git a/tests/ui/link-native-libs/link-arg-error.rs b/tests/ui/link-native-libs/link-arg-error.rs new file mode 100644 index 00000000000..4defb108178 --- /dev/null +++ b/tests/ui/link-native-libs/link-arg-error.rs @@ -0,0 +1,4 @@ +//@ compile-flags: -l link-arg:+bundle=arg -Z unstable-options +//@ error-pattern: linking modifier `bundle` is only compatible with `static` linking kind + +fn main() {} diff --git a/tests/ui/link-native-libs/link-arg-error.stderr b/tests/ui/link-native-libs/link-arg-error.stderr new file mode 100644 index 00000000000..e1d01e14152 --- /dev/null +++ b/tests/ui/link-native-libs/link-arg-error.stderr @@ -0,0 +1,2 @@ +error: linking modifier `bundle` is only compatible with `static` linking kind + diff --git a/tests/ui/link-native-libs/link-arg-from-rs.rs b/tests/ui/link-native-libs/link-arg-from-rs.rs new file mode 100644 index 00000000000..4a6017fea33 --- /dev/null +++ b/tests/ui/link-native-libs/link-arg-from-rs.rs @@ -0,0 +1,7 @@ +#![feature(link_arg_attribute)] + +#[link(kind = "link-arg", name = "arg", modifiers = "+bundle")] +//~^ ERROR linking modifier `bundle` is only compatible with `static` linking kind +extern "C" {} + +pub fn main() {} diff --git a/tests/ui/link-native-libs/link-arg-from-rs.stderr b/tests/ui/link-native-libs/link-arg-from-rs.stderr new file mode 100644 index 00000000000..f31e15f1da6 --- /dev/null +++ b/tests/ui/link-native-libs/link-arg-from-rs.stderr @@ -0,0 +1,8 @@ +error: linking modifier `bundle` is only compatible with `static` linking kind + --> $DIR/link-arg-from-rs.rs:3:53 + | +LL | #[link(kind = "link-arg", name = "arg", modifiers = "+bundle")] + | ^^^^^^^^^ + +error: aborting due to 1 previous error + diff --git a/tests/ui/link-native-libs/manual-link-bad-form.rs b/tests/ui/link-native-libs/manual-link-bad-form.rs new file mode 100644 index 00000000000..0f5723adec9 --- /dev/null +++ b/tests/ui/link-native-libs/manual-link-bad-form.rs @@ -0,0 +1,5 @@ +//@ compile-flags:-l static= +//@ error-pattern: library name must not be empty + +fn main() { +} diff --git a/tests/ui/link-native-libs/manual-link-bad-form.stderr b/tests/ui/link-native-libs/manual-link-bad-form.stderr new file mode 100644 index 00000000000..7fd7a1066b4 --- /dev/null +++ b/tests/ui/link-native-libs/manual-link-bad-form.stderr @@ -0,0 +1,2 @@ +error: library name must not be empty + diff --git a/tests/ui/link-native-libs/manual-link-bad-kind.rs b/tests/ui/link-native-libs/manual-link-bad-kind.rs new file mode 100644 index 00000000000..d070faa6574 --- /dev/null +++ b/tests/ui/link-native-libs/manual-link-bad-kind.rs @@ -0,0 +1,5 @@ +//@ compile-flags:-l bar=foo +//@ error-pattern: unknown library kind `bar`, expected one of: static, dylib, framework, link-arg + +fn main() { +} diff --git a/tests/ui/link-native-libs/manual-link-bad-kind.stderr b/tests/ui/link-native-libs/manual-link-bad-kind.stderr new file mode 100644 index 00000000000..647c4c61e02 --- /dev/null +++ b/tests/ui/link-native-libs/manual-link-bad-kind.stderr @@ -0,0 +1,2 @@ +error: unknown library kind `bar`, expected one of: static, dylib, framework, link-arg + diff --git a/tests/ui/link-native-libs/manual-link-bad-search-path.rs b/tests/ui/link-native-libs/manual-link-bad-search-path.rs new file mode 100644 index 00000000000..c9ced4734fc --- /dev/null +++ b/tests/ui/link-native-libs/manual-link-bad-search-path.rs @@ -0,0 +1,5 @@ +//@ compile-flags:-L native= +//@ error-pattern: empty search path given via `-L` + +fn main() { +} diff --git a/tests/ui/link-native-libs/manual-link-bad-search-path.stderr b/tests/ui/link-native-libs/manual-link-bad-search-path.stderr new file mode 100644 index 00000000000..2c0649ea152 --- /dev/null +++ b/tests/ui/link-native-libs/manual-link-bad-search-path.stderr @@ -0,0 +1,2 @@ +error: empty search path given via `-L` + diff --git a/tests/ui/link-native-libs/manual-link-framework.rs b/tests/ui/link-native-libs/manual-link-framework.rs new file mode 100644 index 00000000000..43cdda0a4e6 --- /dev/null +++ b/tests/ui/link-native-libs/manual-link-framework.rs @@ -0,0 +1,5 @@ +//@ ignore-apple +//@ compile-flags:-l framework=foo +//@ error-pattern: library kind `framework` is only supported on Apple targets + +fn main() {} diff --git a/tests/ui/link-native-libs/manual-link-framework.stderr b/tests/ui/link-native-libs/manual-link-framework.stderr new file mode 100644 index 00000000000..38d2302a48d --- /dev/null +++ b/tests/ui/link-native-libs/manual-link-framework.stderr @@ -0,0 +1,4 @@ +error: library kind `framework` is only supported on Apple targets + +error: aborting due to 1 previous error + diff --git a/tests/ui/link-native-libs/manual-link-unsupported-kind.rs b/tests/ui/link-native-libs/manual-link-unsupported-kind.rs new file mode 100644 index 00000000000..b5b9e3e6577 --- /dev/null +++ b/tests/ui/link-native-libs/manual-link-unsupported-kind.rs @@ -0,0 +1,5 @@ +//@ compile-flags:-l raw-dylib=foo +//@ error-pattern: unknown library kind `raw-dylib`, expected one of: static, dylib, framework, link-arg + +fn main() { +} diff --git a/tests/ui/link-native-libs/manual-link-unsupported-kind.stderr b/tests/ui/link-native-libs/manual-link-unsupported-kind.stderr new file mode 100644 index 00000000000..ae4a1ec9a95 --- /dev/null +++ b/tests/ui/link-native-libs/manual-link-unsupported-kind.stderr @@ -0,0 +1,2 @@ +error: unknown library kind `raw-dylib`, expected one of: static, dylib, framework, link-arg + diff --git a/tests/ui/link-native-libs/modifiers-bad.blank.stderr b/tests/ui/link-native-libs/modifiers-bad.blank.stderr new file mode 100644 index 00000000000..ea36af0b4cf --- /dev/null +++ b/tests/ui/link-native-libs/modifiers-bad.blank.stderr @@ -0,0 +1,2 @@ +error: invalid linking modifier syntax, expected '+' or '-' prefix before one of: bundle, verbatim, whole-archive, as-needed + diff --git a/tests/ui/link-native-libs/modifiers-bad.no-prefix.stderr b/tests/ui/link-native-libs/modifiers-bad.no-prefix.stderr new file mode 100644 index 00000000000..ea36af0b4cf --- /dev/null +++ b/tests/ui/link-native-libs/modifiers-bad.no-prefix.stderr @@ -0,0 +1,2 @@ +error: invalid linking modifier syntax, expected '+' or '-' prefix before one of: bundle, verbatim, whole-archive, as-needed + diff --git a/tests/ui/link-native-libs/modifiers-bad.prefix-only.stderr b/tests/ui/link-native-libs/modifiers-bad.prefix-only.stderr new file mode 100644 index 00000000000..1e701374688 --- /dev/null +++ b/tests/ui/link-native-libs/modifiers-bad.prefix-only.stderr @@ -0,0 +1,2 @@ +error: unknown linking modifier ``, expected one of: bundle, verbatim, whole-archive, as-needed + diff --git a/tests/ui/link-native-libs/modifiers-bad.rs b/tests/ui/link-native-libs/modifiers-bad.rs new file mode 100644 index 00000000000..185201e0d84 --- /dev/null +++ b/tests/ui/link-native-libs/modifiers-bad.rs @@ -0,0 +1,11 @@ +//@ edition: 2021 +//@ revisions: blank no-prefix prefix-only unknown + +//@[blank] compile-flags: -l static:=foo +//@[no-prefix] compile-flags: -l static:bundle=foo +//@[prefix-only] compile-flags: -l static:+=foo +//@[unknown] compile-flags: -l static:+ferris=foo + +// Tests various illegal values for the "modifier" part of an `-l` flag. + +fn main() {} diff --git a/tests/ui/link-native-libs/modifiers-bad.unknown.stderr b/tests/ui/link-native-libs/modifiers-bad.unknown.stderr new file mode 100644 index 00000000000..75950ad9c64 --- /dev/null +++ b/tests/ui/link-native-libs/modifiers-bad.unknown.stderr @@ -0,0 +1,2 @@ +error: unknown linking modifier `ferris`, expected one of: bundle, verbatim, whole-archive, as-needed + diff --git a/tests/ui/link-native-libs/modifiers-override-2.rs b/tests/ui/link-native-libs/modifiers-override-2.rs new file mode 100644 index 00000000000..a462a741ac6 --- /dev/null +++ b/tests/ui/link-native-libs/modifiers-override-2.rs @@ -0,0 +1,3 @@ +//@ compile-flags:-lstatic:+whole-archive,-whole-archive=foo + +fn main() {} diff --git a/tests/ui/link-native-libs/modifiers-override-2.stderr b/tests/ui/link-native-libs/modifiers-override-2.stderr new file mode 100644 index 00000000000..aa5b59c5b6f --- /dev/null +++ b/tests/ui/link-native-libs/modifiers-override-2.stderr @@ -0,0 +1,2 @@ +error: multiple `whole-archive` modifiers in a single `-l` option + diff --git a/tests/ui/link-native-libs/modifiers-override-3.rs b/tests/ui/link-native-libs/modifiers-override-3.rs new file mode 100644 index 00000000000..d05735ad616 --- /dev/null +++ b/tests/ui/link-native-libs/modifiers-override-3.rs @@ -0,0 +1,7 @@ +// Regression test for issue #97299, one command line library with modifiers +// overrides another command line library with modifiers. + +//@ compile-flags:-lstatic:+whole-archive=foo -lstatic:+whole-archive=foo +//@ error-pattern: overriding linking modifiers from command line is not supported + +fn main() {} diff --git a/tests/ui/link-native-libs/modifiers-override-3.stderr b/tests/ui/link-native-libs/modifiers-override-3.stderr new file mode 100644 index 00000000000..3eb9459f6f3 --- /dev/null +++ b/tests/ui/link-native-libs/modifiers-override-3.stderr @@ -0,0 +1,4 @@ +error: overriding linking modifiers from command line is not supported + +error: aborting due to 1 previous error + diff --git a/tests/ui/link-native-libs/modifiers-override.rs b/tests/ui/link-native-libs/modifiers-override.rs new file mode 100644 index 00000000000..cd2d003664a --- /dev/null +++ b/tests/ui/link-native-libs/modifiers-override.rs @@ -0,0 +1,16 @@ +//@ compile-flags:-ldylib:+as-needed=foo -lstatic=bar -Zunstable-options + +#[link(name = "foo")] +#[link( + name = "bar", + kind = "static", + modifiers = "+whole-archive,-whole-archive", + //~^ ERROR multiple `whole-archive` modifiers in a single `modifiers` argument + modifiers = "+bundle" + //~^ ERROR multiple `modifiers` arguments in a single `#[link]` attribute +)] +extern "C" {} +//~^ ERROR overriding linking modifiers from command line is not supported +//~| ERROR overriding linking modifiers from command line is not supported + +fn main() {} diff --git a/tests/ui/link-native-libs/modifiers-override.stderr b/tests/ui/link-native-libs/modifiers-override.stderr new file mode 100644 index 00000000000..64427651e9f --- /dev/null +++ b/tests/ui/link-native-libs/modifiers-override.stderr @@ -0,0 +1,28 @@ +error: multiple `modifiers` arguments in a single `#[link]` attribute + --> $DIR/modifiers-override.rs:9:5 + | +LL | modifiers = "+bundle" + | ^^^^^^^^^^^^^^^^^^^^^ + +error: multiple `whole-archive` modifiers in a single `modifiers` argument + --> $DIR/modifiers-override.rs:7:17 + | +LL | modifiers = "+whole-archive,-whole-archive", + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: overriding linking modifiers from command line is not supported + --> $DIR/modifiers-override.rs:12:1 + | +LL | extern "C" {} + | ^^^^^^^^^^^^^ + +error: overriding linking modifiers from command line is not supported + --> $DIR/modifiers-override.rs:12:1 + | +LL | extern "C" {} + | ^^^^^^^^^^^^^ + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: aborting due to 4 previous errors + diff --git a/tests/ui/link-native-libs/msvc-non-utf8-output.rs b/tests/ui/link-native-libs/msvc-non-utf8-output.rs new file mode 100644 index 00000000000..659a832247a --- /dev/null +++ b/tests/ui/link-native-libs/msvc-non-utf8-output.rs @@ -0,0 +1,5 @@ +//@ build-fail +//@ compile-flags:-C link-arg=⦺ⅈ⽯⭏⽽◃⡽⚞ +//@ only-msvc +//@ normalize-stderr-test: "(?:.|\n)*(⦺ⅈ⽯⭏⽽◃⡽⚞)(?:.|\n)*" -> "$1" +pub fn main() {} diff --git a/tests/ui/link-native-libs/msvc-non-utf8-output.stderr b/tests/ui/link-native-libs/msvc-non-utf8-output.stderr new file mode 100644 index 00000000000..7f3ef376447 --- /dev/null +++ b/tests/ui/link-native-libs/msvc-non-utf8-output.stderr @@ -0,0 +1 @@ +⦺ⅈ⽯⭏⽽◃⡽⚞ \ No newline at end of file diff --git a/tests/ui/link-native-libs/suggest-libname-only-1.rs b/tests/ui/link-native-libs/suggest-libname-only-1.rs new file mode 100644 index 00000000000..328181fb5cb --- /dev/null +++ b/tests/ui/link-native-libs/suggest-libname-only-1.rs @@ -0,0 +1,9 @@ +//@ build-fail +//@ compile-flags: --crate-type rlib +//@ error-pattern: could not find native static library `libfoo.a` +//@ error-pattern: only provide the library name `foo`, not the full filename + +#[link(name = "libfoo.a", kind = "static")] +extern { } + +pub fn main() { } diff --git a/tests/ui/link-native-libs/suggest-libname-only-1.stderr b/tests/ui/link-native-libs/suggest-libname-only-1.stderr new file mode 100644 index 00000000000..e142835a9d6 --- /dev/null +++ b/tests/ui/link-native-libs/suggest-libname-only-1.stderr @@ -0,0 +1,6 @@ +error: could not find native static library `libfoo.a`, perhaps an -L flag is missing? + | + = help: only provide the library name `foo`, not the full filename + +error: aborting due to 1 previous error + diff --git a/tests/ui/link-native-libs/suggest-libname-only-2.rs b/tests/ui/link-native-libs/suggest-libname-only-2.rs new file mode 100644 index 00000000000..7ed106e4ab4 --- /dev/null +++ b/tests/ui/link-native-libs/suggest-libname-only-2.rs @@ -0,0 +1,9 @@ +//@ build-fail +//@ compile-flags: --crate-type rlib +//@ error-pattern: could not find native static library `bar.lib` +//@ error-pattern: only provide the library name `bar`, not the full filename + +#[link(name = "bar.lib", kind = "static")] +extern { } + +pub fn main() { } diff --git a/tests/ui/link-native-libs/suggest-libname-only-2.stderr b/tests/ui/link-native-libs/suggest-libname-only-2.stderr new file mode 100644 index 00000000000..392d2f01f61 --- /dev/null +++ b/tests/ui/link-native-libs/suggest-libname-only-2.stderr @@ -0,0 +1,6 @@ +error: could not find native static library `bar.lib`, perhaps an -L flag is missing? + | + = help: only provide the library name `bar`, not the full filename + +error: aborting due to 1 previous error + diff --git a/tests/ui/manual/manual-link-bad-form.rs b/tests/ui/manual/manual-link-bad-form.rs deleted file mode 100644 index 0f5723adec9..00000000000 --- a/tests/ui/manual/manual-link-bad-form.rs +++ /dev/null @@ -1,5 +0,0 @@ -//@ compile-flags:-l static= -//@ error-pattern: library name must not be empty - -fn main() { -} diff --git a/tests/ui/manual/manual-link-bad-form.stderr b/tests/ui/manual/manual-link-bad-form.stderr deleted file mode 100644 index 7fd7a1066b4..00000000000 --- a/tests/ui/manual/manual-link-bad-form.stderr +++ /dev/null @@ -1,2 +0,0 @@ -error: library name must not be empty - diff --git a/tests/ui/manual/manual-link-bad-kind.rs b/tests/ui/manual/manual-link-bad-kind.rs deleted file mode 100644 index d070faa6574..00000000000 --- a/tests/ui/manual/manual-link-bad-kind.rs +++ /dev/null @@ -1,5 +0,0 @@ -//@ compile-flags:-l bar=foo -//@ error-pattern: unknown library kind `bar`, expected one of: static, dylib, framework, link-arg - -fn main() { -} diff --git a/tests/ui/manual/manual-link-bad-kind.stderr b/tests/ui/manual/manual-link-bad-kind.stderr deleted file mode 100644 index 647c4c61e02..00000000000 --- a/tests/ui/manual/manual-link-bad-kind.stderr +++ /dev/null @@ -1,2 +0,0 @@ -error: unknown library kind `bar`, expected one of: static, dylib, framework, link-arg - diff --git a/tests/ui/manual/manual-link-bad-search-path.rs b/tests/ui/manual/manual-link-bad-search-path.rs deleted file mode 100644 index c9ced4734fc..00000000000 --- a/tests/ui/manual/manual-link-bad-search-path.rs +++ /dev/null @@ -1,5 +0,0 @@ -//@ compile-flags:-L native= -//@ error-pattern: empty search path given via `-L` - -fn main() { -} diff --git a/tests/ui/manual/manual-link-bad-search-path.stderr b/tests/ui/manual/manual-link-bad-search-path.stderr deleted file mode 100644 index 2c0649ea152..00000000000 --- a/tests/ui/manual/manual-link-bad-search-path.stderr +++ /dev/null @@ -1,2 +0,0 @@ -error: empty search path given via `-L` - diff --git a/tests/ui/manual/manual-link-framework.rs b/tests/ui/manual/manual-link-framework.rs deleted file mode 100644 index 43cdda0a4e6..00000000000 --- a/tests/ui/manual/manual-link-framework.rs +++ /dev/null @@ -1,5 +0,0 @@ -//@ ignore-apple -//@ compile-flags:-l framework=foo -//@ error-pattern: library kind `framework` is only supported on Apple targets - -fn main() {} diff --git a/tests/ui/manual/manual-link-framework.stderr b/tests/ui/manual/manual-link-framework.stderr deleted file mode 100644 index 38d2302a48d..00000000000 --- a/tests/ui/manual/manual-link-framework.stderr +++ /dev/null @@ -1,4 +0,0 @@ -error: library kind `framework` is only supported on Apple targets - -error: aborting due to 1 previous error - diff --git a/tests/ui/manual/manual-link-unsupported-kind.rs b/tests/ui/manual/manual-link-unsupported-kind.rs deleted file mode 100644 index b5b9e3e6577..00000000000 --- a/tests/ui/manual/manual-link-unsupported-kind.rs +++ /dev/null @@ -1,5 +0,0 @@ -//@ compile-flags:-l raw-dylib=foo -//@ error-pattern: unknown library kind `raw-dylib`, expected one of: static, dylib, framework, link-arg - -fn main() { -} diff --git a/tests/ui/manual/manual-link-unsupported-kind.stderr b/tests/ui/manual/manual-link-unsupported-kind.stderr deleted file mode 100644 index ae4a1ec9a95..00000000000 --- a/tests/ui/manual/manual-link-unsupported-kind.stderr +++ /dev/null @@ -1,2 +0,0 @@ -error: unknown library kind `raw-dylib`, expected one of: static, dylib, framework, link-arg - diff --git a/tests/ui/native-library-link-flags/empty-kind-1.rs b/tests/ui/native-library-link-flags/empty-kind-1.rs deleted file mode 100644 index d9b8d8a7f7d..00000000000 --- a/tests/ui/native-library-link-flags/empty-kind-1.rs +++ /dev/null @@ -1,6 +0,0 @@ -// Unspecified kind should fail with an error - -//@ compile-flags: -l =mylib -//@ error-pattern: unknown library kind ``, expected one of: static, dylib, framework, link-arg - -fn main() {} diff --git a/tests/ui/native-library-link-flags/empty-kind-1.stderr b/tests/ui/native-library-link-flags/empty-kind-1.stderr deleted file mode 100644 index 3e5b0549339..00000000000 --- a/tests/ui/native-library-link-flags/empty-kind-1.stderr +++ /dev/null @@ -1,2 +0,0 @@ -error: unknown library kind ``, expected one of: static, dylib, framework, link-arg - diff --git a/tests/ui/native-library-link-flags/empty-kind-2.rs b/tests/ui/native-library-link-flags/empty-kind-2.rs deleted file mode 100644 index 16cb3b917e4..00000000000 --- a/tests/ui/native-library-link-flags/empty-kind-2.rs +++ /dev/null @@ -1,6 +0,0 @@ -// Unspecified kind should fail with an error - -//@ compile-flags: -l :+bundle=mylib -//@ error-pattern: unknown library kind ``, expected one of: static, dylib, framework, link-arg - -fn main() {} diff --git a/tests/ui/native-library-link-flags/empty-kind-2.stderr b/tests/ui/native-library-link-flags/empty-kind-2.stderr deleted file mode 100644 index 3e5b0549339..00000000000 --- a/tests/ui/native-library-link-flags/empty-kind-2.stderr +++ /dev/null @@ -1,2 +0,0 @@ -error: unknown library kind ``, expected one of: static, dylib, framework, link-arg - diff --git a/tests/ui/native-library-link-flags/link-arg-error.rs b/tests/ui/native-library-link-flags/link-arg-error.rs deleted file mode 100644 index 4defb108178..00000000000 --- a/tests/ui/native-library-link-flags/link-arg-error.rs +++ /dev/null @@ -1,4 +0,0 @@ -//@ compile-flags: -l link-arg:+bundle=arg -Z unstable-options -//@ error-pattern: linking modifier `bundle` is only compatible with `static` linking kind - -fn main() {} diff --git a/tests/ui/native-library-link-flags/link-arg-error.stderr b/tests/ui/native-library-link-flags/link-arg-error.stderr deleted file mode 100644 index e1d01e14152..00000000000 --- a/tests/ui/native-library-link-flags/link-arg-error.stderr +++ /dev/null @@ -1,2 +0,0 @@ -error: linking modifier `bundle` is only compatible with `static` linking kind - diff --git a/tests/ui/native-library-link-flags/link-arg-from-rs.rs b/tests/ui/native-library-link-flags/link-arg-from-rs.rs deleted file mode 100644 index 4a6017fea33..00000000000 --- a/tests/ui/native-library-link-flags/link-arg-from-rs.rs +++ /dev/null @@ -1,7 +0,0 @@ -#![feature(link_arg_attribute)] - -#[link(kind = "link-arg", name = "arg", modifiers = "+bundle")] -//~^ ERROR linking modifier `bundle` is only compatible with `static` linking kind -extern "C" {} - -pub fn main() {} diff --git a/tests/ui/native-library-link-flags/link-arg-from-rs.stderr b/tests/ui/native-library-link-flags/link-arg-from-rs.stderr deleted file mode 100644 index f31e15f1da6..00000000000 --- a/tests/ui/native-library-link-flags/link-arg-from-rs.stderr +++ /dev/null @@ -1,8 +0,0 @@ -error: linking modifier `bundle` is only compatible with `static` linking kind - --> $DIR/link-arg-from-rs.rs:3:53 - | -LL | #[link(kind = "link-arg", name = "arg", modifiers = "+bundle")] - | ^^^^^^^^^ - -error: aborting due to 1 previous error - diff --git a/tests/ui/native-library-link-flags/modifiers-bad.blank.stderr b/tests/ui/native-library-link-flags/modifiers-bad.blank.stderr deleted file mode 100644 index ea36af0b4cf..00000000000 --- a/tests/ui/native-library-link-flags/modifiers-bad.blank.stderr +++ /dev/null @@ -1,2 +0,0 @@ -error: invalid linking modifier syntax, expected '+' or '-' prefix before one of: bundle, verbatim, whole-archive, as-needed - diff --git a/tests/ui/native-library-link-flags/modifiers-bad.no-prefix.stderr b/tests/ui/native-library-link-flags/modifiers-bad.no-prefix.stderr deleted file mode 100644 index ea36af0b4cf..00000000000 --- a/tests/ui/native-library-link-flags/modifiers-bad.no-prefix.stderr +++ /dev/null @@ -1,2 +0,0 @@ -error: invalid linking modifier syntax, expected '+' or '-' prefix before one of: bundle, verbatim, whole-archive, as-needed - diff --git a/tests/ui/native-library-link-flags/modifiers-bad.prefix-only.stderr b/tests/ui/native-library-link-flags/modifiers-bad.prefix-only.stderr deleted file mode 100644 index 1e701374688..00000000000 --- a/tests/ui/native-library-link-flags/modifiers-bad.prefix-only.stderr +++ /dev/null @@ -1,2 +0,0 @@ -error: unknown linking modifier ``, expected one of: bundle, verbatim, whole-archive, as-needed - diff --git a/tests/ui/native-library-link-flags/modifiers-bad.rs b/tests/ui/native-library-link-flags/modifiers-bad.rs deleted file mode 100644 index 185201e0d84..00000000000 --- a/tests/ui/native-library-link-flags/modifiers-bad.rs +++ /dev/null @@ -1,11 +0,0 @@ -//@ edition: 2021 -//@ revisions: blank no-prefix prefix-only unknown - -//@[blank] compile-flags: -l static:=foo -//@[no-prefix] compile-flags: -l static:bundle=foo -//@[prefix-only] compile-flags: -l static:+=foo -//@[unknown] compile-flags: -l static:+ferris=foo - -// Tests various illegal values for the "modifier" part of an `-l` flag. - -fn main() {} diff --git a/tests/ui/native-library-link-flags/modifiers-bad.unknown.stderr b/tests/ui/native-library-link-flags/modifiers-bad.unknown.stderr deleted file mode 100644 index 75950ad9c64..00000000000 --- a/tests/ui/native-library-link-flags/modifiers-bad.unknown.stderr +++ /dev/null @@ -1,2 +0,0 @@ -error: unknown linking modifier `ferris`, expected one of: bundle, verbatim, whole-archive, as-needed - diff --git a/tests/ui/native-library-link-flags/modifiers-override-2.rs b/tests/ui/native-library-link-flags/modifiers-override-2.rs deleted file mode 100644 index a462a741ac6..00000000000 --- a/tests/ui/native-library-link-flags/modifiers-override-2.rs +++ /dev/null @@ -1,3 +0,0 @@ -//@ compile-flags:-lstatic:+whole-archive,-whole-archive=foo - -fn main() {} diff --git a/tests/ui/native-library-link-flags/modifiers-override-2.stderr b/tests/ui/native-library-link-flags/modifiers-override-2.stderr deleted file mode 100644 index aa5b59c5b6f..00000000000 --- a/tests/ui/native-library-link-flags/modifiers-override-2.stderr +++ /dev/null @@ -1,2 +0,0 @@ -error: multiple `whole-archive` modifiers in a single `-l` option - diff --git a/tests/ui/native-library-link-flags/modifiers-override-3.rs b/tests/ui/native-library-link-flags/modifiers-override-3.rs deleted file mode 100644 index d05735ad616..00000000000 --- a/tests/ui/native-library-link-flags/modifiers-override-3.rs +++ /dev/null @@ -1,7 +0,0 @@ -// Regression test for issue #97299, one command line library with modifiers -// overrides another command line library with modifiers. - -//@ compile-flags:-lstatic:+whole-archive=foo -lstatic:+whole-archive=foo -//@ error-pattern: overriding linking modifiers from command line is not supported - -fn main() {} diff --git a/tests/ui/native-library-link-flags/modifiers-override-3.stderr b/tests/ui/native-library-link-flags/modifiers-override-3.stderr deleted file mode 100644 index 3eb9459f6f3..00000000000 --- a/tests/ui/native-library-link-flags/modifiers-override-3.stderr +++ /dev/null @@ -1,4 +0,0 @@ -error: overriding linking modifiers from command line is not supported - -error: aborting due to 1 previous error - diff --git a/tests/ui/native-library-link-flags/modifiers-override.rs b/tests/ui/native-library-link-flags/modifiers-override.rs deleted file mode 100644 index cd2d003664a..00000000000 --- a/tests/ui/native-library-link-flags/modifiers-override.rs +++ /dev/null @@ -1,16 +0,0 @@ -//@ compile-flags:-ldylib:+as-needed=foo -lstatic=bar -Zunstable-options - -#[link(name = "foo")] -#[link( - name = "bar", - kind = "static", - modifiers = "+whole-archive,-whole-archive", - //~^ ERROR multiple `whole-archive` modifiers in a single `modifiers` argument - modifiers = "+bundle" - //~^ ERROR multiple `modifiers` arguments in a single `#[link]` attribute -)] -extern "C" {} -//~^ ERROR overriding linking modifiers from command line is not supported -//~| ERROR overriding linking modifiers from command line is not supported - -fn main() {} diff --git a/tests/ui/native-library-link-flags/modifiers-override.stderr b/tests/ui/native-library-link-flags/modifiers-override.stderr deleted file mode 100644 index 64427651e9f..00000000000 --- a/tests/ui/native-library-link-flags/modifiers-override.stderr +++ /dev/null @@ -1,28 +0,0 @@ -error: multiple `modifiers` arguments in a single `#[link]` attribute - --> $DIR/modifiers-override.rs:9:5 - | -LL | modifiers = "+bundle" - | ^^^^^^^^^^^^^^^^^^^^^ - -error: multiple `whole-archive` modifiers in a single `modifiers` argument - --> $DIR/modifiers-override.rs:7:17 - | -LL | modifiers = "+whole-archive,-whole-archive", - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: overriding linking modifiers from command line is not supported - --> $DIR/modifiers-override.rs:12:1 - | -LL | extern "C" {} - | ^^^^^^^^^^^^^ - -error: overriding linking modifiers from command line is not supported - --> $DIR/modifiers-override.rs:12:1 - | -LL | extern "C" {} - | ^^^^^^^^^^^^^ - | - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - -error: aborting due to 4 previous errors - diff --git a/tests/ui/native-library-link-flags/msvc-non-utf8-output.rs b/tests/ui/native-library-link-flags/msvc-non-utf8-output.rs deleted file mode 100644 index 659a832247a..00000000000 --- a/tests/ui/native-library-link-flags/msvc-non-utf8-output.rs +++ /dev/null @@ -1,5 +0,0 @@ -//@ build-fail -//@ compile-flags:-C link-arg=⦺ⅈ⽯⭏⽽◃⡽⚞ -//@ only-msvc -//@ normalize-stderr-test: "(?:.|\n)*(⦺ⅈ⽯⭏⽽◃⡽⚞)(?:.|\n)*" -> "$1" -pub fn main() {} diff --git a/tests/ui/native-library-link-flags/msvc-non-utf8-output.stderr b/tests/ui/native-library-link-flags/msvc-non-utf8-output.stderr deleted file mode 100644 index 7f3ef376447..00000000000 --- a/tests/ui/native-library-link-flags/msvc-non-utf8-output.stderr +++ /dev/null @@ -1 +0,0 @@ -⦺ⅈ⽯⭏⽽◃⡽⚞ \ No newline at end of file diff --git a/tests/ui/native-library-link-flags/suggest-libname-only-1.rs b/tests/ui/native-library-link-flags/suggest-libname-only-1.rs deleted file mode 100644 index 328181fb5cb..00000000000 --- a/tests/ui/native-library-link-flags/suggest-libname-only-1.rs +++ /dev/null @@ -1,9 +0,0 @@ -//@ build-fail -//@ compile-flags: --crate-type rlib -//@ error-pattern: could not find native static library `libfoo.a` -//@ error-pattern: only provide the library name `foo`, not the full filename - -#[link(name = "libfoo.a", kind = "static")] -extern { } - -pub fn main() { } diff --git a/tests/ui/native-library-link-flags/suggest-libname-only-1.stderr b/tests/ui/native-library-link-flags/suggest-libname-only-1.stderr deleted file mode 100644 index e142835a9d6..00000000000 --- a/tests/ui/native-library-link-flags/suggest-libname-only-1.stderr +++ /dev/null @@ -1,6 +0,0 @@ -error: could not find native static library `libfoo.a`, perhaps an -L flag is missing? - | - = help: only provide the library name `foo`, not the full filename - -error: aborting due to 1 previous error - diff --git a/tests/ui/native-library-link-flags/suggest-libname-only-2.rs b/tests/ui/native-library-link-flags/suggest-libname-only-2.rs deleted file mode 100644 index 7ed106e4ab4..00000000000 --- a/tests/ui/native-library-link-flags/suggest-libname-only-2.rs +++ /dev/null @@ -1,9 +0,0 @@ -//@ build-fail -//@ compile-flags: --crate-type rlib -//@ error-pattern: could not find native static library `bar.lib` -//@ error-pattern: only provide the library name `bar`, not the full filename - -#[link(name = "bar.lib", kind = "static")] -extern { } - -pub fn main() { } diff --git a/tests/ui/native-library-link-flags/suggest-libname-only-2.stderr b/tests/ui/native-library-link-flags/suggest-libname-only-2.stderr deleted file mode 100644 index 392d2f01f61..00000000000 --- a/tests/ui/native-library-link-flags/suggest-libname-only-2.stderr +++ /dev/null @@ -1,6 +0,0 @@ -error: could not find native static library `bar.lib`, perhaps an -L flag is missing? - | - = help: only provide the library name `bar`, not the full filename - -error: aborting due to 1 previous error - -- cgit 1.4.1-3-g733a5 From 0a48b96859d3d66138082ffad6a1057b54cd55c7 Mon Sep 17 00:00:00 2001 From: Zalathar Date: Sat, 7 Dec 2024 12:35:30 +1100 Subject: Move more tests into `tests/ui/link-native-libs` --- src/tools/tidy/src/issues.txt | 10 +- src/tools/tidy/src/ui_tests.rs | 2 +- tests/ui/issues/issue-43925.rs | 4 - tests/ui/issues/issue-43925.stderr | 8 -- tests/ui/issues/issue-43926.rs | 4 - tests/ui/issues/issue-43926.stderr | 8 -- .../issue-70093/issue-70093-link-directives.rs | 10 -- tests/ui/issues/issue-70093/issue-70093.rs | 10 -- .../auxiliary/link-cfg-works-transitive-dylib.rs | 4 + .../auxiliary/link-cfg-works-transitive-rlib.rs | 7 + tests/ui/link-native-libs/issue-109144.rs | 4 + tests/ui/link-native-libs/issue-109144.stderr | 9 ++ tests/ui/link-native-libs/issue-43925.rs | 4 + tests/ui/link-native-libs/issue-43925.stderr | 8 ++ tests/ui/link-native-libs/issue-43926.rs | 4 + tests/ui/link-native-libs/issue-43926.stderr | 8 ++ .../issue-70093/issue-70093-link-directives.rs | 10 ++ .../ui/link-native-libs/issue-70093/issue-70093.rs | 10 ++ tests/ui/link-native-libs/kind-framework.rs | 7 + tests/ui/link-native-libs/kind-framework.stderr | 9 ++ .../link-native-libs/link-attr-validation-early.rs | 8 ++ .../link-attr-validation-early.stderr | 21 +++ .../link-native-libs/link-attr-validation-late.rs | 39 ++++++ .../link-attr-validation-late.stderr | 147 +++++++++++++++++++++ tests/ui/link-native-libs/link-cfg-works.rs | 13 ++ tests/ui/link-native-libs/uikit-framework.rs | 25 ++++ .../auxiliary/link-cfg-works-transitive-dylib.rs | 4 - .../auxiliary/link-cfg-works-transitive-rlib.rs | 7 - tests/ui/linkage-attr/issue-109144.rs | 4 - tests/ui/linkage-attr/issue-109144.stderr | 9 -- tests/ui/linkage-attr/kind-framework.rs | 7 - tests/ui/linkage-attr/kind-framework.stderr | 9 -- .../ui/linkage-attr/link-attr-validation-early.rs | 8 -- .../linkage-attr/link-attr-validation-early.stderr | 21 --- tests/ui/linkage-attr/link-attr-validation-late.rs | 39 ------ .../linkage-attr/link-attr-validation-late.stderr | 147 --------------------- tests/ui/linkage-attr/link-cfg-works.rs | 13 -- tests/ui/linkage-attr/uikit-framework.rs | 25 ---- 38 files changed, 343 insertions(+), 343 deletions(-) delete mode 100644 tests/ui/issues/issue-43925.rs delete mode 100644 tests/ui/issues/issue-43925.stderr delete mode 100644 tests/ui/issues/issue-43926.rs delete mode 100644 tests/ui/issues/issue-43926.stderr delete mode 100644 tests/ui/issues/issue-70093/issue-70093-link-directives.rs delete mode 100644 tests/ui/issues/issue-70093/issue-70093.rs create mode 100644 tests/ui/link-native-libs/auxiliary/link-cfg-works-transitive-dylib.rs create mode 100644 tests/ui/link-native-libs/auxiliary/link-cfg-works-transitive-rlib.rs create mode 100644 tests/ui/link-native-libs/issue-109144.rs create mode 100644 tests/ui/link-native-libs/issue-109144.stderr create mode 100644 tests/ui/link-native-libs/issue-43925.rs create mode 100644 tests/ui/link-native-libs/issue-43925.stderr create mode 100644 tests/ui/link-native-libs/issue-43926.rs create mode 100644 tests/ui/link-native-libs/issue-43926.stderr create mode 100644 tests/ui/link-native-libs/issue-70093/issue-70093-link-directives.rs create mode 100644 tests/ui/link-native-libs/issue-70093/issue-70093.rs create mode 100644 tests/ui/link-native-libs/kind-framework.rs create mode 100644 tests/ui/link-native-libs/kind-framework.stderr create mode 100644 tests/ui/link-native-libs/link-attr-validation-early.rs create mode 100644 tests/ui/link-native-libs/link-attr-validation-early.stderr create mode 100644 tests/ui/link-native-libs/link-attr-validation-late.rs create mode 100644 tests/ui/link-native-libs/link-attr-validation-late.stderr create mode 100644 tests/ui/link-native-libs/link-cfg-works.rs create mode 100644 tests/ui/link-native-libs/uikit-framework.rs delete mode 100644 tests/ui/linkage-attr/auxiliary/link-cfg-works-transitive-dylib.rs delete mode 100644 tests/ui/linkage-attr/auxiliary/link-cfg-works-transitive-rlib.rs delete mode 100644 tests/ui/linkage-attr/issue-109144.rs delete mode 100644 tests/ui/linkage-attr/issue-109144.stderr delete mode 100644 tests/ui/linkage-attr/kind-framework.rs delete mode 100644 tests/ui/linkage-attr/kind-framework.stderr delete mode 100644 tests/ui/linkage-attr/link-attr-validation-early.rs delete mode 100644 tests/ui/linkage-attr/link-attr-validation-early.stderr delete mode 100644 tests/ui/linkage-attr/link-attr-validation-late.rs delete mode 100644 tests/ui/linkage-attr/link-attr-validation-late.stderr delete mode 100644 tests/ui/linkage-attr/link-cfg-works.rs delete mode 100644 tests/ui/linkage-attr/uikit-framework.rs diff --git a/src/tools/tidy/src/issues.txt b/src/tools/tidy/src/issues.txt index ac82a17e145..4088b2de2cd 100644 --- a/src/tools/tidy/src/issues.txt +++ b/src/tools/tidy/src/issues.txt @@ -2297,8 +2297,6 @@ ui/issues/issue-43853.rs ui/issues/issue-4387.rs ui/issues/issue-43910.rs ui/issues/issue-43923.rs -ui/issues/issue-43925.rs -ui/issues/issue-43926.rs ui/issues/issue-43988.rs ui/issues/issue-44023.rs ui/issues/issue-44056.rs @@ -2547,8 +2545,6 @@ ui/issues/issue-6936.rs ui/issues/issue-69455.rs ui/issues/issue-69602-type-err-during-codegen-ice.rs ui/issues/issue-69683.rs -ui/issues/issue-70093/issue-70093-link-directives.rs -ui/issues/issue-70093/issue-70093.rs ui/issues/issue-7012.rs ui/issues/issue-70381.rs ui/issues/issue-7044.rs @@ -2713,11 +2709,15 @@ ui/limits/issue-17913.rs ui/limits/issue-55878.rs ui/limits/issue-69485-var-size-diffs-too-large.rs ui/limits/issue-75158-64.rs +ui/link-native-libs/issue-109144.rs +ui/link-native-libs/issue-43925.rs +ui/link-native-libs/issue-43926.rs +ui/link-native-libs/issue-70093/issue-70093-link-directives.rs +ui/link-native-libs/issue-70093/issue-70093.rs ui/linkage-attr/auxiliary/issue-12133-dylib.rs ui/linkage-attr/auxiliary/issue-12133-dylib2.rs ui/linkage-attr/auxiliary/issue-12133-rlib.rs ui/linkage-attr/issue-10755.rs -ui/linkage-attr/issue-109144.rs ui/linkage-attr/issue-12133-1.rs ui/linkage-attr/issue-12133-2.rs ui/linkage-attr/issue-12133-3.rs diff --git a/src/tools/tidy/src/ui_tests.rs b/src/tools/tidy/src/ui_tests.rs index 11f9d5bb03d..401169c838f 100644 --- a/src/tools/tidy/src/ui_tests.rs +++ b/src/tools/tidy/src/ui_tests.rs @@ -17,7 +17,7 @@ use ignore::Walk; const ENTRY_LIMIT: u32 = 901; // FIXME: The following limits should be reduced eventually. -const ISSUES_ENTRY_LIMIT: u32 = 1672; +const ISSUES_ENTRY_LIMIT: u32 = 1667; const EXPECTED_TEST_FILE_EXTENSIONS: &[&str] = &[ "rs", // test source files diff --git a/tests/ui/issues/issue-43925.rs b/tests/ui/issues/issue-43925.rs deleted file mode 100644 index 1a210887154..00000000000 --- a/tests/ui/issues/issue-43925.rs +++ /dev/null @@ -1,4 +0,0 @@ -#[link(name = "foo", cfg("rlib"))] //~ ERROR link cfg must have a single predicate argument -extern "C" {} - -fn main() {} diff --git a/tests/ui/issues/issue-43925.stderr b/tests/ui/issues/issue-43925.stderr deleted file mode 100644 index 7cc347c6163..00000000000 --- a/tests/ui/issues/issue-43925.stderr +++ /dev/null @@ -1,8 +0,0 @@ -error: link cfg must have a single predicate argument - --> $DIR/issue-43925.rs:1:22 - | -LL | #[link(name = "foo", cfg("rlib"))] - | ^^^^^^^^^^^ - -error: aborting due to 1 previous error - diff --git a/tests/ui/issues/issue-43926.rs b/tests/ui/issues/issue-43926.rs deleted file mode 100644 index 6d3003552dc..00000000000 --- a/tests/ui/issues/issue-43926.rs +++ /dev/null @@ -1,4 +0,0 @@ -#[link(name = "foo", cfg())] //~ ERROR link cfg must have a single predicate argument -extern "C" {} - -fn main() {} diff --git a/tests/ui/issues/issue-43926.stderr b/tests/ui/issues/issue-43926.stderr deleted file mode 100644 index 7c5c50a38a9..00000000000 --- a/tests/ui/issues/issue-43926.stderr +++ /dev/null @@ -1,8 +0,0 @@ -error: link cfg must have a single predicate argument - --> $DIR/issue-43926.rs:1:22 - | -LL | #[link(name = "foo", cfg())] - | ^^^^^ - -error: aborting due to 1 previous error - diff --git a/tests/ui/issues/issue-70093/issue-70093-link-directives.rs b/tests/ui/issues/issue-70093/issue-70093-link-directives.rs deleted file mode 100644 index 9c60affbccd..00000000000 --- a/tests/ui/issues/issue-70093/issue-70093-link-directives.rs +++ /dev/null @@ -1,10 +0,0 @@ -//@ run-pass -//@ compile-flags: -Zlink-directives=no -//@ ignore-windows - this will probably only work on unixish systems -//@ ignore-fuchsia - missing __libc_start_main for some reason (#84733) -//@ ignore-cross-compile - default-linker-libraries=yes doesn't play well with cross compiling - -#[link(name = "some-random-non-existent-library", kind = "static")] -extern "C" {} - -fn main() {} diff --git a/tests/ui/issues/issue-70093/issue-70093.rs b/tests/ui/issues/issue-70093/issue-70093.rs deleted file mode 100644 index 86974239338..00000000000 --- a/tests/ui/issues/issue-70093/issue-70093.rs +++ /dev/null @@ -1,10 +0,0 @@ -//@ run-pass -//@ compile-flags: -Zlink-native-libraries=no -Cdefault-linker-libraries=yes -//@ ignore-windows - this will probably only work on unixish systems -//@ ignore-fuchsia - missing __libc_start_main for some reason (#84733) -//@ ignore-cross-compile - default-linker-libraries=yes doesn't play well with cross compiling - -#[link(name = "some-random-non-existent-library", kind = "static")] -extern "C" {} - -fn main() {} diff --git a/tests/ui/link-native-libs/auxiliary/link-cfg-works-transitive-dylib.rs b/tests/ui/link-native-libs/auxiliary/link-cfg-works-transitive-dylib.rs new file mode 100644 index 00000000000..0d927117d81 --- /dev/null +++ b/tests/ui/link-native-libs/auxiliary/link-cfg-works-transitive-dylib.rs @@ -0,0 +1,4 @@ +#![feature(link_cfg)] + +#[link(name = "foo", cfg(foo))] +extern "C" {} diff --git a/tests/ui/link-native-libs/auxiliary/link-cfg-works-transitive-rlib.rs b/tests/ui/link-native-libs/auxiliary/link-cfg-works-transitive-rlib.rs new file mode 100644 index 00000000000..49a46b202e4 --- /dev/null +++ b/tests/ui/link-native-libs/auxiliary/link-cfg-works-transitive-rlib.rs @@ -0,0 +1,7 @@ +//@ no-prefer-dynamic + +#![feature(link_cfg)] +#![crate_type = "rlib"] + +#[link(name = "foo", cfg(foo))] +extern "C" {} diff --git a/tests/ui/link-native-libs/issue-109144.rs b/tests/ui/link-native-libs/issue-109144.rs new file mode 100644 index 00000000000..2f740e55389 --- /dev/null +++ b/tests/ui/link-native-libs/issue-109144.rs @@ -0,0 +1,4 @@ +#![crate_type = "lib"] +#[link(kind = "static", modifiers = "+whole-archive,+bundle")] +//~^ ERROR `#[link]` attribute requires a `name = "string"` argument +extern {} diff --git a/tests/ui/link-native-libs/issue-109144.stderr b/tests/ui/link-native-libs/issue-109144.stderr new file mode 100644 index 00000000000..0748d94189c --- /dev/null +++ b/tests/ui/link-native-libs/issue-109144.stderr @@ -0,0 +1,9 @@ +error[E0459]: `#[link]` attribute requires a `name = "string"` argument + --> $DIR/issue-109144.rs:2:1 + | +LL | #[link(kind = "static", modifiers = "+whole-archive,+bundle")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `name` argument + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0459`. diff --git a/tests/ui/link-native-libs/issue-43925.rs b/tests/ui/link-native-libs/issue-43925.rs new file mode 100644 index 00000000000..1a210887154 --- /dev/null +++ b/tests/ui/link-native-libs/issue-43925.rs @@ -0,0 +1,4 @@ +#[link(name = "foo", cfg("rlib"))] //~ ERROR link cfg must have a single predicate argument +extern "C" {} + +fn main() {} diff --git a/tests/ui/link-native-libs/issue-43925.stderr b/tests/ui/link-native-libs/issue-43925.stderr new file mode 100644 index 00000000000..7cc347c6163 --- /dev/null +++ b/tests/ui/link-native-libs/issue-43925.stderr @@ -0,0 +1,8 @@ +error: link cfg must have a single predicate argument + --> $DIR/issue-43925.rs:1:22 + | +LL | #[link(name = "foo", cfg("rlib"))] + | ^^^^^^^^^^^ + +error: aborting due to 1 previous error + diff --git a/tests/ui/link-native-libs/issue-43926.rs b/tests/ui/link-native-libs/issue-43926.rs new file mode 100644 index 00000000000..6d3003552dc --- /dev/null +++ b/tests/ui/link-native-libs/issue-43926.rs @@ -0,0 +1,4 @@ +#[link(name = "foo", cfg())] //~ ERROR link cfg must have a single predicate argument +extern "C" {} + +fn main() {} diff --git a/tests/ui/link-native-libs/issue-43926.stderr b/tests/ui/link-native-libs/issue-43926.stderr new file mode 100644 index 00000000000..7c5c50a38a9 --- /dev/null +++ b/tests/ui/link-native-libs/issue-43926.stderr @@ -0,0 +1,8 @@ +error: link cfg must have a single predicate argument + --> $DIR/issue-43926.rs:1:22 + | +LL | #[link(name = "foo", cfg())] + | ^^^^^ + +error: aborting due to 1 previous error + diff --git a/tests/ui/link-native-libs/issue-70093/issue-70093-link-directives.rs b/tests/ui/link-native-libs/issue-70093/issue-70093-link-directives.rs new file mode 100644 index 00000000000..9c60affbccd --- /dev/null +++ b/tests/ui/link-native-libs/issue-70093/issue-70093-link-directives.rs @@ -0,0 +1,10 @@ +//@ run-pass +//@ compile-flags: -Zlink-directives=no +//@ ignore-windows - this will probably only work on unixish systems +//@ ignore-fuchsia - missing __libc_start_main for some reason (#84733) +//@ ignore-cross-compile - default-linker-libraries=yes doesn't play well with cross compiling + +#[link(name = "some-random-non-existent-library", kind = "static")] +extern "C" {} + +fn main() {} diff --git a/tests/ui/link-native-libs/issue-70093/issue-70093.rs b/tests/ui/link-native-libs/issue-70093/issue-70093.rs new file mode 100644 index 00000000000..86974239338 --- /dev/null +++ b/tests/ui/link-native-libs/issue-70093/issue-70093.rs @@ -0,0 +1,10 @@ +//@ run-pass +//@ compile-flags: -Zlink-native-libraries=no -Cdefault-linker-libraries=yes +//@ ignore-windows - this will probably only work on unixish systems +//@ ignore-fuchsia - missing __libc_start_main for some reason (#84733) +//@ ignore-cross-compile - default-linker-libraries=yes doesn't play well with cross compiling + +#[link(name = "some-random-non-existent-library", kind = "static")] +extern "C" {} + +fn main() {} diff --git a/tests/ui/link-native-libs/kind-framework.rs b/tests/ui/link-native-libs/kind-framework.rs new file mode 100644 index 00000000000..c2f90809e03 --- /dev/null +++ b/tests/ui/link-native-libs/kind-framework.rs @@ -0,0 +1,7 @@ +//@ ignore-apple this is supposed to succeed on Apple platforms (though it won't necessarily link) + +#[link(name = "foo", kind = "framework")] +extern "C" {} +//~^^ ERROR: link kind `framework` is only supported on Apple targets + +fn main() {} diff --git a/tests/ui/link-native-libs/kind-framework.stderr b/tests/ui/link-native-libs/kind-framework.stderr new file mode 100644 index 00000000000..93dacd68e29 --- /dev/null +++ b/tests/ui/link-native-libs/kind-framework.stderr @@ -0,0 +1,9 @@ +error[E0455]: link kind `framework` is only supported on Apple targets + --> $DIR/kind-framework.rs:3:29 + | +LL | #[link(name = "foo", kind = "framework")] + | ^^^^^^^^^^^ + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0455`. diff --git a/tests/ui/link-native-libs/link-attr-validation-early.rs b/tests/ui/link-native-libs/link-attr-validation-early.rs new file mode 100644 index 00000000000..b9a835fb5e9 --- /dev/null +++ b/tests/ui/link-native-libs/link-attr-validation-early.rs @@ -0,0 +1,8 @@ +// Top-level ill-formed +#[link] //~ ERROR attribute must be of the form + //~| WARN this was previously accepted +#[link = "foo"] //~ ERROR attribute must be of the form + //~| WARN this was previously accepted +extern "C" {} + +fn main() {} diff --git a/tests/ui/link-native-libs/link-attr-validation-early.stderr b/tests/ui/link-native-libs/link-attr-validation-early.stderr new file mode 100644 index 00000000000..24ad9d825f8 --- /dev/null +++ b/tests/ui/link-native-libs/link-attr-validation-early.stderr @@ -0,0 +1,21 @@ +error: attribute must be of the form `#[link(name = "...", /*opt*/ kind = "dylib|static|...", /*opt*/ wasm_import_module = "...", /*opt*/ import_name_type = "decorated|noprefix|undecorated")]` + --> $DIR/link-attr-validation-early.rs:2:1 + | +LL | #[link] + | ^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #57571 + = note: `#[deny(ill_formed_attribute_input)]` on by default + +error: attribute must be of the form `#[link(name = "...", /*opt*/ kind = "dylib|static|...", /*opt*/ wasm_import_module = "...", /*opt*/ import_name_type = "decorated|noprefix|undecorated")]` + --> $DIR/link-attr-validation-early.rs:4:1 + | +LL | #[link = "foo"] + | ^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #57571 + +error: aborting due to 2 previous errors + diff --git a/tests/ui/link-native-libs/link-attr-validation-late.rs b/tests/ui/link-native-libs/link-attr-validation-late.rs new file mode 100644 index 00000000000..34f720dd2d3 --- /dev/null +++ b/tests/ui/link-native-libs/link-attr-validation-late.rs @@ -0,0 +1,39 @@ +#![feature(link_cfg)] + +// Top-level ill-formed +#[link(name = "...", "literal")] //~ ERROR unexpected `#[link]` argument +#[link(name = "...", unknown)] //~ ERROR unexpected `#[link]` argument +extern "C" {} + +// Duplicate arguments +#[link(name = "foo", name = "bar")] //~ ERROR multiple `name` arguments +#[link(name = "...", kind = "dylib", kind = "bar")] //~ ERROR multiple `kind` arguments +#[link(name = "...", modifiers = "+verbatim", modifiers = "bar")] //~ ERROR multiple `modifiers` arguments +#[link(name = "...", cfg(FALSE), cfg(FALSE))] //~ ERROR multiple `cfg` arguments +#[link(wasm_import_module = "foo", wasm_import_module = "bar")] //~ ERROR multiple `wasm_import_module` arguments +extern "C" {} + +// Ill-formed arguments +#[link(name)] //~ ERROR link name must be of the form `name = "string"` + //~| ERROR `#[link]` attribute requires a `name = "string"` argument +#[link(name())] //~ ERROR link name must be of the form `name = "string"` + //~| ERROR `#[link]` attribute requires a `name = "string"` argument +#[link(name = "...", kind)] //~ ERROR link kind must be of the form `kind = "string"` +#[link(name = "...", kind())] //~ ERROR link kind must be of the form `kind = "string"` +#[link(name = "...", modifiers)] //~ ERROR link modifiers must be of the form `modifiers = "string"` +#[link(name = "...", modifiers())] //~ ERROR link modifiers must be of the form `modifiers = "string"` +#[link(name = "...", cfg)] //~ ERROR link cfg must be of the form `cfg(/* predicate */)` +#[link(name = "...", cfg = "literal")] //~ ERROR link cfg must be of the form `cfg(/* predicate */)` +#[link(name = "...", cfg("literal"))] //~ ERROR link cfg must have a single predicate argument +#[link(name = "...", wasm_import_module)] //~ ERROR wasm import module must be of the form `wasm_import_module = "string"` +#[link(name = "...", wasm_import_module())] //~ ERROR wasm import module must be of the form `wasm_import_module = "string"` +extern "C" {} + +// Basic modifier validation +#[link(name = "...", modifiers = "")] //~ ERROR invalid linking modifier syntax, expected '+' or '-' prefix +#[link(name = "...", modifiers = "no-plus-minus")] //~ ERROR invalid linking modifier syntax, expected '+' or '-' prefix +#[link(name = "...", modifiers = "+unknown")] //~ ERROR unknown linking modifier `unknown` +#[link(name = "...", modifiers = "+verbatim,+verbatim")] //~ ERROR multiple `verbatim` modifiers +extern "C" {} + +fn main() {} diff --git a/tests/ui/link-native-libs/link-attr-validation-late.stderr b/tests/ui/link-native-libs/link-attr-validation-late.stderr new file mode 100644 index 00000000000..1ad5fbaf7de --- /dev/null +++ b/tests/ui/link-native-libs/link-attr-validation-late.stderr @@ -0,0 +1,147 @@ +error: unexpected `#[link]` argument, expected one of: name, kind, modifiers, cfg, wasm_import_module, import_name_type + --> $DIR/link-attr-validation-late.rs:4:22 + | +LL | #[link(name = "...", "literal")] + | ^^^^^^^^^ + +error: unexpected `#[link]` argument, expected one of: name, kind, modifiers, cfg, wasm_import_module, import_name_type + --> $DIR/link-attr-validation-late.rs:5:22 + | +LL | #[link(name = "...", unknown)] + | ^^^^^^^ + +error: multiple `name` arguments in a single `#[link]` attribute + --> $DIR/link-attr-validation-late.rs:9:22 + | +LL | #[link(name = "foo", name = "bar")] + | ^^^^^^^^^^^^ + +error: multiple `kind` arguments in a single `#[link]` attribute + --> $DIR/link-attr-validation-late.rs:10:38 + | +LL | #[link(name = "...", kind = "dylib", kind = "bar")] + | ^^^^^^^^^^^^ + +error: multiple `modifiers` arguments in a single `#[link]` attribute + --> $DIR/link-attr-validation-late.rs:11:47 + | +LL | #[link(name = "...", modifiers = "+verbatim", modifiers = "bar")] + | ^^^^^^^^^^^^^^^^^ + +error: multiple `cfg` arguments in a single `#[link]` attribute + --> $DIR/link-attr-validation-late.rs:12:34 + | +LL | #[link(name = "...", cfg(FALSE), cfg(FALSE))] + | ^^^^^^^^^^ + +error: multiple `wasm_import_module` arguments in a single `#[link]` attribute + --> $DIR/link-attr-validation-late.rs:13:36 + | +LL | #[link(wasm_import_module = "foo", wasm_import_module = "bar")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: link name must be of the form `name = "string"` + --> $DIR/link-attr-validation-late.rs:17:8 + | +LL | #[link(name)] + | ^^^^ + +error[E0459]: `#[link]` attribute requires a `name = "string"` argument + --> $DIR/link-attr-validation-late.rs:17:1 + | +LL | #[link(name)] + | ^^^^^^^^^^^^^ missing `name` argument + +error: link name must be of the form `name = "string"` + --> $DIR/link-attr-validation-late.rs:19:8 + | +LL | #[link(name())] + | ^^^^^^ + +error[E0459]: `#[link]` attribute requires a `name = "string"` argument + --> $DIR/link-attr-validation-late.rs:19:1 + | +LL | #[link(name())] + | ^^^^^^^^^^^^^^^ missing `name` argument + +error: link kind must be of the form `kind = "string"` + --> $DIR/link-attr-validation-late.rs:21:22 + | +LL | #[link(name = "...", kind)] + | ^^^^ + +error: link kind must be of the form `kind = "string"` + --> $DIR/link-attr-validation-late.rs:22:22 + | +LL | #[link(name = "...", kind())] + | ^^^^^^ + +error: link modifiers must be of the form `modifiers = "string"` + --> $DIR/link-attr-validation-late.rs:23:22 + | +LL | #[link(name = "...", modifiers)] + | ^^^^^^^^^ + +error: link modifiers must be of the form `modifiers = "string"` + --> $DIR/link-attr-validation-late.rs:24:22 + | +LL | #[link(name = "...", modifiers())] + | ^^^^^^^^^^^ + +error: link cfg must be of the form `cfg(/* predicate */)` + --> $DIR/link-attr-validation-late.rs:25:22 + | +LL | #[link(name = "...", cfg)] + | ^^^ + +error: link cfg must be of the form `cfg(/* predicate */)` + --> $DIR/link-attr-validation-late.rs:26:22 + | +LL | #[link(name = "...", cfg = "literal")] + | ^^^^^^^^^^^^^^^ + +error: link cfg must have a single predicate argument + --> $DIR/link-attr-validation-late.rs:27:22 + | +LL | #[link(name = "...", cfg("literal"))] + | ^^^^^^^^^^^^^^ + +error: wasm import module must be of the form `wasm_import_module = "string"` + --> $DIR/link-attr-validation-late.rs:28:22 + | +LL | #[link(name = "...", wasm_import_module)] + | ^^^^^^^^^^^^^^^^^^ + +error: wasm import module must be of the form `wasm_import_module = "string"` + --> $DIR/link-attr-validation-late.rs:29:22 + | +LL | #[link(name = "...", wasm_import_module())] + | ^^^^^^^^^^^^^^^^^^^^ + +error: invalid linking modifier syntax, expected '+' or '-' prefix before one of: bundle, verbatim, whole-archive, as-needed + --> $DIR/link-attr-validation-late.rs:33:34 + | +LL | #[link(name = "...", modifiers = "")] + | ^^ + +error: invalid linking modifier syntax, expected '+' or '-' prefix before one of: bundle, verbatim, whole-archive, as-needed + --> $DIR/link-attr-validation-late.rs:34:34 + | +LL | #[link(name = "...", modifiers = "no-plus-minus")] + | ^^^^^^^^^^^^^^^ + +error: unknown linking modifier `unknown`, expected one of: bundle, verbatim, whole-archive, as-needed + --> $DIR/link-attr-validation-late.rs:35:34 + | +LL | #[link(name = "...", modifiers = "+unknown")] + | ^^^^^^^^^^ + +error: multiple `verbatim` modifiers in a single `modifiers` argument + --> $DIR/link-attr-validation-late.rs:36:34 + | +LL | #[link(name = "...", modifiers = "+verbatim,+verbatim")] + | ^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 24 previous errors + +For more information about this error, try `rustc --explain E0459`. diff --git a/tests/ui/link-native-libs/link-cfg-works.rs b/tests/ui/link-native-libs/link-cfg-works.rs new file mode 100644 index 00000000000..7b936bc43b1 --- /dev/null +++ b/tests/ui/link-native-libs/link-cfg-works.rs @@ -0,0 +1,13 @@ +//@ run-pass +//@ aux-build:link-cfg-works-transitive-rlib.rs +//@ aux-build:link-cfg-works-transitive-dylib.rs + +#![feature(link_cfg)] + +extern crate link_cfg_works_transitive_dylib; +extern crate link_cfg_works_transitive_rlib; + +#[link(name = "foo", cfg(foo))] +extern "C" {} + +fn main() {} diff --git a/tests/ui/link-native-libs/uikit-framework.rs b/tests/ui/link-native-libs/uikit-framework.rs new file mode 100644 index 00000000000..fca0332384a --- /dev/null +++ b/tests/ui/link-native-libs/uikit-framework.rs @@ -0,0 +1,25 @@ +//! Check that linking to UIKit on platforms where that is available works. +//@ revisions: ios tvos watchos visionos +//@ [ios]only-ios +//@ [tvos]only-tvos +//@ [watchos]only-watchos +//@ [visionos]only-visionos +//@ build-pass + +use std::ffi::{c_char, c_int, c_void}; + +#[link(name = "UIKit", kind = "framework")] +extern "C" { + pub fn UIApplicationMain( + argc: c_int, + argv: *const c_char, + principalClassName: *const c_void, + delegateClassName: *const c_void, + ) -> c_int; +} + +pub fn main() { + unsafe { + UIApplicationMain(0, core::ptr::null(), core::ptr::null(), core::ptr::null()); + } +} diff --git a/tests/ui/linkage-attr/auxiliary/link-cfg-works-transitive-dylib.rs b/tests/ui/linkage-attr/auxiliary/link-cfg-works-transitive-dylib.rs deleted file mode 100644 index 0d927117d81..00000000000 --- a/tests/ui/linkage-attr/auxiliary/link-cfg-works-transitive-dylib.rs +++ /dev/null @@ -1,4 +0,0 @@ -#![feature(link_cfg)] - -#[link(name = "foo", cfg(foo))] -extern "C" {} diff --git a/tests/ui/linkage-attr/auxiliary/link-cfg-works-transitive-rlib.rs b/tests/ui/linkage-attr/auxiliary/link-cfg-works-transitive-rlib.rs deleted file mode 100644 index 49a46b202e4..00000000000 --- a/tests/ui/linkage-attr/auxiliary/link-cfg-works-transitive-rlib.rs +++ /dev/null @@ -1,7 +0,0 @@ -//@ no-prefer-dynamic - -#![feature(link_cfg)] -#![crate_type = "rlib"] - -#[link(name = "foo", cfg(foo))] -extern "C" {} diff --git a/tests/ui/linkage-attr/issue-109144.rs b/tests/ui/linkage-attr/issue-109144.rs deleted file mode 100644 index 2f740e55389..00000000000 --- a/tests/ui/linkage-attr/issue-109144.rs +++ /dev/null @@ -1,4 +0,0 @@ -#![crate_type = "lib"] -#[link(kind = "static", modifiers = "+whole-archive,+bundle")] -//~^ ERROR `#[link]` attribute requires a `name = "string"` argument -extern {} diff --git a/tests/ui/linkage-attr/issue-109144.stderr b/tests/ui/linkage-attr/issue-109144.stderr deleted file mode 100644 index 0748d94189c..00000000000 --- a/tests/ui/linkage-attr/issue-109144.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0459]: `#[link]` attribute requires a `name = "string"` argument - --> $DIR/issue-109144.rs:2:1 - | -LL | #[link(kind = "static", modifiers = "+whole-archive,+bundle")] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `name` argument - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0459`. diff --git a/tests/ui/linkage-attr/kind-framework.rs b/tests/ui/linkage-attr/kind-framework.rs deleted file mode 100644 index c2f90809e03..00000000000 --- a/tests/ui/linkage-attr/kind-framework.rs +++ /dev/null @@ -1,7 +0,0 @@ -//@ ignore-apple this is supposed to succeed on Apple platforms (though it won't necessarily link) - -#[link(name = "foo", kind = "framework")] -extern "C" {} -//~^^ ERROR: link kind `framework` is only supported on Apple targets - -fn main() {} diff --git a/tests/ui/linkage-attr/kind-framework.stderr b/tests/ui/linkage-attr/kind-framework.stderr deleted file mode 100644 index 93dacd68e29..00000000000 --- a/tests/ui/linkage-attr/kind-framework.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0455]: link kind `framework` is only supported on Apple targets - --> $DIR/kind-framework.rs:3:29 - | -LL | #[link(name = "foo", kind = "framework")] - | ^^^^^^^^^^^ - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0455`. diff --git a/tests/ui/linkage-attr/link-attr-validation-early.rs b/tests/ui/linkage-attr/link-attr-validation-early.rs deleted file mode 100644 index b9a835fb5e9..00000000000 --- a/tests/ui/linkage-attr/link-attr-validation-early.rs +++ /dev/null @@ -1,8 +0,0 @@ -// Top-level ill-formed -#[link] //~ ERROR attribute must be of the form - //~| WARN this was previously accepted -#[link = "foo"] //~ ERROR attribute must be of the form - //~| WARN this was previously accepted -extern "C" {} - -fn main() {} diff --git a/tests/ui/linkage-attr/link-attr-validation-early.stderr b/tests/ui/linkage-attr/link-attr-validation-early.stderr deleted file mode 100644 index 24ad9d825f8..00000000000 --- a/tests/ui/linkage-attr/link-attr-validation-early.stderr +++ /dev/null @@ -1,21 +0,0 @@ -error: attribute must be of the form `#[link(name = "...", /*opt*/ kind = "dylib|static|...", /*opt*/ wasm_import_module = "...", /*opt*/ import_name_type = "decorated|noprefix|undecorated")]` - --> $DIR/link-attr-validation-early.rs:2:1 - | -LL | #[link] - | ^^^^^^^ - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #57571 - = note: `#[deny(ill_formed_attribute_input)]` on by default - -error: attribute must be of the form `#[link(name = "...", /*opt*/ kind = "dylib|static|...", /*opt*/ wasm_import_module = "...", /*opt*/ import_name_type = "decorated|noprefix|undecorated")]` - --> $DIR/link-attr-validation-early.rs:4:1 - | -LL | #[link = "foo"] - | ^^^^^^^^^^^^^^^ - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #57571 - -error: aborting due to 2 previous errors - diff --git a/tests/ui/linkage-attr/link-attr-validation-late.rs b/tests/ui/linkage-attr/link-attr-validation-late.rs deleted file mode 100644 index 34f720dd2d3..00000000000 --- a/tests/ui/linkage-attr/link-attr-validation-late.rs +++ /dev/null @@ -1,39 +0,0 @@ -#![feature(link_cfg)] - -// Top-level ill-formed -#[link(name = "...", "literal")] //~ ERROR unexpected `#[link]` argument -#[link(name = "...", unknown)] //~ ERROR unexpected `#[link]` argument -extern "C" {} - -// Duplicate arguments -#[link(name = "foo", name = "bar")] //~ ERROR multiple `name` arguments -#[link(name = "...", kind = "dylib", kind = "bar")] //~ ERROR multiple `kind` arguments -#[link(name = "...", modifiers = "+verbatim", modifiers = "bar")] //~ ERROR multiple `modifiers` arguments -#[link(name = "...", cfg(FALSE), cfg(FALSE))] //~ ERROR multiple `cfg` arguments -#[link(wasm_import_module = "foo", wasm_import_module = "bar")] //~ ERROR multiple `wasm_import_module` arguments -extern "C" {} - -// Ill-formed arguments -#[link(name)] //~ ERROR link name must be of the form `name = "string"` - //~| ERROR `#[link]` attribute requires a `name = "string"` argument -#[link(name())] //~ ERROR link name must be of the form `name = "string"` - //~| ERROR `#[link]` attribute requires a `name = "string"` argument -#[link(name = "...", kind)] //~ ERROR link kind must be of the form `kind = "string"` -#[link(name = "...", kind())] //~ ERROR link kind must be of the form `kind = "string"` -#[link(name = "...", modifiers)] //~ ERROR link modifiers must be of the form `modifiers = "string"` -#[link(name = "...", modifiers())] //~ ERROR link modifiers must be of the form `modifiers = "string"` -#[link(name = "...", cfg)] //~ ERROR link cfg must be of the form `cfg(/* predicate */)` -#[link(name = "...", cfg = "literal")] //~ ERROR link cfg must be of the form `cfg(/* predicate */)` -#[link(name = "...", cfg("literal"))] //~ ERROR link cfg must have a single predicate argument -#[link(name = "...", wasm_import_module)] //~ ERROR wasm import module must be of the form `wasm_import_module = "string"` -#[link(name = "...", wasm_import_module())] //~ ERROR wasm import module must be of the form `wasm_import_module = "string"` -extern "C" {} - -// Basic modifier validation -#[link(name = "...", modifiers = "")] //~ ERROR invalid linking modifier syntax, expected '+' or '-' prefix -#[link(name = "...", modifiers = "no-plus-minus")] //~ ERROR invalid linking modifier syntax, expected '+' or '-' prefix -#[link(name = "...", modifiers = "+unknown")] //~ ERROR unknown linking modifier `unknown` -#[link(name = "...", modifiers = "+verbatim,+verbatim")] //~ ERROR multiple `verbatim` modifiers -extern "C" {} - -fn main() {} diff --git a/tests/ui/linkage-attr/link-attr-validation-late.stderr b/tests/ui/linkage-attr/link-attr-validation-late.stderr deleted file mode 100644 index 1ad5fbaf7de..00000000000 --- a/tests/ui/linkage-attr/link-attr-validation-late.stderr +++ /dev/null @@ -1,147 +0,0 @@ -error: unexpected `#[link]` argument, expected one of: name, kind, modifiers, cfg, wasm_import_module, import_name_type - --> $DIR/link-attr-validation-late.rs:4:22 - | -LL | #[link(name = "...", "literal")] - | ^^^^^^^^^ - -error: unexpected `#[link]` argument, expected one of: name, kind, modifiers, cfg, wasm_import_module, import_name_type - --> $DIR/link-attr-validation-late.rs:5:22 - | -LL | #[link(name = "...", unknown)] - | ^^^^^^^ - -error: multiple `name` arguments in a single `#[link]` attribute - --> $DIR/link-attr-validation-late.rs:9:22 - | -LL | #[link(name = "foo", name = "bar")] - | ^^^^^^^^^^^^ - -error: multiple `kind` arguments in a single `#[link]` attribute - --> $DIR/link-attr-validation-late.rs:10:38 - | -LL | #[link(name = "...", kind = "dylib", kind = "bar")] - | ^^^^^^^^^^^^ - -error: multiple `modifiers` arguments in a single `#[link]` attribute - --> $DIR/link-attr-validation-late.rs:11:47 - | -LL | #[link(name = "...", modifiers = "+verbatim", modifiers = "bar")] - | ^^^^^^^^^^^^^^^^^ - -error: multiple `cfg` arguments in a single `#[link]` attribute - --> $DIR/link-attr-validation-late.rs:12:34 - | -LL | #[link(name = "...", cfg(FALSE), cfg(FALSE))] - | ^^^^^^^^^^ - -error: multiple `wasm_import_module` arguments in a single `#[link]` attribute - --> $DIR/link-attr-validation-late.rs:13:36 - | -LL | #[link(wasm_import_module = "foo", wasm_import_module = "bar")] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: link name must be of the form `name = "string"` - --> $DIR/link-attr-validation-late.rs:17:8 - | -LL | #[link(name)] - | ^^^^ - -error[E0459]: `#[link]` attribute requires a `name = "string"` argument - --> $DIR/link-attr-validation-late.rs:17:1 - | -LL | #[link(name)] - | ^^^^^^^^^^^^^ missing `name` argument - -error: link name must be of the form `name = "string"` - --> $DIR/link-attr-validation-late.rs:19:8 - | -LL | #[link(name())] - | ^^^^^^ - -error[E0459]: `#[link]` attribute requires a `name = "string"` argument - --> $DIR/link-attr-validation-late.rs:19:1 - | -LL | #[link(name())] - | ^^^^^^^^^^^^^^^ missing `name` argument - -error: link kind must be of the form `kind = "string"` - --> $DIR/link-attr-validation-late.rs:21:22 - | -LL | #[link(name = "...", kind)] - | ^^^^ - -error: link kind must be of the form `kind = "string"` - --> $DIR/link-attr-validation-late.rs:22:22 - | -LL | #[link(name = "...", kind())] - | ^^^^^^ - -error: link modifiers must be of the form `modifiers = "string"` - --> $DIR/link-attr-validation-late.rs:23:22 - | -LL | #[link(name = "...", modifiers)] - | ^^^^^^^^^ - -error: link modifiers must be of the form `modifiers = "string"` - --> $DIR/link-attr-validation-late.rs:24:22 - | -LL | #[link(name = "...", modifiers())] - | ^^^^^^^^^^^ - -error: link cfg must be of the form `cfg(/* predicate */)` - --> $DIR/link-attr-validation-late.rs:25:22 - | -LL | #[link(name = "...", cfg)] - | ^^^ - -error: link cfg must be of the form `cfg(/* predicate */)` - --> $DIR/link-attr-validation-late.rs:26:22 - | -LL | #[link(name = "...", cfg = "literal")] - | ^^^^^^^^^^^^^^^ - -error: link cfg must have a single predicate argument - --> $DIR/link-attr-validation-late.rs:27:22 - | -LL | #[link(name = "...", cfg("literal"))] - | ^^^^^^^^^^^^^^ - -error: wasm import module must be of the form `wasm_import_module = "string"` - --> $DIR/link-attr-validation-late.rs:28:22 - | -LL | #[link(name = "...", wasm_import_module)] - | ^^^^^^^^^^^^^^^^^^ - -error: wasm import module must be of the form `wasm_import_module = "string"` - --> $DIR/link-attr-validation-late.rs:29:22 - | -LL | #[link(name = "...", wasm_import_module())] - | ^^^^^^^^^^^^^^^^^^^^ - -error: invalid linking modifier syntax, expected '+' or '-' prefix before one of: bundle, verbatim, whole-archive, as-needed - --> $DIR/link-attr-validation-late.rs:33:34 - | -LL | #[link(name = "...", modifiers = "")] - | ^^ - -error: invalid linking modifier syntax, expected '+' or '-' prefix before one of: bundle, verbatim, whole-archive, as-needed - --> $DIR/link-attr-validation-late.rs:34:34 - | -LL | #[link(name = "...", modifiers = "no-plus-minus")] - | ^^^^^^^^^^^^^^^ - -error: unknown linking modifier `unknown`, expected one of: bundle, verbatim, whole-archive, as-needed - --> $DIR/link-attr-validation-late.rs:35:34 - | -LL | #[link(name = "...", modifiers = "+unknown")] - | ^^^^^^^^^^ - -error: multiple `verbatim` modifiers in a single `modifiers` argument - --> $DIR/link-attr-validation-late.rs:36:34 - | -LL | #[link(name = "...", modifiers = "+verbatim,+verbatim")] - | ^^^^^^^^^^^^^^^^^^^^^ - -error: aborting due to 24 previous errors - -For more information about this error, try `rustc --explain E0459`. diff --git a/tests/ui/linkage-attr/link-cfg-works.rs b/tests/ui/linkage-attr/link-cfg-works.rs deleted file mode 100644 index 7b936bc43b1..00000000000 --- a/tests/ui/linkage-attr/link-cfg-works.rs +++ /dev/null @@ -1,13 +0,0 @@ -//@ run-pass -//@ aux-build:link-cfg-works-transitive-rlib.rs -//@ aux-build:link-cfg-works-transitive-dylib.rs - -#![feature(link_cfg)] - -extern crate link_cfg_works_transitive_dylib; -extern crate link_cfg_works_transitive_rlib; - -#[link(name = "foo", cfg(foo))] -extern "C" {} - -fn main() {} diff --git a/tests/ui/linkage-attr/uikit-framework.rs b/tests/ui/linkage-attr/uikit-framework.rs deleted file mode 100644 index fca0332384a..00000000000 --- a/tests/ui/linkage-attr/uikit-framework.rs +++ /dev/null @@ -1,25 +0,0 @@ -//! Check that linking to UIKit on platforms where that is available works. -//@ revisions: ios tvos watchos visionos -//@ [ios]only-ios -//@ [tvos]only-tvos -//@ [watchos]only-watchos -//@ [visionos]only-visionos -//@ build-pass - -use std::ffi::{c_char, c_int, c_void}; - -#[link(name = "UIKit", kind = "framework")] -extern "C" { - pub fn UIApplicationMain( - argc: c_int, - argv: *const c_char, - principalClassName: *const c_void, - delegateClassName: *const c_void, - ) -> c_int; -} - -pub fn main() { - unsafe { - UIApplicationMain(0, core::ptr::null(), core::ptr::null(), core::ptr::null()); - } -} -- cgit 1.4.1-3-g733a5 From 477b722fe1126ce3aa61757687b8685f1cf9b43f Mon Sep 17 00:00:00 2001 From: Prajwal S N Date: Sun, 8 Dec 2024 18:21:15 +0530 Subject: docs: better examples for `std::ops::ControlFlow` Signed-off-by: Prajwal S N --- library/core/src/ops/control_flow.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/library/core/src/ops/control_flow.rs b/library/core/src/ops/control_flow.rs index c4429b3cd7d..c8fcee5c140 100644 --- a/library/core/src/ops/control_flow.rs +++ b/library/core/src/ops/control_flow.rs @@ -141,8 +141,8 @@ impl ControlFlow { /// ``` /// use std::ops::ControlFlow; /// - /// assert!(ControlFlow::::Break(3).is_break()); - /// assert!(!ControlFlow::::Continue(3).is_break()); + /// assert!(ControlFlow::<&str, i32>::Break("Stop right there!").is_break()); + /// assert!(!ControlFlow::<&str, i32>::Continue(3).is_break()); /// ``` #[inline] #[stable(feature = "control_flow_enum_is", since = "1.59.0")] @@ -157,8 +157,8 @@ impl ControlFlow { /// ``` /// use std::ops::ControlFlow; /// - /// assert!(!ControlFlow::::Break(3).is_continue()); - /// assert!(ControlFlow::::Continue(3).is_continue()); + /// assert!(!ControlFlow::<&str, i32>::Break("Stop right there!").is_continue()); + /// assert!(ControlFlow::<&str, i32>::Continue(3).is_continue()); /// ``` #[inline] #[stable(feature = "control_flow_enum_is", since = "1.59.0")] @@ -174,8 +174,8 @@ impl ControlFlow { /// ``` /// use std::ops::ControlFlow; /// - /// assert_eq!(ControlFlow::::Break(3).break_value(), Some(3)); - /// assert_eq!(ControlFlow::::Continue(3).break_value(), None); + /// assert_eq!(ControlFlow::<&str, i32>::Break("Stop right there!").break_value(), Some("Stop right there!")); + /// assert_eq!(ControlFlow::<&str, i32>::Continue(3).break_value(), None); /// ``` #[inline] #[stable(feature = "control_flow_enum", since = "1.83.0")] @@ -205,8 +205,8 @@ impl ControlFlow { /// ``` /// use std::ops::ControlFlow; /// - /// assert_eq!(ControlFlow::::Break(3).continue_value(), None); - /// assert_eq!(ControlFlow::::Continue(3).continue_value(), Some(3)); + /// assert_eq!(ControlFlow::<&str, i32>::Break("Stop right there!").continue_value(), None); + /// assert_eq!(ControlFlow::<&str, i32>::Continue(3).continue_value(), Some(3)); /// ``` #[inline] #[stable(feature = "control_flow_enum", since = "1.83.0")] -- cgit 1.4.1-3-g733a5 From 999aed4bff113924393ca55f3d6498d5c723f037 Mon Sep 17 00:00:00 2001 From: Michael Howell Date: Sun, 8 Dec 2024 21:39:48 -0700 Subject: Add URL to test cases --- tests/rustdoc-ui/issues/issue-101076.rs | 1 + tests/rustdoc-ui/issues/issue-102986.rs | 1 + tests/rustdoc-ui/issues/issue-103997.rs | 1 + tests/rustdoc-ui/issues/issue-105334.rs | 1 + tests/rustdoc-ui/issues/issue-105737.rs | 1 + tests/rustdoc-ui/issues/issue-105742.rs | 1 + tests/rustdoc-ui/issues/issue-106213.rs | 1 + tests/rustdoc-ui/issues/issue-107918.rs | 1 + tests/rustdoc-ui/issues/issue-110900.rs | 1 + 9 files changed, 9 insertions(+) diff --git a/tests/rustdoc-ui/issues/issue-101076.rs b/tests/rustdoc-ui/issues/issue-101076.rs index f9b93c408fd..0c9a8b9175b 100644 --- a/tests/rustdoc-ui/issues/issue-101076.rs +++ b/tests/rustdoc-ui/issues/issue-101076.rs @@ -1,4 +1,5 @@ //@ check-pass +// https://github.com/rust-lang/rust/issues/101076 const _: () = { #[macro_export] diff --git a/tests/rustdoc-ui/issues/issue-102986.rs b/tests/rustdoc-ui/issues/issue-102986.rs index 001784ac285..8fcbfffe172 100644 --- a/tests/rustdoc-ui/issues/issue-102986.rs +++ b/tests/rustdoc-ui/issues/issue-102986.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/102986 struct Struct { y: (typeof("hey"),), //~^ `typeof` is a reserved keyword but unimplemented diff --git a/tests/rustdoc-ui/issues/issue-103997.rs b/tests/rustdoc-ui/issues/issue-103997.rs index ebd1d2e4447..b6ba4e48cff 100644 --- a/tests/rustdoc-ui/issues/issue-103997.rs +++ b/tests/rustdoc-ui/issues/issue-103997.rs @@ -1,4 +1,5 @@ //@ check-pass +// https://github.com/rust-lang/rust/issues/103997 pub fn foo() {} diff --git a/tests/rustdoc-ui/issues/issue-105334.rs b/tests/rustdoc-ui/issues/issue-105334.rs index ee1adc6a029..f18f0456fdd 100644 --- a/tests/rustdoc-ui/issues/issue-105334.rs +++ b/tests/rustdoc-ui/issues/issue-105334.rs @@ -1,2 +1,3 @@ +// https://github.com/rust-lang/rust/issues/105334 impl Vec< br##"*.."## > {} //~^ ERROR diff --git a/tests/rustdoc-ui/issues/issue-105737.rs b/tests/rustdoc-ui/issues/issue-105737.rs index 154f069d8ff..651fd9ab4b8 100644 --- a/tests/rustdoc-ui/issues/issue-105737.rs +++ b/tests/rustdoc-ui/issues/issue-105737.rs @@ -1,3 +1,4 @@ +// https://github.com/rust-lang/rust/issues/105737 impl Vec {} //~^ ERROR diff --git a/tests/rustdoc-ui/issues/issue-105742.rs b/tests/rustdoc-ui/issues/issue-105742.rs index bd8ec4e8b58..027574923c7 100644 --- a/tests/rustdoc-ui/issues/issue-105742.rs +++ b/tests/rustdoc-ui/issues/issue-105742.rs @@ -1,4 +1,5 @@ //@ compile-flags: -Znormalize-docs +// https://github.com/rust-lang/rust/issues/105742 use std::ops::Index; pub fn next<'a, T>(s: &'a mut dyn SVec) { diff --git a/tests/rustdoc-ui/issues/issue-106213.rs b/tests/rustdoc-ui/issues/issue-106213.rs index 5c3a8390252..c954162589d 100644 --- a/tests/rustdoc-ui/issues/issue-106213.rs +++ b/tests/rustdoc-ui/issues/issue-106213.rs @@ -1,5 +1,6 @@ //@ compile-flags: --document-private-items //@ edition:2021 +// https://github.com/rust-lang/rust/issues/106213 fn use_avx() -> dyn { //~^ ERROR at least one trait is required for an object type diff --git a/tests/rustdoc-ui/issues/issue-107918.rs b/tests/rustdoc-ui/issues/issue-107918.rs index 19d53f84cb6..ec35b52e33b 100644 --- a/tests/rustdoc-ui/issues/issue-107918.rs +++ b/tests/rustdoc-ui/issues/issue-107918.rs @@ -2,6 +2,7 @@ //@ compile-flags: --document-private-items //@ build-pass //@ only-linux +// https://github.com/rust-lang/rust/issues/107918 #![no_std] #![no_main] diff --git a/tests/rustdoc-ui/issues/issue-110900.rs b/tests/rustdoc-ui/issues/issue-110900.rs index 5a896167083..4fa60f8878d 100644 --- a/tests/rustdoc-ui/issues/issue-110900.rs +++ b/tests/rustdoc-ui/issues/issue-110900.rs @@ -1,4 +1,5 @@ //@ check-pass +// https://github.com/rust-lang/rust/issues/110900 #![crate_type="lib"] -- cgit 1.4.1-3-g733a5 From b5318549c701771bde8b06709a69d7e3eb860c1f Mon Sep 17 00:00:00 2001 From: Michael Howell Date: Sun, 8 Dec 2024 21:59:23 -0700 Subject: rustdoc: rename `issue-\d+.rs` tests to have meaningful names --- .../issues/duplicate-panic-impl-107918.rs | 13 + .../issues/ice-associated-type-bounds-110900.rs | 28 + tests/rustdoc-ui/issues/ice-bare-dyn-106213.rs | 8 + tests/rustdoc-ui/issues/ice-bare-dyn-106213.stderr | 9 + .../issues/ice-generic-type-alias-105742.rs | 67 +++ .../issues/ice-generic-type-alias-105742.stderr | 638 +++++++++++++++++++++ .../issues/ice-impl-fn-generic-105737.rs | 5 + .../issues/ice-impl-fn-generic-105737.stderr | 12 + ...ice-macro-hidden-exported-macro-defid-101076.rs | 15 + .../issues/ice-placeholder-type-alias-106226.rs | 3 + .../ice-placeholder-type-alias-106226.stderr | 9 + tests/rustdoc-ui/issues/ice-raw-str-105334.rs | 3 + tests/rustdoc-ui/issues/ice-raw-str-105334.stderr | 9 + tests/rustdoc-ui/issues/ice-typeof-102986.rs | 5 + tests/rustdoc-ui/issues/ice-typeof-102986.stderr | 14 + .../issues/ice-unresolved-self-103997.rs | 7 + .../issues/ice-unresolved-self-103997.stderr | 10 + tests/rustdoc-ui/issues/issue-101076.rs | 15 - tests/rustdoc-ui/issues/issue-102986.rs | 5 - tests/rustdoc-ui/issues/issue-102986.stderr | 14 - tests/rustdoc-ui/issues/issue-103997.rs | 7 - tests/rustdoc-ui/issues/issue-103997.stderr | 10 - tests/rustdoc-ui/issues/issue-105334.rs | 3 - tests/rustdoc-ui/issues/issue-105334.stderr | 9 - tests/rustdoc-ui/issues/issue-105737.rs | 5 - tests/rustdoc-ui/issues/issue-105737.stderr | 12 - tests/rustdoc-ui/issues/issue-105742.rs | 67 --- tests/rustdoc-ui/issues/issue-105742.stderr | 638 --------------------- tests/rustdoc-ui/issues/issue-106213.rs | 8 - tests/rustdoc-ui/issues/issue-106213.stderr | 9 - tests/rustdoc-ui/issues/issue-106226.rs | 3 - tests/rustdoc-ui/issues/issue-106226.stderr | 9 - tests/rustdoc-ui/issues/issue-107918.rs | 13 - tests/rustdoc-ui/issues/issue-110900.rs | 28 - 34 files changed, 855 insertions(+), 855 deletions(-) create mode 100644 tests/rustdoc-ui/issues/duplicate-panic-impl-107918.rs create mode 100644 tests/rustdoc-ui/issues/ice-associated-type-bounds-110900.rs create mode 100644 tests/rustdoc-ui/issues/ice-bare-dyn-106213.rs create mode 100644 tests/rustdoc-ui/issues/ice-bare-dyn-106213.stderr create mode 100644 tests/rustdoc-ui/issues/ice-generic-type-alias-105742.rs create mode 100644 tests/rustdoc-ui/issues/ice-generic-type-alias-105742.stderr create mode 100644 tests/rustdoc-ui/issues/ice-impl-fn-generic-105737.rs create mode 100644 tests/rustdoc-ui/issues/ice-impl-fn-generic-105737.stderr create mode 100644 tests/rustdoc-ui/issues/ice-macro-hidden-exported-macro-defid-101076.rs create mode 100644 tests/rustdoc-ui/issues/ice-placeholder-type-alias-106226.rs create mode 100644 tests/rustdoc-ui/issues/ice-placeholder-type-alias-106226.stderr create mode 100644 tests/rustdoc-ui/issues/ice-raw-str-105334.rs create mode 100644 tests/rustdoc-ui/issues/ice-raw-str-105334.stderr create mode 100644 tests/rustdoc-ui/issues/ice-typeof-102986.rs create mode 100644 tests/rustdoc-ui/issues/ice-typeof-102986.stderr create mode 100644 tests/rustdoc-ui/issues/ice-unresolved-self-103997.rs create mode 100644 tests/rustdoc-ui/issues/ice-unresolved-self-103997.stderr delete mode 100644 tests/rustdoc-ui/issues/issue-101076.rs delete mode 100644 tests/rustdoc-ui/issues/issue-102986.rs delete mode 100644 tests/rustdoc-ui/issues/issue-102986.stderr delete mode 100644 tests/rustdoc-ui/issues/issue-103997.rs delete mode 100644 tests/rustdoc-ui/issues/issue-103997.stderr delete mode 100644 tests/rustdoc-ui/issues/issue-105334.rs delete mode 100644 tests/rustdoc-ui/issues/issue-105334.stderr delete mode 100644 tests/rustdoc-ui/issues/issue-105737.rs delete mode 100644 tests/rustdoc-ui/issues/issue-105737.stderr delete mode 100644 tests/rustdoc-ui/issues/issue-105742.rs delete mode 100644 tests/rustdoc-ui/issues/issue-105742.stderr delete mode 100644 tests/rustdoc-ui/issues/issue-106213.rs delete mode 100644 tests/rustdoc-ui/issues/issue-106213.stderr delete mode 100644 tests/rustdoc-ui/issues/issue-106226.rs delete mode 100644 tests/rustdoc-ui/issues/issue-106226.stderr delete mode 100644 tests/rustdoc-ui/issues/issue-107918.rs delete mode 100644 tests/rustdoc-ui/issues/issue-110900.rs diff --git a/tests/rustdoc-ui/issues/duplicate-panic-impl-107918.rs b/tests/rustdoc-ui/issues/duplicate-panic-impl-107918.rs new file mode 100644 index 00000000000..ec35b52e33b --- /dev/null +++ b/tests/rustdoc-ui/issues/duplicate-panic-impl-107918.rs @@ -0,0 +1,13 @@ +//@ aux-build:panic-handler.rs +//@ compile-flags: --document-private-items +//@ build-pass +//@ only-linux +// https://github.com/rust-lang/rust/issues/107918 + +#![no_std] +#![no_main] + +#[panic_handler] +fn panic(_: &core::panic::PanicInfo) -> ! { + loop {} +} diff --git a/tests/rustdoc-ui/issues/ice-associated-type-bounds-110900.rs b/tests/rustdoc-ui/issues/ice-associated-type-bounds-110900.rs new file mode 100644 index 00000000000..4fa60f8878d --- /dev/null +++ b/tests/rustdoc-ui/issues/ice-associated-type-bounds-110900.rs @@ -0,0 +1,28 @@ +//@ check-pass +// https://github.com/rust-lang/rust/issues/110900 + +#![crate_type="lib"] + +trait A<'a> {} +trait B<'b> {} + +trait C<'c>: for<'a> A<'a> + for<'b> B<'b> { + type As; +} + +trait E<'e> { + type As; +} +trait F<'f>: for<'a> A<'a> + for<'e> E<'e> {} +struct G +where + T: for<'l, 'i> H<'l, 'i, As: for<'a> A<'a> + 'i> +{ + t: std::marker::PhantomData, +} + +trait I<'a, 'b, 'c> { + type As; +} + +trait H<'d, 'e>: for<'f> I<'d, 'f, 'e> + 'd {} diff --git a/tests/rustdoc-ui/issues/ice-bare-dyn-106213.rs b/tests/rustdoc-ui/issues/ice-bare-dyn-106213.rs new file mode 100644 index 00000000000..c954162589d --- /dev/null +++ b/tests/rustdoc-ui/issues/ice-bare-dyn-106213.rs @@ -0,0 +1,8 @@ +//@ compile-flags: --document-private-items +//@ edition:2021 +// https://github.com/rust-lang/rust/issues/106213 + +fn use_avx() -> dyn { + //~^ ERROR at least one trait is required for an object type + !( ident_error ) +} diff --git a/tests/rustdoc-ui/issues/ice-bare-dyn-106213.stderr b/tests/rustdoc-ui/issues/ice-bare-dyn-106213.stderr new file mode 100644 index 00000000000..b029fee510e --- /dev/null +++ b/tests/rustdoc-ui/issues/ice-bare-dyn-106213.stderr @@ -0,0 +1,9 @@ +error[E0224]: at least one trait is required for an object type + --> $DIR/ice-bare-dyn-106213.rs:5:17 + | +LL | fn use_avx() -> dyn { + | ^^^ + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0224`. diff --git a/tests/rustdoc-ui/issues/ice-generic-type-alias-105742.rs b/tests/rustdoc-ui/issues/ice-generic-type-alias-105742.rs new file mode 100644 index 00000000000..027574923c7 --- /dev/null +++ b/tests/rustdoc-ui/issues/ice-generic-type-alias-105742.rs @@ -0,0 +1,67 @@ +//@ compile-flags: -Znormalize-docs +// https://github.com/rust-lang/rust/issues/105742 +use std::ops::Index; + +pub fn next<'a, T>(s: &'a mut dyn SVec) { + //~^ expected 1 lifetime argument + //~| expected 1 generic argument + //~| the trait `SVec` cannot be made into an object + //~| `SVec` cannot be made into an object + //~| missing generics for associated type `SVec::Item` + //~| missing generics for associated type `SVec::Item` + let _ = s; +} + +pub trait SVec: Index< + ::Item, + //~^ expected 1 lifetime argument + //~| expected 1 generic argument + //~| missing generics for associated type `SVec::Item` + //~| missing generics for associated type `SVec::Item` + //~| missing generics for associated type `SVec::Item` + //~| missing generics for associated type `SVec::Item` + //~| missing generics for associated type `SVec::Item` + //~| missing generics for associated type `SVec::Item` + //~| missing generics for associated type `SVec::Item` + //~| missing generics for associated type `SVec::Item` + Output = ::Item, + //~^ expected 1 lifetime argument + //~| expected 1 generic argument + //~| missing generics for associated type `SVec::Item` + //~| missing generics for associated type `SVec::Item` + //~| missing generics for associated type `SVec::Item` + //~| missing generics for associated type `SVec::Item` + //~| missing generics for associated type `SVec::Item` + //~| missing generics for associated type `SVec::Item` + //~| missing generics for associated type `SVec::Item` + //~| missing generics for associated type `SVec::Item` + Output = ::Item> as SVec>::Item, + //~^ expected 1 lifetime argument + //~| expected 1 generic argument + //~| expected 1 lifetime argument + //~| missing generics for associated type `SVec::Item` + //~| missing generics for associated type `SVec::Item` + //~| missing generics for associated type `SVec::Item` + //~| missing generics for associated type `SVec::Item` + //~| missing generics for associated type `SVec::Item` + //~| missing generics for associated type `SVec::Item` + //~| expected 1 generic argument + //~| missing generics for associated type `SVec::Item` + //~| missing generics for associated type `SVec::Item` + //~| missing generics for associated type `SVec::Item` + //~| missing generics for associated type `SVec::Item` + //~| missing generics for associated type `SVec::Item` + //~| missing generics for associated type `SVec::Item` + //~| missing generics for associated type `SVec::Item` + //~| missing generics for associated type `SVec::Item` + //~| missing generics for associated type `SVec::Item` + //~| missing generics for associated type `SVec::Item` +> { + type Item<'a, T>; + + fn len(&self) -> ::Item; + //~^ expected 1 lifetime argument + //~| missing generics for associated type `SVec::Item` + //~| expected 1 generic argument + //~| missing generics for associated type `SVec::Item` +} diff --git a/tests/rustdoc-ui/issues/ice-generic-type-alias-105742.stderr b/tests/rustdoc-ui/issues/ice-generic-type-alias-105742.stderr new file mode 100644 index 00000000000..06a1cf6b118 --- /dev/null +++ b/tests/rustdoc-ui/issues/ice-generic-type-alias-105742.stderr @@ -0,0 +1,638 @@ +error[E0107]: missing generics for associated type `SVec::Item` + --> $DIR/ice-generic-type-alias-105742.rs:16:21 + | +LL | ::Item, + | ^^^^ expected 1 lifetime argument + | +note: associated type defined here, with 1 lifetime parameter: `'a` + --> $DIR/ice-generic-type-alias-105742.rs:60:10 + | +LL | type Item<'a, T>; + | ^^^^ -- +help: add missing lifetime argument + | +LL | ::Item<'a>, + | ++++ + +error[E0107]: missing generics for associated type `SVec::Item` + --> $DIR/ice-generic-type-alias-105742.rs:16:21 + | +LL | ::Item, + | ^^^^ expected 1 generic argument + | +note: associated type defined here, with 1 generic parameter: `T` + --> $DIR/ice-generic-type-alias-105742.rs:60:10 + | +LL | type Item<'a, T>; + | ^^^^ - +help: add missing generic argument + | +LL | ::Item, + | +++ + +error[E0107]: missing generics for associated type `SVec::Item` + --> $DIR/ice-generic-type-alias-105742.rs:27:37 + | +LL | Output = ::Item, + | ^^^^ expected 1 lifetime argument + | +note: associated type defined here, with 1 lifetime parameter: `'a` + --> $DIR/ice-generic-type-alias-105742.rs:60:10 + | +LL | type Item<'a, T>; + | ^^^^ -- +help: add missing lifetime argument + | +LL | Output = ::Item<'a>, + | ++++ + +error[E0107]: missing generics for associated type `SVec::Item` + --> $DIR/ice-generic-type-alias-105742.rs:27:37 + | +LL | Output = ::Item, + | ^^^^ expected 1 generic argument + | +note: associated type defined here, with 1 generic parameter: `T` + --> $DIR/ice-generic-type-alias-105742.rs:60:10 + | +LL | type Item<'a, T>; + | ^^^^ - +help: add missing generic argument + | +LL | Output = ::Item, + | +++ + +error[E0107]: missing generics for associated type `SVec::Item` + --> $DIR/ice-generic-type-alias-105742.rs:38:30 + | +LL | Output = ::Item> as SVec>::Item, + | ^^^^ expected 1 lifetime argument + | +note: associated type defined here, with 1 lifetime parameter: `'a` + --> $DIR/ice-generic-type-alias-105742.rs:60:10 + | +LL | type Item<'a, T>; + | ^^^^ -- +help: add missing lifetime argument + | +LL | Output = ::Item<'a>> as SVec>::Item, + | ++++ + +error[E0107]: missing generics for associated type `SVec::Item` + --> $DIR/ice-generic-type-alias-105742.rs:38:30 + | +LL | Output = ::Item> as SVec>::Item, + | ^^^^ expected 1 generic argument + | +note: associated type defined here, with 1 generic parameter: `T` + --> $DIR/ice-generic-type-alias-105742.rs:60:10 + | +LL | type Item<'a, T>; + | ^^^^ - +help: add missing generic argument + | +LL | Output = ::Item> as SVec>::Item, + | +++ + +error[E0107]: missing generics for associated type `SVec::Item` + --> $DIR/ice-generic-type-alias-105742.rs:38:46 + | +LL | Output = ::Item> as SVec>::Item, + | ^^^^ expected 1 lifetime argument + | +note: associated type defined here, with 1 lifetime parameter: `'a` + --> $DIR/ice-generic-type-alias-105742.rs:60:10 + | +LL | type Item<'a, T>; + | ^^^^ -- +help: add missing lifetime argument + | +LL | Output = ::Item> as SVec>::Item<'a>, + | ++++ + +error[E0107]: missing generics for associated type `SVec::Item` + --> $DIR/ice-generic-type-alias-105742.rs:38:46 + | +LL | Output = ::Item> as SVec>::Item, + | ^^^^ expected 1 generic argument + | +note: associated type defined here, with 1 generic parameter: `T` + --> $DIR/ice-generic-type-alias-105742.rs:60:10 + | +LL | type Item<'a, T>; + | ^^^^ - +help: add missing generic argument + | +LL | Output = ::Item> as SVec>::Item, + | +++ + +error[E0107]: missing generics for associated type `SVec::Item` + --> $DIR/ice-generic-type-alias-105742.rs:5:40 + | +LL | pub fn next<'a, T>(s: &'a mut dyn SVec) { + | ^^^^ expected 1 lifetime argument + | +note: associated type defined here, with 1 lifetime parameter: `'a` + --> $DIR/ice-generic-type-alias-105742.rs:60:10 + | +LL | type Item<'a, T>; + | ^^^^ -- +help: add missing lifetime argument + | +LL | pub fn next<'a, T>(s: &'a mut dyn SVec = T, Output = T>) { + | ++++ + +error[E0107]: missing generics for associated type `SVec::Item` + --> $DIR/ice-generic-type-alias-105742.rs:5:40 + | +LL | pub fn next<'a, T>(s: &'a mut dyn SVec) { + | ^^^^ expected 1 generic argument + | +note: associated type defined here, with 1 generic parameter: `T` + --> $DIR/ice-generic-type-alias-105742.rs:60:10 + | +LL | type Item<'a, T>; + | ^^^^ - +help: add missing generic argument + | +LL | pub fn next<'a, T>(s: &'a mut dyn SVec = T, Output = T>) { + | +++ + +error[E0107]: missing generics for associated type `SVec::Item` + --> $DIR/ice-generic-type-alias-105742.rs:16:21 + | +LL | ::Item, + | ^^^^ expected 1 lifetime argument + | +note: associated type defined here, with 1 lifetime parameter: `'a` + --> $DIR/ice-generic-type-alias-105742.rs:60:10 + | +LL | type Item<'a, T>; + | ^^^^ -- + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: add missing lifetime argument + | +LL | ::Item<'a>, + | ++++ + +error[E0107]: missing generics for associated type `SVec::Item` + --> $DIR/ice-generic-type-alias-105742.rs:16:21 + | +LL | ::Item, + | ^^^^ expected 1 generic argument + | +note: associated type defined here, with 1 generic parameter: `T` + --> $DIR/ice-generic-type-alias-105742.rs:60:10 + | +LL | type Item<'a, T>; + | ^^^^ - + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: add missing generic argument + | +LL | ::Item, + | +++ + +error[E0107]: missing generics for associated type `SVec::Item` + --> $DIR/ice-generic-type-alias-105742.rs:27:37 + | +LL | Output = ::Item, + | ^^^^ expected 1 lifetime argument + | +note: associated type defined here, with 1 lifetime parameter: `'a` + --> $DIR/ice-generic-type-alias-105742.rs:60:10 + | +LL | type Item<'a, T>; + | ^^^^ -- + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: add missing lifetime argument + | +LL | Output = ::Item<'a>, + | ++++ + +error[E0107]: missing generics for associated type `SVec::Item` + --> $DIR/ice-generic-type-alias-105742.rs:27:37 + | +LL | Output = ::Item, + | ^^^^ expected 1 generic argument + | +note: associated type defined here, with 1 generic parameter: `T` + --> $DIR/ice-generic-type-alias-105742.rs:60:10 + | +LL | type Item<'a, T>; + | ^^^^ - + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: add missing generic argument + | +LL | Output = ::Item, + | +++ + +error[E0107]: missing generics for associated type `SVec::Item` + --> $DIR/ice-generic-type-alias-105742.rs:38:30 + | +LL | Output = ::Item> as SVec>::Item, + | ^^^^ expected 1 lifetime argument + | +note: associated type defined here, with 1 lifetime parameter: `'a` + --> $DIR/ice-generic-type-alias-105742.rs:60:10 + | +LL | type Item<'a, T>; + | ^^^^ -- + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: add missing lifetime argument + | +LL | Output = ::Item<'a>> as SVec>::Item, + | ++++ + +error[E0107]: missing generics for associated type `SVec::Item` + --> $DIR/ice-generic-type-alias-105742.rs:38:30 + | +LL | Output = ::Item> as SVec>::Item, + | ^^^^ expected 1 generic argument + | +note: associated type defined here, with 1 generic parameter: `T` + --> $DIR/ice-generic-type-alias-105742.rs:60:10 + | +LL | type Item<'a, T>; + | ^^^^ - + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: add missing generic argument + | +LL | Output = ::Item> as SVec>::Item, + | +++ + +error[E0107]: missing generics for associated type `SVec::Item` + --> $DIR/ice-generic-type-alias-105742.rs:38:46 + | +LL | Output = ::Item> as SVec>::Item, + | ^^^^ expected 1 lifetime argument + | +note: associated type defined here, with 1 lifetime parameter: `'a` + --> $DIR/ice-generic-type-alias-105742.rs:60:10 + | +LL | type Item<'a, T>; + | ^^^^ -- + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: add missing lifetime argument + | +LL | Output = ::Item> as SVec>::Item<'a>, + | ++++ + +error[E0107]: missing generics for associated type `SVec::Item` + --> $DIR/ice-generic-type-alias-105742.rs:38:46 + | +LL | Output = ::Item> as SVec>::Item, + | ^^^^ expected 1 generic argument + | +note: associated type defined here, with 1 generic parameter: `T` + --> $DIR/ice-generic-type-alias-105742.rs:60:10 + | +LL | type Item<'a, T>; + | ^^^^ - + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: add missing generic argument + | +LL | Output = ::Item> as SVec>::Item, + | +++ + +error[E0038]: the trait `SVec` cannot be made into an object + --> $DIR/ice-generic-type-alias-105742.rs:5:31 + | +LL | pub fn next<'a, T>(s: &'a mut dyn SVec) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `SVec` cannot be made into an object + | +note: for a trait to be "dyn-compatible" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit + --> $DIR/ice-generic-type-alias-105742.rs:15:17 + | +LL | pub trait SVec: Index< + | ____________----__^ + | | | + | | this trait cannot be made into an object... +LL | | ::Item, +LL | | +LL | | +... | +LL | |/ Output = ::Item, +LL | || +LL | || +LL | || +... || +LL | || +LL | || Output = ::Item> as SVec>::Item, + | ||_________________________________________________^ ...because it uses `Self` as a type parameter +... | +LL | | +LL | | > { + | |__^ ...because it uses `Self` as a type parameter +help: consider using an opaque type instead + | +LL | pub fn next<'a, T>(s: &'a mut impl SVec) { + | ~~~~ + +error[E0107]: missing generics for associated type `SVec::Item` + --> $DIR/ice-generic-type-alias-105742.rs:16:21 + | +LL | ::Item, + | ^^^^ expected 1 lifetime argument + | +note: associated type defined here, with 1 lifetime parameter: `'a` + --> $DIR/ice-generic-type-alias-105742.rs:60:10 + | +LL | type Item<'a, T>; + | ^^^^ -- + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: add missing lifetime argument + | +LL | ::Item<'a>, + | ++++ + +error[E0107]: missing generics for associated type `SVec::Item` + --> $DIR/ice-generic-type-alias-105742.rs:16:21 + | +LL | ::Item, + | ^^^^ expected 1 generic argument + | +note: associated type defined here, with 1 generic parameter: `T` + --> $DIR/ice-generic-type-alias-105742.rs:60:10 + | +LL | type Item<'a, T>; + | ^^^^ - + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: add missing generic argument + | +LL | ::Item, + | +++ + +error[E0107]: missing generics for associated type `SVec::Item` + --> $DIR/ice-generic-type-alias-105742.rs:27:37 + | +LL | Output = ::Item, + | ^^^^ expected 1 lifetime argument + | +note: associated type defined here, with 1 lifetime parameter: `'a` + --> $DIR/ice-generic-type-alias-105742.rs:60:10 + | +LL | type Item<'a, T>; + | ^^^^ -- + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: add missing lifetime argument + | +LL | Output = ::Item<'a>, + | ++++ + +error[E0107]: missing generics for associated type `SVec::Item` + --> $DIR/ice-generic-type-alias-105742.rs:27:37 + | +LL | Output = ::Item, + | ^^^^ expected 1 generic argument + | +note: associated type defined here, with 1 generic parameter: `T` + --> $DIR/ice-generic-type-alias-105742.rs:60:10 + | +LL | type Item<'a, T>; + | ^^^^ - + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: add missing generic argument + | +LL | Output = ::Item, + | +++ + +error[E0107]: missing generics for associated type `SVec::Item` + --> $DIR/ice-generic-type-alias-105742.rs:38:30 + | +LL | Output = ::Item> as SVec>::Item, + | ^^^^ expected 1 lifetime argument + | +note: associated type defined here, with 1 lifetime parameter: `'a` + --> $DIR/ice-generic-type-alias-105742.rs:60:10 + | +LL | type Item<'a, T>; + | ^^^^ -- + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: add missing lifetime argument + | +LL | Output = ::Item<'a>> as SVec>::Item, + | ++++ + +error[E0107]: missing generics for associated type `SVec::Item` + --> $DIR/ice-generic-type-alias-105742.rs:38:30 + | +LL | Output = ::Item> as SVec>::Item, + | ^^^^ expected 1 generic argument + | +note: associated type defined here, with 1 generic parameter: `T` + --> $DIR/ice-generic-type-alias-105742.rs:60:10 + | +LL | type Item<'a, T>; + | ^^^^ - + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: add missing generic argument + | +LL | Output = ::Item> as SVec>::Item, + | +++ + +error[E0107]: missing generics for associated type `SVec::Item` + --> $DIR/ice-generic-type-alias-105742.rs:38:46 + | +LL | Output = ::Item> as SVec>::Item, + | ^^^^ expected 1 lifetime argument + | +note: associated type defined here, with 1 lifetime parameter: `'a` + --> $DIR/ice-generic-type-alias-105742.rs:60:10 + | +LL | type Item<'a, T>; + | ^^^^ -- + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: add missing lifetime argument + | +LL | Output = ::Item> as SVec>::Item<'a>, + | ++++ + +error[E0107]: missing generics for associated type `SVec::Item` + --> $DIR/ice-generic-type-alias-105742.rs:38:46 + | +LL | Output = ::Item> as SVec>::Item, + | ^^^^ expected 1 generic argument + | +note: associated type defined here, with 1 generic parameter: `T` + --> $DIR/ice-generic-type-alias-105742.rs:60:10 + | +LL | type Item<'a, T>; + | ^^^^ - + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: add missing generic argument + | +LL | Output = ::Item> as SVec>::Item, + | +++ + +error[E0107]: missing generics for associated type `SVec::Item` + --> $DIR/ice-generic-type-alias-105742.rs:16:21 + | +LL | ::Item, + | ^^^^ expected 1 lifetime argument + | +note: associated type defined here, with 1 lifetime parameter: `'a` + --> $DIR/ice-generic-type-alias-105742.rs:60:10 + | +LL | type Item<'a, T>; + | ^^^^ -- + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: add missing lifetime argument + | +LL | ::Item<'a>, + | ++++ + +error[E0107]: missing generics for associated type `SVec::Item` + --> $DIR/ice-generic-type-alias-105742.rs:16:21 + | +LL | ::Item, + | ^^^^ expected 1 generic argument + | +note: associated type defined here, with 1 generic parameter: `T` + --> $DIR/ice-generic-type-alias-105742.rs:60:10 + | +LL | type Item<'a, T>; + | ^^^^ - + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: add missing generic argument + | +LL | ::Item, + | +++ + +error[E0107]: missing generics for associated type `SVec::Item` + --> $DIR/ice-generic-type-alias-105742.rs:27:37 + | +LL | Output = ::Item, + | ^^^^ expected 1 lifetime argument + | +note: associated type defined here, with 1 lifetime parameter: `'a` + --> $DIR/ice-generic-type-alias-105742.rs:60:10 + | +LL | type Item<'a, T>; + | ^^^^ -- + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: add missing lifetime argument + | +LL | Output = ::Item<'a>, + | ++++ + +error[E0107]: missing generics for associated type `SVec::Item` + --> $DIR/ice-generic-type-alias-105742.rs:27:37 + | +LL | Output = ::Item, + | ^^^^ expected 1 generic argument + | +note: associated type defined here, with 1 generic parameter: `T` + --> $DIR/ice-generic-type-alias-105742.rs:60:10 + | +LL | type Item<'a, T>; + | ^^^^ - + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: add missing generic argument + | +LL | Output = ::Item, + | +++ + +error[E0107]: missing generics for associated type `SVec::Item` + --> $DIR/ice-generic-type-alias-105742.rs:38:30 + | +LL | Output = ::Item> as SVec>::Item, + | ^^^^ expected 1 lifetime argument + | +note: associated type defined here, with 1 lifetime parameter: `'a` + --> $DIR/ice-generic-type-alias-105742.rs:60:10 + | +LL | type Item<'a, T>; + | ^^^^ -- + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: add missing lifetime argument + | +LL | Output = ::Item<'a>> as SVec>::Item, + | ++++ + +error[E0107]: missing generics for associated type `SVec::Item` + --> $DIR/ice-generic-type-alias-105742.rs:38:30 + | +LL | Output = ::Item> as SVec>::Item, + | ^^^^ expected 1 generic argument + | +note: associated type defined here, with 1 generic parameter: `T` + --> $DIR/ice-generic-type-alias-105742.rs:60:10 + | +LL | type Item<'a, T>; + | ^^^^ - + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: add missing generic argument + | +LL | Output = ::Item> as SVec>::Item, + | +++ + +error[E0107]: missing generics for associated type `SVec::Item` + --> $DIR/ice-generic-type-alias-105742.rs:38:46 + | +LL | Output = ::Item> as SVec>::Item, + | ^^^^ expected 1 lifetime argument + | +note: associated type defined here, with 1 lifetime parameter: `'a` + --> $DIR/ice-generic-type-alias-105742.rs:60:10 + | +LL | type Item<'a, T>; + | ^^^^ -- + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: add missing lifetime argument + | +LL | Output = ::Item> as SVec>::Item<'a>, + | ++++ + +error[E0107]: missing generics for associated type `SVec::Item` + --> $DIR/ice-generic-type-alias-105742.rs:38:46 + | +LL | Output = ::Item> as SVec>::Item, + | ^^^^ expected 1 generic argument + | +note: associated type defined here, with 1 generic parameter: `T` + --> $DIR/ice-generic-type-alias-105742.rs:60:10 + | +LL | type Item<'a, T>; + | ^^^^ - + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: add missing generic argument + | +LL | Output = ::Item> as SVec>::Item, + | +++ + +error[E0107]: missing generics for associated type `SVec::Item` + --> $DIR/ice-generic-type-alias-105742.rs:62:38 + | +LL | fn len(&self) -> ::Item; + | ^^^^ expected 1 lifetime argument + | +note: associated type defined here, with 1 lifetime parameter: `'a` + --> $DIR/ice-generic-type-alias-105742.rs:60:10 + | +LL | type Item<'a, T>; + | ^^^^ -- +help: add missing lifetime argument + | +LL | fn len(&self) -> ::Item<'_>; + | ++++ + +error[E0107]: missing generics for associated type `SVec::Item` + --> $DIR/ice-generic-type-alias-105742.rs:62:38 + | +LL | fn len(&self) -> ::Item; + | ^^^^ expected 1 generic argument + | +note: associated type defined here, with 1 generic parameter: `T` + --> $DIR/ice-generic-type-alias-105742.rs:60:10 + | +LL | type Item<'a, T>; + | ^^^^ - +help: add missing generic argument + | +LL | fn len(&self) -> ::Item; + | +++ + +error: aborting due to 37 previous errors + +Some errors have detailed explanations: E0038, E0107. +For more information about an error, try `rustc --explain E0038`. diff --git a/tests/rustdoc-ui/issues/ice-impl-fn-generic-105737.rs b/tests/rustdoc-ui/issues/ice-impl-fn-generic-105737.rs new file mode 100644 index 00000000000..651fd9ab4b8 --- /dev/null +++ b/tests/rustdoc-ui/issues/ice-impl-fn-generic-105737.rs @@ -0,0 +1,5 @@ +// https://github.com/rust-lang/rust/issues/105737 +impl Vec {} +//~^ ERROR + +pub fn lol() {} diff --git a/tests/rustdoc-ui/issues/ice-impl-fn-generic-105737.stderr b/tests/rustdoc-ui/issues/ice-impl-fn-generic-105737.stderr new file mode 100644 index 00000000000..49cbebc91d9 --- /dev/null +++ b/tests/rustdoc-ui/issues/ice-impl-fn-generic-105737.stderr @@ -0,0 +1,12 @@ +error[E0747]: constant provided when a type was expected + --> $DIR/ice-impl-fn-generic-105737.rs:2:10 + | +LL | impl Vec {} + | ^^^ + | + = help: `lol` is a function item, not a type + = help: function item types cannot be named directly + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0747`. diff --git a/tests/rustdoc-ui/issues/ice-macro-hidden-exported-macro-defid-101076.rs b/tests/rustdoc-ui/issues/ice-macro-hidden-exported-macro-defid-101076.rs new file mode 100644 index 00000000000..0c9a8b9175b --- /dev/null +++ b/tests/rustdoc-ui/issues/ice-macro-hidden-exported-macro-defid-101076.rs @@ -0,0 +1,15 @@ +//@ check-pass +// https://github.com/rust-lang/rust/issues/101076 + +const _: () = { + #[macro_export] + macro_rules! first_macro { + () => {} + } + mod foo { + #[macro_export] + macro_rules! second_macro { + () => {} + } + } +}; diff --git a/tests/rustdoc-ui/issues/ice-placeholder-type-alias-106226.rs b/tests/rustdoc-ui/issues/ice-placeholder-type-alias-106226.rs new file mode 100644 index 00000000000..71b497a9adc --- /dev/null +++ b/tests/rustdoc-ui/issues/ice-placeholder-type-alias-106226.rs @@ -0,0 +1,3 @@ +// This is a regression test for . +type F = [_; ()]; +//~^ ERROR diff --git a/tests/rustdoc-ui/issues/ice-placeholder-type-alias-106226.stderr b/tests/rustdoc-ui/issues/ice-placeholder-type-alias-106226.stderr new file mode 100644 index 00000000000..e9080925450 --- /dev/null +++ b/tests/rustdoc-ui/issues/ice-placeholder-type-alias-106226.stderr @@ -0,0 +1,9 @@ +error[E0121]: the placeholder `_` is not allowed within types on item signatures for type aliases + --> $DIR/ice-placeholder-type-alias-106226.rs:2:11 + | +LL | type F = [_; ()]; + | ^ not allowed in type signatures + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0121`. diff --git a/tests/rustdoc-ui/issues/ice-raw-str-105334.rs b/tests/rustdoc-ui/issues/ice-raw-str-105334.rs new file mode 100644 index 00000000000..f18f0456fdd --- /dev/null +++ b/tests/rustdoc-ui/issues/ice-raw-str-105334.rs @@ -0,0 +1,3 @@ +// https://github.com/rust-lang/rust/issues/105334 +impl Vec< br##"*.."## > {} +//~^ ERROR diff --git a/tests/rustdoc-ui/issues/ice-raw-str-105334.stderr b/tests/rustdoc-ui/issues/ice-raw-str-105334.stderr new file mode 100644 index 00000000000..2096757fbb9 --- /dev/null +++ b/tests/rustdoc-ui/issues/ice-raw-str-105334.stderr @@ -0,0 +1,9 @@ +error[E0747]: constant provided when a type was expected + --> $DIR/ice-raw-str-105334.rs:2:11 + | +LL | impl Vec< br##"*.."## > {} + | ^^^^^^^^^^^ + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0747`. diff --git a/tests/rustdoc-ui/issues/ice-typeof-102986.rs b/tests/rustdoc-ui/issues/ice-typeof-102986.rs new file mode 100644 index 00000000000..8fcbfffe172 --- /dev/null +++ b/tests/rustdoc-ui/issues/ice-typeof-102986.rs @@ -0,0 +1,5 @@ +// https://github.com/rust-lang/rust/issues/102986 +struct Struct { + y: (typeof("hey"),), + //~^ `typeof` is a reserved keyword but unimplemented +} diff --git a/tests/rustdoc-ui/issues/ice-typeof-102986.stderr b/tests/rustdoc-ui/issues/ice-typeof-102986.stderr new file mode 100644 index 00000000000..20dbb2661bc --- /dev/null +++ b/tests/rustdoc-ui/issues/ice-typeof-102986.stderr @@ -0,0 +1,14 @@ +error[E0516]: `typeof` is a reserved keyword but unimplemented + --> $DIR/ice-typeof-102986.rs:3:9 + | +LL | y: (typeof("hey"),), + | ^^^^^^^^^^^^^ reserved keyword + | +help: consider replacing `typeof(...)` with an actual type + | +LL | y: (&str,), + | ~~~~ + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0516`. diff --git a/tests/rustdoc-ui/issues/ice-unresolved-self-103997.rs b/tests/rustdoc-ui/issues/ice-unresolved-self-103997.rs new file mode 100644 index 00000000000..b6ba4e48cff --- /dev/null +++ b/tests/rustdoc-ui/issues/ice-unresolved-self-103997.rs @@ -0,0 +1,7 @@ +//@ check-pass +// https://github.com/rust-lang/rust/issues/103997 + +pub fn foo() {} + +/// [`foo`](Self::foo) //~ WARNING unresolved link to `Self::foo` +pub use foo as bar; diff --git a/tests/rustdoc-ui/issues/ice-unresolved-self-103997.stderr b/tests/rustdoc-ui/issues/ice-unresolved-self-103997.stderr new file mode 100644 index 00000000000..9cb64079c61 --- /dev/null +++ b/tests/rustdoc-ui/issues/ice-unresolved-self-103997.stderr @@ -0,0 +1,10 @@ +warning: unresolved link to `Self::foo` + --> $DIR/ice-unresolved-self-103997.rs:6:13 + | +LL | /// [`foo`](Self::foo) + | ^^^^^^^^^ no item named `Self` in scope + | + = note: `#[warn(rustdoc::broken_intra_doc_links)]` on by default + +warning: 1 warning emitted + diff --git a/tests/rustdoc-ui/issues/issue-101076.rs b/tests/rustdoc-ui/issues/issue-101076.rs deleted file mode 100644 index 0c9a8b9175b..00000000000 --- a/tests/rustdoc-ui/issues/issue-101076.rs +++ /dev/null @@ -1,15 +0,0 @@ -//@ check-pass -// https://github.com/rust-lang/rust/issues/101076 - -const _: () = { - #[macro_export] - macro_rules! first_macro { - () => {} - } - mod foo { - #[macro_export] - macro_rules! second_macro { - () => {} - } - } -}; diff --git a/tests/rustdoc-ui/issues/issue-102986.rs b/tests/rustdoc-ui/issues/issue-102986.rs deleted file mode 100644 index 8fcbfffe172..00000000000 --- a/tests/rustdoc-ui/issues/issue-102986.rs +++ /dev/null @@ -1,5 +0,0 @@ -// https://github.com/rust-lang/rust/issues/102986 -struct Struct { - y: (typeof("hey"),), - //~^ `typeof` is a reserved keyword but unimplemented -} diff --git a/tests/rustdoc-ui/issues/issue-102986.stderr b/tests/rustdoc-ui/issues/issue-102986.stderr deleted file mode 100644 index d91f93f394a..00000000000 --- a/tests/rustdoc-ui/issues/issue-102986.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error[E0516]: `typeof` is a reserved keyword but unimplemented - --> $DIR/issue-102986.rs:2:9 - | -LL | y: (typeof("hey"),), - | ^^^^^^^^^^^^^ reserved keyword - | -help: consider replacing `typeof(...)` with an actual type - | -LL | y: (&str,), - | ~~~~ - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0516`. diff --git a/tests/rustdoc-ui/issues/issue-103997.rs b/tests/rustdoc-ui/issues/issue-103997.rs deleted file mode 100644 index b6ba4e48cff..00000000000 --- a/tests/rustdoc-ui/issues/issue-103997.rs +++ /dev/null @@ -1,7 +0,0 @@ -//@ check-pass -// https://github.com/rust-lang/rust/issues/103997 - -pub fn foo() {} - -/// [`foo`](Self::foo) //~ WARNING unresolved link to `Self::foo` -pub use foo as bar; diff --git a/tests/rustdoc-ui/issues/issue-103997.stderr b/tests/rustdoc-ui/issues/issue-103997.stderr deleted file mode 100644 index c06db91496f..00000000000 --- a/tests/rustdoc-ui/issues/issue-103997.stderr +++ /dev/null @@ -1,10 +0,0 @@ -warning: unresolved link to `Self::foo` - --> $DIR/issue-103997.rs:5:13 - | -LL | /// [`foo`](Self::foo) - | ^^^^^^^^^ no item named `Self` in scope - | - = note: `#[warn(rustdoc::broken_intra_doc_links)]` on by default - -warning: 1 warning emitted - diff --git a/tests/rustdoc-ui/issues/issue-105334.rs b/tests/rustdoc-ui/issues/issue-105334.rs deleted file mode 100644 index f18f0456fdd..00000000000 --- a/tests/rustdoc-ui/issues/issue-105334.rs +++ /dev/null @@ -1,3 +0,0 @@ -// https://github.com/rust-lang/rust/issues/105334 -impl Vec< br##"*.."## > {} -//~^ ERROR diff --git a/tests/rustdoc-ui/issues/issue-105334.stderr b/tests/rustdoc-ui/issues/issue-105334.stderr deleted file mode 100644 index d992b219b3b..00000000000 --- a/tests/rustdoc-ui/issues/issue-105334.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0747]: constant provided when a type was expected - --> $DIR/issue-105334.rs:1:11 - | -LL | impl Vec< br##"*.."## > {} - | ^^^^^^^^^^^ - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0747`. diff --git a/tests/rustdoc-ui/issues/issue-105737.rs b/tests/rustdoc-ui/issues/issue-105737.rs deleted file mode 100644 index 651fd9ab4b8..00000000000 --- a/tests/rustdoc-ui/issues/issue-105737.rs +++ /dev/null @@ -1,5 +0,0 @@ -// https://github.com/rust-lang/rust/issues/105737 -impl Vec {} -//~^ ERROR - -pub fn lol() {} diff --git a/tests/rustdoc-ui/issues/issue-105737.stderr b/tests/rustdoc-ui/issues/issue-105737.stderr deleted file mode 100644 index 2c63c345e46..00000000000 --- a/tests/rustdoc-ui/issues/issue-105737.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0747]: constant provided when a type was expected - --> $DIR/issue-105737.rs:1:10 - | -LL | impl Vec {} - | ^^^ - | - = help: `lol` is a function item, not a type - = help: function item types cannot be named directly - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0747`. diff --git a/tests/rustdoc-ui/issues/issue-105742.rs b/tests/rustdoc-ui/issues/issue-105742.rs deleted file mode 100644 index 027574923c7..00000000000 --- a/tests/rustdoc-ui/issues/issue-105742.rs +++ /dev/null @@ -1,67 +0,0 @@ -//@ compile-flags: -Znormalize-docs -// https://github.com/rust-lang/rust/issues/105742 -use std::ops::Index; - -pub fn next<'a, T>(s: &'a mut dyn SVec) { - //~^ expected 1 lifetime argument - //~| expected 1 generic argument - //~| the trait `SVec` cannot be made into an object - //~| `SVec` cannot be made into an object - //~| missing generics for associated type `SVec::Item` - //~| missing generics for associated type `SVec::Item` - let _ = s; -} - -pub trait SVec: Index< - ::Item, - //~^ expected 1 lifetime argument - //~| expected 1 generic argument - //~| missing generics for associated type `SVec::Item` - //~| missing generics for associated type `SVec::Item` - //~| missing generics for associated type `SVec::Item` - //~| missing generics for associated type `SVec::Item` - //~| missing generics for associated type `SVec::Item` - //~| missing generics for associated type `SVec::Item` - //~| missing generics for associated type `SVec::Item` - //~| missing generics for associated type `SVec::Item` - Output = ::Item, - //~^ expected 1 lifetime argument - //~| expected 1 generic argument - //~| missing generics for associated type `SVec::Item` - //~| missing generics for associated type `SVec::Item` - //~| missing generics for associated type `SVec::Item` - //~| missing generics for associated type `SVec::Item` - //~| missing generics for associated type `SVec::Item` - //~| missing generics for associated type `SVec::Item` - //~| missing generics for associated type `SVec::Item` - //~| missing generics for associated type `SVec::Item` - Output = ::Item> as SVec>::Item, - //~^ expected 1 lifetime argument - //~| expected 1 generic argument - //~| expected 1 lifetime argument - //~| missing generics for associated type `SVec::Item` - //~| missing generics for associated type `SVec::Item` - //~| missing generics for associated type `SVec::Item` - //~| missing generics for associated type `SVec::Item` - //~| missing generics for associated type `SVec::Item` - //~| missing generics for associated type `SVec::Item` - //~| expected 1 generic argument - //~| missing generics for associated type `SVec::Item` - //~| missing generics for associated type `SVec::Item` - //~| missing generics for associated type `SVec::Item` - //~| missing generics for associated type `SVec::Item` - //~| missing generics for associated type `SVec::Item` - //~| missing generics for associated type `SVec::Item` - //~| missing generics for associated type `SVec::Item` - //~| missing generics for associated type `SVec::Item` - //~| missing generics for associated type `SVec::Item` - //~| missing generics for associated type `SVec::Item` -> { - type Item<'a, T>; - - fn len(&self) -> ::Item; - //~^ expected 1 lifetime argument - //~| missing generics for associated type `SVec::Item` - //~| expected 1 generic argument - //~| missing generics for associated type `SVec::Item` -} diff --git a/tests/rustdoc-ui/issues/issue-105742.stderr b/tests/rustdoc-ui/issues/issue-105742.stderr deleted file mode 100644 index 0f09d637f38..00000000000 --- a/tests/rustdoc-ui/issues/issue-105742.stderr +++ /dev/null @@ -1,638 +0,0 @@ -error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:15:21 - | -LL | ::Item, - | ^^^^ expected 1 lifetime argument - | -note: associated type defined here, with 1 lifetime parameter: `'a` - --> $DIR/issue-105742.rs:59:10 - | -LL | type Item<'a, T>; - | ^^^^ -- -help: add missing lifetime argument - | -LL | ::Item<'a>, - | ++++ - -error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:15:21 - | -LL | ::Item, - | ^^^^ expected 1 generic argument - | -note: associated type defined here, with 1 generic parameter: `T` - --> $DIR/issue-105742.rs:59:10 - | -LL | type Item<'a, T>; - | ^^^^ - -help: add missing generic argument - | -LL | ::Item, - | +++ - -error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:26:37 - | -LL | Output = ::Item, - | ^^^^ expected 1 lifetime argument - | -note: associated type defined here, with 1 lifetime parameter: `'a` - --> $DIR/issue-105742.rs:59:10 - | -LL | type Item<'a, T>; - | ^^^^ -- -help: add missing lifetime argument - | -LL | Output = ::Item<'a>, - | ++++ - -error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:26:37 - | -LL | Output = ::Item, - | ^^^^ expected 1 generic argument - | -note: associated type defined here, with 1 generic parameter: `T` - --> $DIR/issue-105742.rs:59:10 - | -LL | type Item<'a, T>; - | ^^^^ - -help: add missing generic argument - | -LL | Output = ::Item, - | +++ - -error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:37:30 - | -LL | Output = ::Item> as SVec>::Item, - | ^^^^ expected 1 lifetime argument - | -note: associated type defined here, with 1 lifetime parameter: `'a` - --> $DIR/issue-105742.rs:59:10 - | -LL | type Item<'a, T>; - | ^^^^ -- -help: add missing lifetime argument - | -LL | Output = ::Item<'a>> as SVec>::Item, - | ++++ - -error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:37:30 - | -LL | Output = ::Item> as SVec>::Item, - | ^^^^ expected 1 generic argument - | -note: associated type defined here, with 1 generic parameter: `T` - --> $DIR/issue-105742.rs:59:10 - | -LL | type Item<'a, T>; - | ^^^^ - -help: add missing generic argument - | -LL | Output = ::Item> as SVec>::Item, - | +++ - -error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:37:46 - | -LL | Output = ::Item> as SVec>::Item, - | ^^^^ expected 1 lifetime argument - | -note: associated type defined here, with 1 lifetime parameter: `'a` - --> $DIR/issue-105742.rs:59:10 - | -LL | type Item<'a, T>; - | ^^^^ -- -help: add missing lifetime argument - | -LL | Output = ::Item> as SVec>::Item<'a>, - | ++++ - -error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:37:46 - | -LL | Output = ::Item> as SVec>::Item, - | ^^^^ expected 1 generic argument - | -note: associated type defined here, with 1 generic parameter: `T` - --> $DIR/issue-105742.rs:59:10 - | -LL | type Item<'a, T>; - | ^^^^ - -help: add missing generic argument - | -LL | Output = ::Item> as SVec>::Item, - | +++ - -error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:4:40 - | -LL | pub fn next<'a, T>(s: &'a mut dyn SVec) { - | ^^^^ expected 1 lifetime argument - | -note: associated type defined here, with 1 lifetime parameter: `'a` - --> $DIR/issue-105742.rs:59:10 - | -LL | type Item<'a, T>; - | ^^^^ -- -help: add missing lifetime argument - | -LL | pub fn next<'a, T>(s: &'a mut dyn SVec = T, Output = T>) { - | ++++ - -error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:4:40 - | -LL | pub fn next<'a, T>(s: &'a mut dyn SVec) { - | ^^^^ expected 1 generic argument - | -note: associated type defined here, with 1 generic parameter: `T` - --> $DIR/issue-105742.rs:59:10 - | -LL | type Item<'a, T>; - | ^^^^ - -help: add missing generic argument - | -LL | pub fn next<'a, T>(s: &'a mut dyn SVec = T, Output = T>) { - | +++ - -error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:15:21 - | -LL | ::Item, - | ^^^^ expected 1 lifetime argument - | -note: associated type defined here, with 1 lifetime parameter: `'a` - --> $DIR/issue-105742.rs:59:10 - | -LL | type Item<'a, T>; - | ^^^^ -- - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -help: add missing lifetime argument - | -LL | ::Item<'a>, - | ++++ - -error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:15:21 - | -LL | ::Item, - | ^^^^ expected 1 generic argument - | -note: associated type defined here, with 1 generic parameter: `T` - --> $DIR/issue-105742.rs:59:10 - | -LL | type Item<'a, T>; - | ^^^^ - - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -help: add missing generic argument - | -LL | ::Item, - | +++ - -error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:26:37 - | -LL | Output = ::Item, - | ^^^^ expected 1 lifetime argument - | -note: associated type defined here, with 1 lifetime parameter: `'a` - --> $DIR/issue-105742.rs:59:10 - | -LL | type Item<'a, T>; - | ^^^^ -- - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -help: add missing lifetime argument - | -LL | Output = ::Item<'a>, - | ++++ - -error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:26:37 - | -LL | Output = ::Item, - | ^^^^ expected 1 generic argument - | -note: associated type defined here, with 1 generic parameter: `T` - --> $DIR/issue-105742.rs:59:10 - | -LL | type Item<'a, T>; - | ^^^^ - - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -help: add missing generic argument - | -LL | Output = ::Item, - | +++ - -error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:37:30 - | -LL | Output = ::Item> as SVec>::Item, - | ^^^^ expected 1 lifetime argument - | -note: associated type defined here, with 1 lifetime parameter: `'a` - --> $DIR/issue-105742.rs:59:10 - | -LL | type Item<'a, T>; - | ^^^^ -- - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -help: add missing lifetime argument - | -LL | Output = ::Item<'a>> as SVec>::Item, - | ++++ - -error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:37:30 - | -LL | Output = ::Item> as SVec>::Item, - | ^^^^ expected 1 generic argument - | -note: associated type defined here, with 1 generic parameter: `T` - --> $DIR/issue-105742.rs:59:10 - | -LL | type Item<'a, T>; - | ^^^^ - - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -help: add missing generic argument - | -LL | Output = ::Item> as SVec>::Item, - | +++ - -error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:37:46 - | -LL | Output = ::Item> as SVec>::Item, - | ^^^^ expected 1 lifetime argument - | -note: associated type defined here, with 1 lifetime parameter: `'a` - --> $DIR/issue-105742.rs:59:10 - | -LL | type Item<'a, T>; - | ^^^^ -- - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -help: add missing lifetime argument - | -LL | Output = ::Item> as SVec>::Item<'a>, - | ++++ - -error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:37:46 - | -LL | Output = ::Item> as SVec>::Item, - | ^^^^ expected 1 generic argument - | -note: associated type defined here, with 1 generic parameter: `T` - --> $DIR/issue-105742.rs:59:10 - | -LL | type Item<'a, T>; - | ^^^^ - - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -help: add missing generic argument - | -LL | Output = ::Item> as SVec>::Item, - | +++ - -error[E0038]: the trait `SVec` cannot be made into an object - --> $DIR/issue-105742.rs:4:31 - | -LL | pub fn next<'a, T>(s: &'a mut dyn SVec) { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `SVec` cannot be made into an object - | -note: for a trait to be "dyn-compatible" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit - --> $DIR/issue-105742.rs:14:17 - | -LL | pub trait SVec: Index< - | ____________----__^ - | | | - | | this trait cannot be made into an object... -LL | | ::Item, -LL | | -LL | | -... | -LL | |/ Output = ::Item, -LL | || -LL | || -LL | || -... || -LL | || -LL | || Output = ::Item> as SVec>::Item, - | ||_________________________________________________^ ...because it uses `Self` as a type parameter -... | -LL | | -LL | | > { - | |__^ ...because it uses `Self` as a type parameter -help: consider using an opaque type instead - | -LL | pub fn next<'a, T>(s: &'a mut impl SVec) { - | ~~~~ - -error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:15:21 - | -LL | ::Item, - | ^^^^ expected 1 lifetime argument - | -note: associated type defined here, with 1 lifetime parameter: `'a` - --> $DIR/issue-105742.rs:59:10 - | -LL | type Item<'a, T>; - | ^^^^ -- - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -help: add missing lifetime argument - | -LL | ::Item<'a>, - | ++++ - -error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:15:21 - | -LL | ::Item, - | ^^^^ expected 1 generic argument - | -note: associated type defined here, with 1 generic parameter: `T` - --> $DIR/issue-105742.rs:59:10 - | -LL | type Item<'a, T>; - | ^^^^ - - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -help: add missing generic argument - | -LL | ::Item, - | +++ - -error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:26:37 - | -LL | Output = ::Item, - | ^^^^ expected 1 lifetime argument - | -note: associated type defined here, with 1 lifetime parameter: `'a` - --> $DIR/issue-105742.rs:59:10 - | -LL | type Item<'a, T>; - | ^^^^ -- - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -help: add missing lifetime argument - | -LL | Output = ::Item<'a>, - | ++++ - -error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:26:37 - | -LL | Output = ::Item, - | ^^^^ expected 1 generic argument - | -note: associated type defined here, with 1 generic parameter: `T` - --> $DIR/issue-105742.rs:59:10 - | -LL | type Item<'a, T>; - | ^^^^ - - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -help: add missing generic argument - | -LL | Output = ::Item, - | +++ - -error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:37:30 - | -LL | Output = ::Item> as SVec>::Item, - | ^^^^ expected 1 lifetime argument - | -note: associated type defined here, with 1 lifetime parameter: `'a` - --> $DIR/issue-105742.rs:59:10 - | -LL | type Item<'a, T>; - | ^^^^ -- - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -help: add missing lifetime argument - | -LL | Output = ::Item<'a>> as SVec>::Item, - | ++++ - -error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:37:30 - | -LL | Output = ::Item> as SVec>::Item, - | ^^^^ expected 1 generic argument - | -note: associated type defined here, with 1 generic parameter: `T` - --> $DIR/issue-105742.rs:59:10 - | -LL | type Item<'a, T>; - | ^^^^ - - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -help: add missing generic argument - | -LL | Output = ::Item> as SVec>::Item, - | +++ - -error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:37:46 - | -LL | Output = ::Item> as SVec>::Item, - | ^^^^ expected 1 lifetime argument - | -note: associated type defined here, with 1 lifetime parameter: `'a` - --> $DIR/issue-105742.rs:59:10 - | -LL | type Item<'a, T>; - | ^^^^ -- - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -help: add missing lifetime argument - | -LL | Output = ::Item> as SVec>::Item<'a>, - | ++++ - -error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:37:46 - | -LL | Output = ::Item> as SVec>::Item, - | ^^^^ expected 1 generic argument - | -note: associated type defined here, with 1 generic parameter: `T` - --> $DIR/issue-105742.rs:59:10 - | -LL | type Item<'a, T>; - | ^^^^ - - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -help: add missing generic argument - | -LL | Output = ::Item> as SVec>::Item, - | +++ - -error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:15:21 - | -LL | ::Item, - | ^^^^ expected 1 lifetime argument - | -note: associated type defined here, with 1 lifetime parameter: `'a` - --> $DIR/issue-105742.rs:59:10 - | -LL | type Item<'a, T>; - | ^^^^ -- - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -help: add missing lifetime argument - | -LL | ::Item<'a>, - | ++++ - -error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:15:21 - | -LL | ::Item, - | ^^^^ expected 1 generic argument - | -note: associated type defined here, with 1 generic parameter: `T` - --> $DIR/issue-105742.rs:59:10 - | -LL | type Item<'a, T>; - | ^^^^ - - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -help: add missing generic argument - | -LL | ::Item, - | +++ - -error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:26:37 - | -LL | Output = ::Item, - | ^^^^ expected 1 lifetime argument - | -note: associated type defined here, with 1 lifetime parameter: `'a` - --> $DIR/issue-105742.rs:59:10 - | -LL | type Item<'a, T>; - | ^^^^ -- - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -help: add missing lifetime argument - | -LL | Output = ::Item<'a>, - | ++++ - -error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:26:37 - | -LL | Output = ::Item, - | ^^^^ expected 1 generic argument - | -note: associated type defined here, with 1 generic parameter: `T` - --> $DIR/issue-105742.rs:59:10 - | -LL | type Item<'a, T>; - | ^^^^ - - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -help: add missing generic argument - | -LL | Output = ::Item, - | +++ - -error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:37:30 - | -LL | Output = ::Item> as SVec>::Item, - | ^^^^ expected 1 lifetime argument - | -note: associated type defined here, with 1 lifetime parameter: `'a` - --> $DIR/issue-105742.rs:59:10 - | -LL | type Item<'a, T>; - | ^^^^ -- - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -help: add missing lifetime argument - | -LL | Output = ::Item<'a>> as SVec>::Item, - | ++++ - -error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:37:30 - | -LL | Output = ::Item> as SVec>::Item, - | ^^^^ expected 1 generic argument - | -note: associated type defined here, with 1 generic parameter: `T` - --> $DIR/issue-105742.rs:59:10 - | -LL | type Item<'a, T>; - | ^^^^ - - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -help: add missing generic argument - | -LL | Output = ::Item> as SVec>::Item, - | +++ - -error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:37:46 - | -LL | Output = ::Item> as SVec>::Item, - | ^^^^ expected 1 lifetime argument - | -note: associated type defined here, with 1 lifetime parameter: `'a` - --> $DIR/issue-105742.rs:59:10 - | -LL | type Item<'a, T>; - | ^^^^ -- - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -help: add missing lifetime argument - | -LL | Output = ::Item> as SVec>::Item<'a>, - | ++++ - -error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:37:46 - | -LL | Output = ::Item> as SVec>::Item, - | ^^^^ expected 1 generic argument - | -note: associated type defined here, with 1 generic parameter: `T` - --> $DIR/issue-105742.rs:59:10 - | -LL | type Item<'a, T>; - | ^^^^ - - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -help: add missing generic argument - | -LL | Output = ::Item> as SVec>::Item, - | +++ - -error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:61:38 - | -LL | fn len(&self) -> ::Item; - | ^^^^ expected 1 lifetime argument - | -note: associated type defined here, with 1 lifetime parameter: `'a` - --> $DIR/issue-105742.rs:59:10 - | -LL | type Item<'a, T>; - | ^^^^ -- -help: add missing lifetime argument - | -LL | fn len(&self) -> ::Item<'_>; - | ++++ - -error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:61:38 - | -LL | fn len(&self) -> ::Item; - | ^^^^ expected 1 generic argument - | -note: associated type defined here, with 1 generic parameter: `T` - --> $DIR/issue-105742.rs:59:10 - | -LL | type Item<'a, T>; - | ^^^^ - -help: add missing generic argument - | -LL | fn len(&self) -> ::Item; - | +++ - -error: aborting due to 37 previous errors - -Some errors have detailed explanations: E0038, E0107. -For more information about an error, try `rustc --explain E0038`. diff --git a/tests/rustdoc-ui/issues/issue-106213.rs b/tests/rustdoc-ui/issues/issue-106213.rs deleted file mode 100644 index c954162589d..00000000000 --- a/tests/rustdoc-ui/issues/issue-106213.rs +++ /dev/null @@ -1,8 +0,0 @@ -//@ compile-flags: --document-private-items -//@ edition:2021 -// https://github.com/rust-lang/rust/issues/106213 - -fn use_avx() -> dyn { - //~^ ERROR at least one trait is required for an object type - !( ident_error ) -} diff --git a/tests/rustdoc-ui/issues/issue-106213.stderr b/tests/rustdoc-ui/issues/issue-106213.stderr deleted file mode 100644 index fa79fe2e71c..00000000000 --- a/tests/rustdoc-ui/issues/issue-106213.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0224]: at least one trait is required for an object type - --> $DIR/issue-106213.rs:4:17 - | -LL | fn use_avx() -> dyn { - | ^^^ - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0224`. diff --git a/tests/rustdoc-ui/issues/issue-106226.rs b/tests/rustdoc-ui/issues/issue-106226.rs deleted file mode 100644 index 71b497a9adc..00000000000 --- a/tests/rustdoc-ui/issues/issue-106226.rs +++ /dev/null @@ -1,3 +0,0 @@ -// This is a regression test for . -type F = [_; ()]; -//~^ ERROR diff --git a/tests/rustdoc-ui/issues/issue-106226.stderr b/tests/rustdoc-ui/issues/issue-106226.stderr deleted file mode 100644 index 4d063b46188..00000000000 --- a/tests/rustdoc-ui/issues/issue-106226.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0121]: the placeholder `_` is not allowed within types on item signatures for type aliases - --> $DIR/issue-106226.rs:2:11 - | -LL | type F = [_; ()]; - | ^ not allowed in type signatures - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0121`. diff --git a/tests/rustdoc-ui/issues/issue-107918.rs b/tests/rustdoc-ui/issues/issue-107918.rs deleted file mode 100644 index ec35b52e33b..00000000000 --- a/tests/rustdoc-ui/issues/issue-107918.rs +++ /dev/null @@ -1,13 +0,0 @@ -//@ aux-build:panic-handler.rs -//@ compile-flags: --document-private-items -//@ build-pass -//@ only-linux -// https://github.com/rust-lang/rust/issues/107918 - -#![no_std] -#![no_main] - -#[panic_handler] -fn panic(_: &core::panic::PanicInfo) -> ! { - loop {} -} diff --git a/tests/rustdoc-ui/issues/issue-110900.rs b/tests/rustdoc-ui/issues/issue-110900.rs deleted file mode 100644 index 4fa60f8878d..00000000000 --- a/tests/rustdoc-ui/issues/issue-110900.rs +++ /dev/null @@ -1,28 +0,0 @@ -//@ check-pass -// https://github.com/rust-lang/rust/issues/110900 - -#![crate_type="lib"] - -trait A<'a> {} -trait B<'b> {} - -trait C<'c>: for<'a> A<'a> + for<'b> B<'b> { - type As; -} - -trait E<'e> { - type As; -} -trait F<'f>: for<'a> A<'a> + for<'e> E<'e> {} -struct G -where - T: for<'l, 'i> H<'l, 'i, As: for<'a> A<'a> + 'i> -{ - t: std::marker::PhantomData, -} - -trait I<'a, 'b, 'c> { - type As; -} - -trait H<'d, 'e>: for<'f> I<'d, 'f, 'e> + 'd {} -- cgit 1.4.1-3-g733a5 From 15d7331a013ef4b5519d51bc323bbf7b54746d63 Mon Sep 17 00:00:00 2001 From: clubby789 Date: Tue, 3 Dec 2024 20:21:19 +0000 Subject: bootstrap: `print{,ln}!` -> `eprint{,ln}!` --- src/bootstrap/src/bin/main.rs | 20 ++++----- src/bootstrap/src/bin/rustc.rs | 2 +- src/bootstrap/src/core/build_steps/check.rs | 2 +- src/bootstrap/src/core/build_steps/compile.rs | 10 ++--- src/bootstrap/src/core/build_steps/dist.rs | 2 +- src/bootstrap/src/core/build_steps/format.rs | 6 +-- src/bootstrap/src/core/build_steps/setup.rs | 46 ++++++++++---------- src/bootstrap/src/core/build_steps/suggest.rs | 2 +- src/bootstrap/src/core/build_steps/test.rs | 6 +-- src/bootstrap/src/core/builder/cargo.rs | 2 +- src/bootstrap/src/core/builder/mod.rs | 14 ++++--- src/bootstrap/src/core/config/config.rs | 60 +++++++++++++-------------- src/bootstrap/src/core/config/flags.rs | 4 +- src/bootstrap/src/core/download.rs | 26 ++++++------ src/bootstrap/src/core/sanity.rs | 4 +- src/bootstrap/src/lib.rs | 28 ++++++------- src/bootstrap/src/utils/cc_detect.rs | 10 ++--- src/bootstrap/src/utils/helpers.rs | 6 +-- src/bootstrap/src/utils/metrics.rs | 2 +- src/bootstrap/src/utils/render_tests.rs | 50 +++++++++++----------- src/bootstrap/src/utils/tarball.rs | 2 +- 21 files changed, 154 insertions(+), 150 deletions(-) diff --git a/src/bootstrap/src/bin/main.rs b/src/bootstrap/src/bin/main.rs index ee813de1c9e..74dfe2e7ec8 100644 --- a/src/bootstrap/src/bin/main.rs +++ b/src/bootstrap/src/bin/main.rs @@ -48,9 +48,9 @@ fn main() { err => { drop(err); if let Ok(pid) = pid { - println!("WARNING: build directory locked by process {pid}, waiting for lock"); + eprintln!("WARNING: build directory locked by process {pid}, waiting for lock"); } else { - println!("WARNING: build directory locked, waiting for lock"); + eprintln!("WARNING: build directory locked, waiting for lock"); } let mut lock = t!(build_lock.write()); t!(lock.write(process::id().to_string().as_ref())); @@ -70,13 +70,13 @@ fn main() { // changelog warning, not the `x.py setup` message. let suggest_setup = config.config.is_none() && !matches!(config.cmd, Subcommand::Setup { .. }); if suggest_setup { - println!("WARNING: you have not made a `config.toml`"); - println!( + eprintln!("WARNING: you have not made a `config.toml`"); + eprintln!( "HELP: consider running `./x.py setup` or copying `config.example.toml` by running \ `cp config.example.toml config.toml`" ); } else if let Some(suggestion) = &changelog_suggestion { - println!("{suggestion}"); + eprintln!("{suggestion}"); } let pre_commit = config.src.join(".git").join("hooks").join("pre-commit"); @@ -86,13 +86,13 @@ fn main() { Build::new(config).build(); if suggest_setup { - println!("WARNING: you have not made a `config.toml`"); - println!( + eprintln!("WARNING: you have not made a `config.toml`"); + eprintln!( "HELP: consider running `./x.py setup` or copying `config.example.toml` by running \ `cp config.example.toml config.toml`" ); } else if let Some(suggestion) = &changelog_suggestion { - println!("{suggestion}"); + eprintln!("{suggestion}"); } // Give a warning if the pre-commit script is in pre-commit and not pre-push. @@ -102,14 +102,14 @@ fn main() { if fs::read_to_string(pre_commit).is_ok_and(|contents| { contents.contains("https://github.com/rust-lang/rust/issues/77620#issuecomment-705144570") }) { - println!( + eprintln!( "WARNING: You have the pre-push script installed to .git/hooks/pre-commit. \ Consider moving it to .git/hooks/pre-push instead, which runs less often." ); } if suggest_setup || changelog_suggestion.is_some() { - println!("NOTE: this message was printed twice to make it more likely to be seen"); + eprintln!("NOTE: this message was printed twice to make it more likely to be seen"); } if dump_bootstrap_shims { diff --git a/src/bootstrap/src/bin/rustc.rs b/src/bootstrap/src/bin/rustc.rs index 88595ff7e51..e57ed488f97 100644 --- a/src/bootstrap/src/bin/rustc.rs +++ b/src/bootstrap/src/bin/rustc.rs @@ -306,7 +306,7 @@ fn main() { // should run on success, after this block. } if verbose > 0 { - println!("\nDid not run successfully: {status}\n{cmd:?}\n-------------"); + eprintln!("\nDid not run successfully: {status}\n{cmd:?}\n-------------"); } if let Some(mut on_fail) = on_fail { diff --git a/src/bootstrap/src/core/build_steps/check.rs b/src/bootstrap/src/core/build_steps/check.rs index d46c0ab7fef..2af2e83db8f 100644 --- a/src/bootstrap/src/core/build_steps/check.rs +++ b/src/bootstrap/src/core/build_steps/check.rs @@ -287,7 +287,7 @@ impl Step for CodegenBackend { fn run(self, builder: &Builder<'_>) { // FIXME: remove once https://github.com/rust-lang/rust/issues/112393 is resolved if builder.build.config.vendor && self.backend == "gcc" { - println!("Skipping checking of `rustc_codegen_gcc` with vendoring enabled."); + eprintln!("Skipping checking of `rustc_codegen_gcc` with vendoring enabled."); return; } diff --git a/src/bootstrap/src/core/build_steps/compile.rs b/src/bootstrap/src/core/build_steps/compile.rs index 0cacd6e4f37..4419b11ac19 100644 --- a/src/bootstrap/src/core/build_steps/compile.rs +++ b/src/bootstrap/src/core/build_steps/compile.rs @@ -1611,7 +1611,7 @@ impl Step for Sysroot { let sysroot = sysroot_dir(compiler.stage); builder - .verbose(|| println!("Removing sysroot {} to avoid caching bugs", sysroot.display())); + .verbose(|| eprintln!("Removing sysroot {} to avoid caching bugs", sysroot.display())); let _ = fs::remove_dir_all(&sysroot); t!(fs::create_dir_all(&sysroot)); @@ -1681,7 +1681,7 @@ impl Step for Sysroot { return true; } if !filtered_files.iter().all(|f| f != path.file_name().unwrap()) { - builder.verbose_than(1, || println!("ignoring {}", path.display())); + builder.verbose_than(1, || eprintln!("ignoring {}", path.display())); false } else { true @@ -2240,7 +2240,7 @@ pub fn stream_cargo( cargo.arg(arg); } - builder.verbose(|| println!("running: {cargo:?}")); + builder.verbose(|| eprintln!("running: {cargo:?}")); if builder.config.dry_run() { return true; @@ -2261,12 +2261,12 @@ pub fn stream_cargo( Ok(msg) => { if builder.config.json_output { // Forward JSON to stdout. - println!("{line}"); + eprintln!("{line}"); } cb(msg) } // If this was informational, just print it out and continue - Err(_) => println!("{line}"), + Err(_) => eprintln!("{line}"), } } diff --git a/src/bootstrap/src/core/build_steps/dist.rs b/src/bootstrap/src/core/build_steps/dist.rs index 0c739115165..57fce206f95 100644 --- a/src/bootstrap/src/core/build_steps/dist.rs +++ b/src/bootstrap/src/core/build_steps/dist.rs @@ -2080,7 +2080,7 @@ fn maybe_install_llvm( { let mut cmd = command(llvm_config); cmd.arg("--libfiles"); - builder.verbose(|| println!("running {cmd:?}")); + builder.verbose(|| eprintln!("running {cmd:?}")); let files = cmd.run_capture_stdout(builder).stdout(); let build_llvm_out = &builder.llvm_out(builder.config.build); let target_llvm_out = &builder.llvm_out(target); diff --git a/src/bootstrap/src/core/build_steps/format.rs b/src/bootstrap/src/core/build_steps/format.rs index 29a96f77672..d32e06d8748 100644 --- a/src/bootstrap/src/core/build_steps/format.rs +++ b/src/bootstrap/src/core/build_steps/format.rs @@ -107,10 +107,10 @@ fn print_paths(verb: &str, adjective: Option<&str>, paths: &[String]) { if let Some(adjective) = adjective { format!("{adjective} ") } else { String::new() }; if len <= 10 { for path in paths { - println!("fmt: {verb} {adjective}file {path}"); + eprintln!("fmt: {verb} {adjective}file {path}"); } } else { - println!("fmt: {verb} {len} {adjective}files"); + eprintln!("fmt: {verb} {len} {adjective}files"); } } @@ -199,7 +199,7 @@ pub fn format(build: &Builder<'_>, check: bool, all: bool, paths: &[PathBuf]) { match get_modified_rs_files(build) { Ok(Some(files)) => { if files.is_empty() { - println!("fmt info: No modified files detected for formatting."); + eprintln!("fmt info: No modified files detected for formatting."); return; } diff --git a/src/bootstrap/src/core/build_steps/setup.rs b/src/bootstrap/src/core/build_steps/setup.rs index 7ed01f25c94..175e9982cc1 100644 --- a/src/bootstrap/src/core/build_steps/setup.rs +++ b/src/bootstrap/src/core/build_steps/setup.rs @@ -134,7 +134,7 @@ impl Step for Profile { t!(fs::remove_file(path)); } _ => { - println!("Exiting."); + eprintln!("Exiting."); crate::exit!(1); } } @@ -184,15 +184,15 @@ pub fn setup(config: &Config, profile: Profile) { Profile::Dist => &["dist", "build"], }; - println!(); + eprintln!(); - println!("To get started, try one of the following commands:"); + eprintln!("To get started, try one of the following commands:"); for cmd in suggestions { - println!("- `x.py {cmd}`"); + eprintln!("- `x.py {cmd}`"); } if profile != Profile::Dist { - println!( + eprintln!( "For more suggestions, see https://rustc-dev-guide.rust-lang.org/building/suggested.html" ); } @@ -224,7 +224,7 @@ fn setup_config_toml(path: &PathBuf, profile: Profile, config: &Config) { t!(fs::write(path, settings)); let include_path = profile.include_path(&config.src); - println!("`x.py` will now use the configuration at {}", include_path.display()); + eprintln!("`x.py` will now use the configuration at {}", include_path.display()); } /// Creates a toolchain link for stage1 using `rustup` @@ -256,7 +256,7 @@ impl Step for Link { } if !rustup_installed(builder) { - println!("WARNING: `rustup` is not installed; Skipping `stage1` toolchain linking."); + eprintln!("WARNING: `rustup` is not installed; Skipping `stage1` toolchain linking."); return; } @@ -296,7 +296,7 @@ fn attempt_toolchain_link(builder: &Builder<'_>, stage_path: &str) { } if try_link_toolchain(builder, stage_path) { - println!( + eprintln!( "Added `stage1` rustup toolchain; try `cargo +stage1 build` on a separate rust project to run a newly-built toolchain" ); } else { @@ -321,14 +321,14 @@ fn toolchain_is_linked(builder: &Builder<'_>) -> bool { return false; } // The toolchain has already been linked. - println!( + eprintln!( "`stage1` toolchain already linked; not attempting to link `stage1` toolchain" ); } None => { // In this case, we don't know if the `stage1` toolchain has been linked; // but `rustup` failed, so let's not go any further. - println!( + eprintln!( "`rustup` failed to list current toolchains; not attempting to link `stage1` toolchain" ); } @@ -389,12 +389,12 @@ pub fn interactive_path() -> io::Result { input.parse() } - println!("Welcome to the Rust project! What do you want to do with x.py?"); + eprintln!("Welcome to the Rust project! What do you want to do with x.py?"); for ((letter, _), profile) in abbrev_all() { - println!("{}) {}: {}", letter, profile, profile.purpose()); + eprintln!("{}) {}: {}", letter, profile, profile.purpose()); } let template = loop { - print!( + eprint!( "Please choose one ({}): ", abbrev_all().map(|((l, _), _)| l).collect::>().join("/") ); @@ -428,7 +428,7 @@ enum PromptResult { fn prompt_user(prompt: &str) -> io::Result> { let mut input = String::new(); loop { - print!("{prompt} "); + eprint!("{prompt} "); io::stdout().flush()?; input.clear(); io::stdin().read_line(&mut input)?; @@ -490,7 +490,7 @@ fn install_git_hook_maybe(builder: &Builder<'_>, config: &Config) -> io::Result< return Ok(()); } - println!( + eprintln!( "\nRust's CI will automatically fail if it doesn't pass `tidy`, the internal tool for ensuring code quality. If you'd like, x.py can install a git hook for you that will automatically run `test tidy` before pushing your code to ensure your code is up to par. If you decide later that this behavior is @@ -498,7 +498,7 @@ undesirable, simply delete the `pre-push` file from .git/hooks." ); if prompt_user("Would you like to install the git hook?: [y/N]")? != Some(PromptResult::Yes) { - println!("Ok, skipping installation!"); + eprintln!("Ok, skipping installation!"); return Ok(()); } if !hooks_dir.exists() { @@ -515,7 +515,7 @@ undesirable, simply delete the `pre-push` file from .git/hooks." ); return Err(e); } - Ok(_) => println!("Linked `src/etc/pre-push.sh` to `.git/hooks/pre-push`"), + Ok(_) => eprintln!("Linked `src/etc/pre-push.sh` to `.git/hooks/pre-push`"), }; Ok(()) } @@ -541,7 +541,7 @@ Select which editor you would like to set up [default: None]: "; let mut input = String::new(); loop { - print!("{}", prompt_str); + eprint!("{}", prompt_str); io::stdout().flush()?; input.clear(); io::stdin().read_line(&mut input)?; @@ -656,7 +656,7 @@ impl Step for Editor { if let Some(editor_kind) = editor_kind { while !t!(create_editor_settings_maybe(config, editor_kind.clone())) {} } else { - println!("Ok, skipping editor setup!"); + eprintln!("Ok, skipping editor setup!"); } } Err(e) => eprintln!("Could not determine the editor: {e}"), @@ -689,7 +689,7 @@ fn create_editor_settings_maybe(config: &Config, editor: EditorKind) -> io::Resu mismatched_settings = Some(false); } } - println!( + eprintln!( "\nx.py can automatically install the recommended `{settings_filename}` file for rustc development" ); @@ -708,7 +708,7 @@ fn create_editor_settings_maybe(config: &Config, editor: EditorKind) -> io::Resu Some(PromptResult::Yes) => true, Some(PromptResult::Print) => false, _ => { - println!("Ok, skipping settings!"); + eprintln!("Ok, skipping settings!"); return Ok(true); } }; @@ -735,9 +735,9 @@ fn create_editor_settings_maybe(config: &Config, editor: EditorKind) -> io::Resu _ => "Created", }; fs::write(&settings_path, editor.settings_template())?; - println!("{verb} `{}`", settings_filename); + eprintln!("{verb} `{}`", settings_filename); } else { - println!("\n{}", editor.settings_template()); + eprintln!("\n{}", editor.settings_template()); } Ok(should_create) } diff --git a/src/bootstrap/src/core/build_steps/suggest.rs b/src/bootstrap/src/core/build_steps/suggest.rs index ba9b1b2fc33..7b2d9fff8f5 100644 --- a/src/bootstrap/src/core/build_steps/suggest.rs +++ b/src/bootstrap/src/core/build_steps/suggest.rs @@ -66,6 +66,6 @@ pub fn suggest(builder: &Builder<'_>, run: bool) { build.build(); } } else { - println!("HELP: consider using the `--run` flag to automatically run suggested tests"); + eprintln!("HELP: consider using the `--run` flag to automatically run suggested tests"); } } diff --git a/src/bootstrap/src/core/build_steps/test.rs b/src/bootstrap/src/core/build_steps/test.rs index 30fdea7e19e..380626952b2 100644 --- a/src/bootstrap/src/core/build_steps/test.rs +++ b/src/bootstrap/src/core/build_steps/test.rs @@ -471,11 +471,11 @@ impl Miri { // We re-use the `cargo` from above. cargo.arg("--print-sysroot"); - builder.verbose(|| println!("running: {cargo:?}")); + builder.verbose(|| eprintln!("running: {cargo:?}")); let stdout = cargo.run_capture_stdout(builder).stdout(); // Output is "\n". let sysroot = stdout.trim_end(); - builder.verbose(|| println!("`cargo miri setup --print-sysroot` said: {sysroot:?}")); + builder.verbose(|| eprintln!("`cargo miri setup --print-sysroot` said: {sysroot:?}")); PathBuf::from(sysroot) } } @@ -2488,7 +2488,7 @@ fn markdown_test(builder: &Builder<'_>, compiler: Compiler, markdown: &Path) -> } } - builder.verbose(|| println!("doc tests for: {}", markdown.display())); + builder.verbose(|| eprintln!("doc tests for: {}", markdown.display())); let mut cmd = builder.rustdoc_cmd(compiler); builder.add_rust_test_threads(&mut cmd); // allow for unstable options such as new editions diff --git a/src/bootstrap/src/core/builder/cargo.rs b/src/bootstrap/src/core/builder/cargo.rs index 77f6edaabb2..38abca8b8da 100644 --- a/src/bootstrap/src/core/builder/cargo.rs +++ b/src/bootstrap/src/core/builder/cargo.rs @@ -523,7 +523,7 @@ impl Builder<'_> { let sysroot_str = sysroot.as_os_str().to_str().expect("sysroot should be UTF-8"); if self.is_verbose() && !matches!(self.config.dry_run, DryRun::SelfCheck) { - println!("using sysroot {sysroot_str}"); + eprintln!("using sysroot {sysroot_str}"); } let mut rustflags = Rustflags::new(target); diff --git a/src/bootstrap/src/core/builder/mod.rs b/src/bootstrap/src/core/builder/mod.rs index 026c26479d3..ffe3e053e72 100644 --- a/src/bootstrap/src/core/builder/mod.rs +++ b/src/bootstrap/src/core/builder/mod.rs @@ -392,14 +392,14 @@ impl StepDescription { fn is_excluded(&self, builder: &Builder<'_>, pathset: &PathSet) -> bool { if builder.config.skip.iter().any(|e| pathset.has(e, builder.kind)) { if !matches!(builder.config.dry_run, DryRun::SelfCheck) { - println!("Skipping {pathset:?} because it is excluded"); + eprintln!("Skipping {pathset:?} because it is excluded"); } return true; } if !builder.config.skip.is_empty() && !matches!(builder.config.dry_run, DryRun::SelfCheck) { builder.verbose(|| { - println!( + eprintln!( "{:?} not skipped for {:?} -- not in {:?}", pathset, self.name, builder.config.skip ) @@ -1437,11 +1437,11 @@ impl<'a> Builder<'a> { panic!("{}", out); } if let Some(out) = self.cache.get(&step) { - self.verbose_than(1, || println!("{}c {:?}", " ".repeat(stack.len()), step)); + self.verbose_than(1, || eprintln!("{}c {:?}", " ".repeat(stack.len()), step)); return out; } - self.verbose_than(1, || println!("{}> {:?}", " ".repeat(stack.len()), step)); + self.verbose_than(1, || eprintln!("{}> {:?}", " ".repeat(stack.len()), step)); stack.push(Box::new(step.clone())); } @@ -1462,7 +1462,7 @@ impl<'a> Builder<'a> { let step_string = format!("{step:?}"); let brace_index = step_string.find('{').unwrap_or(0); let type_string = type_name::(); - println!( + eprintln!( "[TIMING] {} {} -- {}.{:03}", &type_string.strip_prefix("bootstrap::").unwrap_or(type_string), &step_string[brace_index..], @@ -1479,7 +1479,9 @@ impl<'a> Builder<'a> { let cur_step = stack.pop().expect("step stack empty"); assert_eq!(cur_step.downcast_ref(), Some(&step)); } - self.verbose_than(1, || println!("{}< {:?}", " ".repeat(self.stack.borrow().len()), step)); + self.verbose_than(1, || { + eprintln!("{}< {:?}", " ".repeat(self.stack.borrow().len()), step) + }); self.cache.put(step, out.clone()); out } diff --git a/src/bootstrap/src/core/config/config.rs b/src/bootstrap/src/core/config/config.rs index b06147055f2..aa5cce2fb1b 100644 --- a/src/bootstrap/src/core/config/config.rs +++ b/src/bootstrap/src/core/config/config.rs @@ -1293,7 +1293,7 @@ impl Config { .map(|change_id| change_id.inner.map(crate::find_recent_config_change_ids)) { if !changes.is_empty() { - println!( + eprintln!( "WARNING: There have been changes to x.py since you last updated:\n{}", crate::human_readable_changes(&changes) ); @@ -1559,7 +1559,7 @@ impl Config { } if cargo_clippy.is_some() && rustc.is_none() { - println!( + eprintln!( "WARNING: Using `build.cargo-clippy` without `build.rustc` usually fails due to toolchain conflict." ); } @@ -1841,7 +1841,7 @@ impl Config { // FIXME: Remove this option at the end of 2024. if parallel_compiler.is_some() { - println!( + eprintln!( "WARNING: The `rust.parallel-compiler` option is deprecated and does nothing. The parallel compiler (with one thread) is now the default" ); } @@ -1873,7 +1873,7 @@ impl Config { if available_backends.contains(&backend) { panic!("Invalid value '{s}' for 'rust.codegen-backends'. Instead, please use '{backend}'."); } else { - println!("HELP: '{s}' for 'rust.codegen-backends' might fail. \ + eprintln!("HELP: '{s}' for 'rust.codegen-backends' might fail. \ Codegen backends are mostly defined without the '{CODEGEN_BACKEND_PREFIX}' prefix. \ In this case, it would be referred to as '{backend}'."); } @@ -1902,7 +1902,7 @@ impl Config { // tests may fail due to using a different channel than the one used by the compiler during tests. if let Some(commit) = &config.download_rustc_commit { if is_user_configured_rust_channel { - println!( + eprintln!( "WARNING: `rust.download-rustc` is enabled. The `rust.channel` option will be overridden by the CI rustc's channel." ); @@ -1992,10 +1992,10 @@ impl Config { if config.llvm_from_ci { let warn = |option: &str| { - println!( + eprintln!( "WARNING: `{option}` will only be used on `compiler/rustc_llvm` build, not for the LLVM build." ); - println!( + eprintln!( "HELP: To use `{option}` for LLVM builds, set `download-ci-llvm` option to false." ); }; @@ -2014,12 +2014,12 @@ impl Config { // if they've chosen a different value. if libzstd.is_some() { - println!( + eprintln!( "WARNING: when using `download-ci-llvm`, the local `llvm.libzstd` option, \ like almost all `llvm.*` options, will be ignored and set by the LLVM CI \ artifacts builder config." ); - println!( + eprintln!( "HELP: To use `llvm.libzstd` for LLVM/LLD builds, set `download-ci-llvm` option to false." ); } @@ -2088,7 +2088,7 @@ impl Config { if available_backends.contains(&backend) { panic!("Invalid value '{s}' for 'target.{triple}.codegen-backends'. Instead, please use '{backend}'."); } else { - println!("HELP: '{s}' for 'target.{triple}.codegen-backends' might fail. \ + eprintln!("HELP: '{s}' for 'target.{triple}.codegen-backends' might fail. \ Codegen backends are mostly defined without the '{CODEGEN_BACKEND_PREFIX}' prefix. \ In this case, it would be referred to as '{backend}'."); } @@ -2304,7 +2304,7 @@ impl Config { if self.dry_run() { return Ok(()); } - self.verbose(|| println!("running: {cmd:?}")); + self.verbose(|| eprintln!("running: {cmd:?}")); build_helper::util::try_run(cmd, self.is_verbose()) } @@ -2479,7 +2479,7 @@ impl Config { // This happens when LLVM submodule is updated in CI, we should disable ci-rustc without an error // to not break CI. For non-CI environments, we should return an error. if CiEnv::is_ci() { - println!("WARNING: LLVM submodule has changes, `download-rustc` will be disabled."); + eprintln!("WARNING: LLVM submodule has changes, `download-rustc` will be disabled."); return None; } else { panic!("ERROR: LLVM submodule has changes, `download-rustc` can't be used."); @@ -2490,8 +2490,8 @@ impl Config { let ci_config_toml = match self.get_builder_toml("ci-rustc") { Ok(ci_config_toml) => ci_config_toml, Err(e) if e.to_string().contains("unknown field") => { - println!("WARNING: CI rustc has some fields that are no longer supported in bootstrap; download-rustc will be disabled."); - println!("HELP: Consider rebasing to a newer commit if available."); + eprintln!("WARNING: CI rustc has some fields that are no longer supported in bootstrap; download-rustc will be disabled."); + eprintln!("HELP: Consider rebasing to a newer commit if available."); return None; }, Err(e) => { @@ -2516,7 +2516,7 @@ impl Config { .is_some_and(|s| s == "1" || s == "true"); if disable_ci_rustc_if_incompatible && res.is_err() { - println!("WARNING: download-rustc is disabled with `DISABLE_CI_RUSTC_IF_INCOMPATIBLE` env."); + eprintln!("WARNING: download-rustc is disabled with `DISABLE_CI_RUSTC_IF_INCOMPATIBLE` env."); return None; } @@ -2701,7 +2701,7 @@ impl Config { return; } - println!("Updating submodule {relative_path}"); + eprintln!("Updating submodule {relative_path}"); self.check_run( helpers::git(Some(&self.src)) .run_always() @@ -2824,7 +2824,7 @@ impl Config { Some(StringOrBool::Bool(true)) => false, Some(StringOrBool::String(s)) if s == "if-unchanged" => { if !self.rust_info.is_managed_git_subrepository() { - println!( + eprintln!( "ERROR: `download-rustc=if-unchanged` is only compatible with Git managed sources." ); crate::exit!(1); @@ -2857,10 +2857,10 @@ impl Config { if if_unchanged { return None; } - println!("ERROR: could not find commit hash for downloading rustc"); - println!("HELP: maybe your repository history is too shallow?"); - println!("HELP: consider setting `rust.download-rustc=false` in config.toml"); - println!("HELP: or fetch enough history to include one upstream commit"); + eprintln!("ERROR: could not find commit hash for downloading rustc"); + eprintln!("HELP: maybe your repository history is too shallow?"); + eprintln!("HELP: consider setting `rust.download-rustc=false` in config.toml"); + eprintln!("HELP: or fetch enough history to include one upstream commit"); crate::exit!(1); } }; @@ -2899,7 +2899,7 @@ impl Config { let if_unchanged = || { if self.rust_info.is_from_tarball() { // Git is needed for running "if-unchanged" logic. - println!( + eprintln!( "WARNING: 'if-unchanged' has no effect on tarball sources; ignoring `download-ci-llvm`." ); return false; @@ -2948,10 +2948,10 @@ impl Config { // Only commits merged by bors will have CI artifacts. let commit = get_closest_merge_commit(Some(&self.src), &self.git_config(), &[]).unwrap(); if commit.is_empty() { - println!("error: could not find commit hash for downloading components from CI"); - println!("help: maybe your repository history is too shallow?"); - println!("help: consider disabling `{option_name}`"); - println!("help: or fetch enough history to include one upstream commit"); + eprintln!("error: could not find commit hash for downloading components from CI"); + eprintln!("help: maybe your repository history is too shallow?"); + eprintln!("help: consider disabling `{option_name}`"); + eprintln!("help: or fetch enough history to include one upstream commit"); crate::exit!(1); } @@ -2963,14 +2963,14 @@ impl Config { if has_changes { if if_unchanged { if self.is_verbose() { - println!( + eprintln!( "warning: saw changes to one of {modified_paths:?} since {commit}; \ ignoring `{option_name}`" ); } return None; } - println!( + eprintln!( "warning: `{option_name}` is enabled, but there are changes to one of {modified_paths:?}" ); } @@ -3007,7 +3007,7 @@ pub(crate) fn check_incompatible_options_for_ci_llvm( ($current:expr, $expected:expr) => { if let Some(current) = &$current { if Some(current) != $expected.as_ref() { - println!( + eprintln!( "WARNING: `llvm.{}` has no effect with `llvm.download-ci-llvm`. \ Current value: {:?}, Expected value(s): {}{:?}", stringify!($expected).replace("_", "-"), @@ -3112,7 +3112,7 @@ fn check_incompatible_options_for_ci_rustc( ($current:expr, $expected:expr, $config_section:expr) => { if let Some(current) = &$current { if Some(current) != $expected.as_ref() { - println!( + eprintln!( "WARNING: `{}` has no effect with `rust.download-rustc`. \ Current value: {:?}, Expected value(s): {}{:?}", format!("{}.{}", $config_section, stringify!($expected).replace("_", "-")), diff --git a/src/bootstrap/src/core/config/flags.rs b/src/bootstrap/src/core/config/flags.rs index bfeb811508c..66b9f5ed84e 100644 --- a/src/bootstrap/src/core/config/flags.rs +++ b/src/bootstrap/src/core/config/flags.rs @@ -196,12 +196,12 @@ impl Flags { if let Ok(HelpVerboseOnly { help: true, verbose: 1.., cmd: subcommand }) = HelpVerboseOnly::try_parse_from(normalize_args(args)) { - println!("NOTE: updating submodules before printing available paths"); + eprintln!("NOTE: updating submodules before printing available paths"); let config = Config::parse(Self::parse(&[String::from("build")])); let build = Build::new(config); let paths = Builder::get_help(&build, subcommand); if let Some(s) = paths { - println!("{s}"); + eprintln!("{s}"); } else { panic!("No paths available for subcommand `{}`", subcommand.as_str()); } diff --git a/src/bootstrap/src/core/download.rs b/src/bootstrap/src/core/download.rs index db35e6907e6..05b91c518cf 100644 --- a/src/bootstrap/src/core/download.rs +++ b/src/bootstrap/src/core/download.rs @@ -77,7 +77,7 @@ impl Config { if self.dry_run() && !cmd.run_always { return true; } - self.verbose(|| println!("running: {cmd:?}")); + self.verbose(|| eprintln!("running: {cmd:?}")); check_run(cmd, self.is_verbose()) } @@ -144,7 +144,7 @@ impl Config { /// Please see for more information fn fix_bin_or_dylib(&self, fname: &Path) { assert_eq!(SHOULD_FIX_BINS_AND_DYLIBS.get(), Some(&true)); - println!("attempting to patch {}", fname.display()); + eprintln!("attempting to patch {}", fname.display()); // Only build `.nix-deps` once. static NIX_DEPS_DIR: OnceLock = OnceLock::new(); @@ -206,7 +206,7 @@ impl Config { } fn download_file(&self, url: &str, dest_path: &Path, help_on_error: &str) { - self.verbose(|| println!("download {url}")); + self.verbose(|| eprintln!("download {url}")); // Use a temporary file in case we crash while downloading, to avoid a corrupt download in cache/. let tempfile = self.tempdir().join(dest_path.file_name().unwrap()); // While bootstrap itself only supports http and https downloads, downstream forks might @@ -226,7 +226,7 @@ impl Config { } fn download_http_with_retries(&self, tempfile: &Path, url: &str, help_on_error: &str) { - println!("downloading {url}"); + eprintln!("downloading {url}"); // Try curl. If that fails and we are on windows, fallback to PowerShell. // options should be kept in sync with // src/bootstrap/src/core/download.rs @@ -341,7 +341,7 @@ impl Config { short_path = short_path.strip_prefix(pattern).unwrap_or(short_path); let dst_path = dst.join(short_path); self.verbose(|| { - println!("extracting {} to {}", original_path.display(), dst.display()) + eprintln!("extracting {} to {}", original_path.display(), dst.display()) }); if !t!(member.unpack_in(dst)) { panic!("path traversal attack ??"); @@ -365,7 +365,7 @@ impl Config { pub(crate) fn verify(&self, path: &Path, expected: &str) -> bool { use sha2::Digest; - self.verbose(|| println!("verifying {}", path.display())); + self.verbose(|| eprintln!("verifying {}", path.display())); if self.dry_run() { return false; @@ -391,7 +391,7 @@ impl Config { let verified = checksum == expected; if !verified { - println!( + eprintln!( "invalid checksum: \n\ found: {checksum}\n\ expected: {expected}", @@ -421,7 +421,7 @@ enum DownloadSource { /// Functions that are only ever called once, but named for clarify and to avoid thousand-line functions. impl Config { pub(crate) fn download_clippy(&self) -> PathBuf { - self.verbose(|| println!("downloading stage0 clippy artifacts")); + self.verbose(|| eprintln!("downloading stage0 clippy artifacts")); let date = &self.stage0_metadata.compiler.date; let version = &self.stage0_metadata.compiler.version; @@ -518,7 +518,7 @@ impl Config { } pub(crate) fn download_ci_rustc(&self, commit: &str) { - self.verbose(|| println!("using downloaded stage2 artifacts from CI (commit {commit})")); + self.verbose(|| eprintln!("using downloaded stage2 artifacts from CI (commit {commit})")); let version = self.artifact_version_part(commit); // download-rustc doesn't need its own cargo, it can just use beta's. But it does need the @@ -539,7 +539,7 @@ impl Config { #[cfg(not(feature = "bootstrap-self-test"))] pub(crate) fn download_beta_toolchain(&self) { - self.verbose(|| println!("downloading stage0 beta artifacts")); + self.verbose(|| eprintln!("downloading stage0 beta artifacts")); let date = &self.stage0_metadata.compiler.date; let version = &self.stage0_metadata.compiler.version; @@ -677,7 +677,7 @@ impl Config { return; } else { self.verbose(|| { - println!( + eprintln!( "ignoring cached file {} due to failed verification", tarball.display() ) @@ -776,10 +776,10 @@ download-rustc = false t!(check_incompatible_options_for_ci_llvm(current_config_toml, ci_config_toml)); } Err(e) if e.to_string().contains("unknown field") => { - println!( + eprintln!( "WARNING: CI LLVM has some fields that are no longer supported in bootstrap; download-ci-llvm will be disabled." ); - println!("HELP: Consider rebasing to a newer commit if available."); + eprintln!("HELP: Consider rebasing to a newer commit if available."); } Err(e) => { eprintln!("ERROR: Failed to parse CI LLVM config.toml: {e}"); diff --git a/src/bootstrap/src/core/sanity.rs b/src/bootstrap/src/core/sanity.rs index dcf68cbeeda..71e7f40f032 100644 --- a/src/bootstrap/src/core/sanity.rs +++ b/src/bootstrap/src/core/sanity.rs @@ -237,11 +237,11 @@ than building it. stage0_supported_target_list.intersection(&missing_targets_hashset).collect(); if !duplicated_targets.is_empty() { - println!( + eprintln!( "Following targets supported from the stage0 compiler, please remove them from STAGE0_MISSING_TARGETS list." ); for duplicated_target in duplicated_targets { - println!(" {duplicated_target}"); + eprintln!(" {duplicated_target}"); } std::process::exit(1); } diff --git a/src/bootstrap/src/lib.rs b/src/bootstrap/src/lib.rs index 0ecf61ffcd9..5f778223d7d 100644 --- a/src/bootstrap/src/lib.rs +++ b/src/bootstrap/src/lib.rs @@ -406,11 +406,11 @@ impl Build { .unwrap() .trim(); if local_release.split('.').take(2).eq(version.split('.').take(2)) { - build.verbose(|| println!("auto-detected local-rebuild {local_release}")); + build.verbose(|| eprintln!("auto-detected local-rebuild {local_release}")); build.local_rebuild = true; } - build.verbose(|| println!("finding compilers")); + build.verbose(|| eprintln!("finding compilers")); utils::cc_detect::find(&build); // When running `setup`, the profile is about to change, so any requirements we have now may // be different on the next invocation. Don't check for them until the next time x.py is @@ -418,7 +418,7 @@ impl Build { // // Similarly, for `setup` we don't actually need submodules or cargo metadata. if !matches!(build.config.cmd, Subcommand::Setup { .. }) { - build.verbose(|| println!("running sanity check")); + build.verbose(|| eprintln!("running sanity check")); crate::core::sanity::check(&mut build); // Make sure we update these before gathering metadata so we don't get an error about missing @@ -436,7 +436,7 @@ impl Build { // Now, update all existing submodules. build.update_existing_submodules(); - build.verbose(|| println!("learning about cargo")); + build.verbose(|| eprintln!("learning about cargo")); crate::core::metadata::build(&mut build); } @@ -605,7 +605,7 @@ impl Build { let stamp = dir.join(".stamp"); let mut cleared = false; if mtime(&stamp) < mtime(input) { - self.verbose(|| println!("Dirty - {}", dir.display())); + self.verbose(|| eprintln!("Dirty - {}", dir.display())); let _ = fs::remove_dir_all(dir); cleared = true; } else if stamp.exists() { @@ -890,7 +890,7 @@ impl Build { let executed_at = std::panic::Location::caller(); self.verbose(|| { - println!("running: {command:?} (created at {created_at}, executed at {executed_at})") + eprintln!("running: {command:?} (created at {created_at}, executed at {executed_at})") }); let cmd = command.as_command_mut(); @@ -947,7 +947,7 @@ Executed at: {executed_at}"#, let fail = |message: &str, output: CommandOutput| -> ! { if self.is_verbose() { - println!("{message}"); + eprintln!("{message}"); } else { let (stdout, stderr) = (output.stdout_if_present(), output.stderr_if_present()); // If the command captures output, the user would not see any indication that @@ -957,16 +957,16 @@ Executed at: {executed_at}"#, if let Some(stdout) = output.stdout_if_present().take_if(|s| !s.trim().is_empty()) { - println!("STDOUT:\n{stdout}\n"); + eprintln!("STDOUT:\n{stdout}\n"); } if let Some(stderr) = output.stderr_if_present().take_if(|s| !s.trim().is_empty()) { - println!("STDERR:\n{stderr}\n"); + eprintln!("STDERR:\n{stderr}\n"); } - println!("Command {command:?} has failed. Rerun with -v to see more details."); + eprintln!("Command {command:?} has failed. Rerun with -v to see more details."); } else { - println!("Command has failed. Rerun with -v to see more details."); + eprintln!("Command has failed. Rerun with -v to see more details."); } } exit!(1); @@ -1011,7 +1011,7 @@ Executed at: {executed_at}"#, match self.config.dry_run { DryRun::SelfCheck => (), DryRun::Disabled | DryRun::UserSelected => { - println!("{msg}"); + eprintln!("{msg}"); } } } @@ -1666,7 +1666,7 @@ Executed at: {executed_at}"#, if self.config.dry_run() { return; } - self.verbose_than(1, || println!("Copy/Link {src:?} to {dst:?}")); + self.verbose_than(1, || eprintln!("Copy/Link {src:?} to {dst:?}")); if src == dst { return; } @@ -1775,7 +1775,7 @@ Executed at: {executed_at}"#, return; } let dst = dstdir.join(src.file_name().unwrap()); - self.verbose_than(1, || println!("Install {src:?} to {dst:?}")); + self.verbose_than(1, || eprintln!("Install {src:?} to {dst:?}")); t!(fs::create_dir_all(dstdir)); if !src.exists() { panic!("ERROR: File \"{}\" not found!", src.display()); diff --git a/src/bootstrap/src/utils/cc_detect.rs b/src/bootstrap/src/utils/cc_detect.rs index 0df00469452..e8d5b60948a 100644 --- a/src/bootstrap/src/utils/cc_detect.rs +++ b/src/bootstrap/src/utils/cc_detect.rs @@ -155,15 +155,15 @@ pub fn find_target(build: &Build, target: TargetSelection) { build.cxx.borrow_mut().insert(target, compiler); } - build.verbose(|| println!("CC_{} = {:?}", target.triple, build.cc(target))); - build.verbose(|| println!("CFLAGS_{} = {cflags:?}", target.triple)); + build.verbose(|| eprintln!("CC_{} = {:?}", target.triple, build.cc(target))); + build.verbose(|| eprintln!("CFLAGS_{} = {cflags:?}", target.triple)); if let Ok(cxx) = build.cxx(target) { let cxxflags = build.cflags(target, GitRepo::Rustc, CLang::Cxx); - build.verbose(|| println!("CXX_{} = {cxx:?}", target.triple)); - build.verbose(|| println!("CXXFLAGS_{} = {cxxflags:?}", target.triple)); + build.verbose(|| eprintln!("CXX_{} = {cxx:?}", target.triple)); + build.verbose(|| eprintln!("CXXFLAGS_{} = {cxxflags:?}", target.triple)); } if let Some(ar) = ar { - build.verbose(|| println!("AR_{} = {ar:?}", target.triple)); + build.verbose(|| eprintln!("AR_{} = {ar:?}", target.triple)); build.ar.borrow_mut().insert(target, ar); } diff --git a/src/bootstrap/src/utils/helpers.rs b/src/bootstrap/src/utils/helpers.rs index 923cc2dfc28..c0d52fd3430 100644 --- a/src/bootstrap/src/utils/helpers.rs +++ b/src/bootstrap/src/utils/helpers.rs @@ -135,7 +135,7 @@ impl Drop for TimeIt { fn drop(&mut self) { let time = self.1.elapsed(); if !self.0 { - println!("\tfinished in {}.{:03} seconds", time.as_secs(), time.subsec_millis()); + eprintln!("\tfinished in {}.{:03} seconds", time.as_secs(), time.subsec_millis()); } } } @@ -267,12 +267,12 @@ pub fn check_run(cmd: &mut BootstrapCommand, print_cmd_on_fail: bool) -> bool { let status = match cmd.as_command_mut().status() { Ok(status) => status, Err(e) => { - println!("failed to execute command: {cmd:?}\nERROR: {e}"); + eprintln!("failed to execute command: {cmd:?}\nERROR: {e}"); return false; } }; if !status.success() && print_cmd_on_fail { - println!( + eprintln!( "\n\ncommand did not execute successfully: {cmd:?}\n\ expected success, got: {status}\n\n" ); diff --git a/src/bootstrap/src/utils/metrics.rs b/src/bootstrap/src/utils/metrics.rs index b51fd490535..06d3add6281 100644 --- a/src/bootstrap/src/utils/metrics.rs +++ b/src/bootstrap/src/utils/metrics.rs @@ -185,7 +185,7 @@ impl BuildMetrics { if version.format_version == CURRENT_FORMAT_VERSION { t!(serde_json::from_slice::(&contents)).invocations } else { - println!( + eprintln!( "WARNING: overriding existing build/metrics.json, as it's not \ compatible with build metrics format version {CURRENT_FORMAT_VERSION}." ); diff --git a/src/bootstrap/src/utils/render_tests.rs b/src/bootstrap/src/utils/render_tests.rs index eb2c8254dc0..7a3ec61c6da 100644 --- a/src/bootstrap/src/utils/render_tests.rs +++ b/src/bootstrap/src/utils/render_tests.rs @@ -56,7 +56,7 @@ fn run_tests(builder: &Builder<'_>, cmd: &mut BootstrapCommand, stream: bool) -> let cmd = cmd.as_command_mut(); cmd.stdout(Stdio::piped()); - builder.verbose(|| println!("running: {cmd:?}")); + builder.verbose(|| eprintln!("running: {cmd:?}")); let mut process = cmd.spawn().unwrap(); @@ -71,7 +71,7 @@ fn run_tests(builder: &Builder<'_>, cmd: &mut BootstrapCommand, stream: bool) -> let result = process.wait_with_output().unwrap(); if !result.status.success() && builder.is_verbose() { - println!( + eprintln!( "\n\ncommand did not execute successfully: {cmd:?}\n\ expected success, got: {}", result.status @@ -135,7 +135,9 @@ impl<'a> Renderer<'a> { if self.up_to_date_tests > 0 { let n = self.up_to_date_tests; let s = if n > 1 { "s" } else { "" }; - println!("help: ignored {n} up-to-date test{s}; use `--force-rerun` to prevent this\n"); + eprintln!( + "help: ignored {n} up-to-date test{s}; use `--force-rerun` to prevent this\n" + ); } } @@ -185,12 +187,12 @@ impl<'a> Renderer<'a> { } fn render_test_outcome_verbose(&self, outcome: Outcome<'_>, test: &TestOutcome) { - print!("test {} ... ", test.name); - self.builder.colored_stdout(|stdout| outcome.write_long(stdout)).unwrap(); + eprint!("test {} ... ", test.name); + self.builder.colored_stderr(|stdout| outcome.write_long(stdout)).unwrap(); if let Some(exec_time) = test.exec_time { - print!(" ({exec_time:.2?})"); + eprint!(" ({exec_time:.2?})"); } - println!(); + eprintln!(); } fn render_test_outcome_terse(&mut self, outcome: Outcome<'_>, test: &TestOutcome) { @@ -198,45 +200,45 @@ impl<'a> Renderer<'a> { if let Some(total) = self.tests_count { let total = total.to_string(); let executed = format!("{:>width$}", self.executed_tests - 1, width = total.len()); - print!(" {executed}/{total}"); + eprint!(" {executed}/{total}"); } - println!(); + eprintln!(); self.terse_tests_in_line = 0; } self.terse_tests_in_line += 1; - self.builder.colored_stdout(|stdout| outcome.write_short(stdout, &test.name)).unwrap(); + self.builder.colored_stderr(|stdout| outcome.write_short(stdout, &test.name)).unwrap(); let _ = std::io::stdout().flush(); } fn render_suite_outcome(&self, outcome: Outcome<'_>, suite: &SuiteOutcome) { // The terse output doesn't end with a newline, so we need to add it ourselves. if !self.builder.config.verbose_tests { - println!(); + eprintln!(); } if !self.failures.is_empty() { - println!("\nfailures:\n"); + eprintln!("\nfailures:\n"); for failure in &self.failures { if failure.stdout.is_some() || failure.message.is_some() { - println!("---- {} stdout ----", failure.name); + eprintln!("---- {} stdout ----", failure.name); if let Some(stdout) = &failure.stdout { - println!("{stdout}"); + eprintln!("{stdout}"); } if let Some(message) = &failure.message { - println!("NOTE: {message}"); + eprintln!("NOTE: {message}"); } } } - println!("\nfailures:"); + eprintln!("\nfailures:"); for failure in &self.failures { - println!(" {}", failure.name); + eprintln!(" {}", failure.name); } } if !self.benches.is_empty() { - println!("\nbenchmarks:"); + eprintln!("\nbenchmarks:"); let mut rows = Vec::new(); for bench in &self.benches { @@ -251,13 +253,13 @@ impl<'a> Renderer<'a> { let max_1 = rows.iter().map(|r| r.1.len()).max().unwrap_or(0); let max_2 = rows.iter().map(|r| r.2.len()).max().unwrap_or(0); for row in &rows { - println!(" {:max_1$} {:>max_2$}", row.0, row.1, row.2); + eprintln!(" {:max_1$} {:>max_2$}", row.0, row.1, row.2); } } - print!("\ntest result: "); - self.builder.colored_stdout(|stdout| outcome.write_long(stdout)).unwrap(); - println!( + eprint!("\ntest result: "); + self.builder.colored_stderr(|stdout| outcome.write_long(stdout)).unwrap(); + eprintln!( ". {} passed; {} failed; {} ignored; {} measured; {} filtered out{time}\n", suite.passed, suite.failed, @@ -274,7 +276,7 @@ impl<'a> Renderer<'a> { fn render_message(&mut self, message: Message) { match message { Message::Suite(SuiteMessage::Started { test_count }) => { - println!("\nrunning {test_count} tests"); + eprintln!("\nrunning {test_count} tests"); self.executed_tests = 0; self.terse_tests_in_line = 0; self.tests_count = Some(test_count); @@ -314,7 +316,7 @@ impl<'a> Renderer<'a> { self.failures.push(outcome); } Message::Test(TestMessage::Timeout { name }) => { - println!("test {name} has been running for a long time"); + eprintln!("test {name} has been running for a long time"); } Message::Test(TestMessage::Started) => {} // Not useful } diff --git a/src/bootstrap/src/utils/tarball.rs b/src/bootstrap/src/utils/tarball.rs index 3c6c7a7fa18..f60498a4872 100644 --- a/src/bootstrap/src/utils/tarball.rs +++ b/src/bootstrap/src/utils/tarball.rs @@ -344,7 +344,7 @@ impl<'a> Tarball<'a> { // For `x install` tarball files aren't needed, so we can speed up the process by not producing them. let compression_profile = if self.builder.kind == Kind::Install { self.builder.verbose(|| { - println!("Forcing dist.compression-profile = 'no-op' for `x install`.") + eprintln!("Forcing dist.compression-profile = 'no-op' for `x install`.") }); // "no-op" indicates that the rust-installer won't produce compressed tarball sources. "no-op" -- cgit 1.4.1-3-g733a5 From a6c462863d0a73f0925aab2c9556db8b45a6e502 Mon Sep 17 00:00:00 2001 From: clubby789 Date: Tue, 3 Dec 2024 20:21:51 +0000 Subject: compiletest: `print{,ln}!` -> `eprint{,ln}!` Co-authored-by: Jieyou Xu --- src/tools/compiletest/src/compute_diff.rs | 2 +- src/tools/compiletest/src/debuggers.rs | 6 +-- src/tools/compiletest/src/lib.rs | 10 ++--- src/tools/compiletest/src/runtest.rs | 52 +++++++++++----------- src/tools/compiletest/src/runtest/codegen_units.rs | 22 ++++----- src/tools/compiletest/src/runtest/debuginfo.rs | 10 ++--- src/tools/compiletest/src/runtest/incremental.rs | 2 +- src/tools/compiletest/src/runtest/mir_opt.rs | 2 +- src/tools/compiletest/src/runtest/rustdoc_json.rs | 2 +- src/tools/compiletest/src/runtest/ui.rs | 4 +- src/tools/compiletest/src/util.rs | 2 +- 11 files changed, 57 insertions(+), 57 deletions(-) diff --git a/src/tools/compiletest/src/compute_diff.rs b/src/tools/compiletest/src/compute_diff.rs index 92c80c27de0..3ace6c5b6d7 100644 --- a/src/tools/compiletest/src/compute_diff.rs +++ b/src/tools/compiletest/src/compute_diff.rs @@ -144,7 +144,7 @@ where } if !wrote_data { - println!("note: diff is identical to nightly rustdoc"); + eprintln!("note: diff is identical to nightly rustdoc"); assert!(diff_output.metadata().unwrap().len() == 0); return false; } else if verbose { diff --git a/src/tools/compiletest/src/debuggers.rs b/src/tools/compiletest/src/debuggers.rs index b605bc813f1..e75c8a5993e 100644 --- a/src/tools/compiletest/src/debuggers.rs +++ b/src/tools/compiletest/src/debuggers.rs @@ -20,7 +20,7 @@ pub(crate) fn configure_gdb(config: &Config) -> Option> { } if config.remote_test_client.is_some() && !config.target.contains("android") { - println!( + eprintln!( "WARNING: debuginfo tests are not available when \ testing with remote" ); @@ -28,7 +28,7 @@ pub(crate) fn configure_gdb(config: &Config) -> Option> { } if config.target.contains("android") { - println!( + eprintln!( "{} debug-info test uses tcp 5039 port.\ please reserve it", config.target @@ -50,7 +50,7 @@ pub(crate) fn configure_lldb(config: &Config) -> Option> { config.lldb_python_dir.as_ref()?; if let Some(350) = config.lldb_version { - println!( + eprintln!( "WARNING: The used version of LLDB (350) has a \ known issue that breaks debuginfo tests. See \ issue #32520 for more information. Skipping all \ diff --git a/src/tools/compiletest/src/lib.rs b/src/tools/compiletest/src/lib.rs index a5a166af33b..9acb7d393b4 100644 --- a/src/tools/compiletest/src/lib.rs +++ b/src/tools/compiletest/src/lib.rs @@ -188,8 +188,8 @@ pub fn parse_config(args: Vec) -> Config { let (argv0, args_) = args.split_first().unwrap(); if args.len() == 1 || args[1] == "-h" || args[1] == "--help" { let message = format!("Usage: {} [OPTIONS] [TESTNAME...]", argv0); - println!("{}", opts.usage(&message)); - println!(); + eprintln!("{}", opts.usage(&message)); + eprintln!(); panic!() } @@ -200,8 +200,8 @@ pub fn parse_config(args: Vec) -> Config { if matches.opt_present("h") || matches.opt_present("help") { let message = format!("Usage: {} [OPTIONS] [TESTNAME...]", argv0); - println!("{}", opts.usage(&message)); - println!(); + eprintln!("{}", opts.usage(&message)); + eprintln!(); panic!() } @@ -508,7 +508,7 @@ pub fn run_tests(config: Arc) { // easy to miss which tests failed, and as such fail to reproduce // the failure locally. - println!( + eprintln!( "Some tests failed in compiletest suite={}{} mode={} host={} target={}", config.suite, config diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index 7b11bf3b121..ca746ed8c55 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -131,7 +131,7 @@ pub fn run(config: Arc, testpaths: &TestPaths, revision: Option<&str>) { if config.verbose { // We're going to be dumping a lot of info. Start on a new line. - print!("\n\n"); + eprintln!("\n"); } debug!("running {:?}", testpaths.file.display()); let mut props = TestProps::from_file(&testpaths.file, revision, &config); @@ -353,7 +353,7 @@ impl<'test> TestCx<'test> { { self.error(&format!("{} test did not emit an error", self.config.mode)); if self.config.mode == crate::common::Mode::Ui { - println!("note: by default, ui tests are expected not to compile"); + eprintln!("note: by default, ui tests are expected not to compile"); } proc_res.fatal(None, || ()); }; @@ -774,20 +774,20 @@ impl<'test> TestCx<'test> { unexpected.len(), not_found.len() )); - println!("status: {}\ncommand: {}\n", proc_res.status, proc_res.cmdline); + eprintln!("status: {}\ncommand: {}\n", proc_res.status, proc_res.cmdline); if !unexpected.is_empty() { - println!("{}", "--- unexpected errors (from JSON output) ---".green()); + eprintln!("{}", "--- unexpected errors (from JSON output) ---".green()); for error in &unexpected { - println!("{}", error.render_for_expected()); + eprintln!("{}", error.render_for_expected()); } - println!("{}", "---".green()); + eprintln!("{}", "---".green()); } if !not_found.is_empty() { - println!("{}", "--- not found errors (from test file) ---".red()); + eprintln!("{}", "--- not found errors (from test file) ---".red()); for error in ¬_found { - println!("{}", error.render_for_expected()); + eprintln!("{}", error.render_for_expected()); } - println!("{}", "---\n".red()); + eprintln!("{}", "---\n".red()); } panic!("errors differ from expected"); } @@ -1876,18 +1876,18 @@ impl<'test> TestCx<'test> { fn maybe_dump_to_stdout(&self, out: &str, err: &str) { if self.config.verbose { - println!("------stdout------------------------------"); - println!("{}", out); - println!("------stderr------------------------------"); - println!("{}", err); - println!("------------------------------------------"); + eprintln!("------stdout------------------------------"); + eprintln!("{}", out); + eprintln!("------stderr------------------------------"); + eprintln!("{}", err); + eprintln!("------------------------------------------"); } } fn error(&self, err: &str) { match self.revision { - Some(rev) => println!("\nerror in revision `{}`: {}", rev, err), - None => println!("\nerror: {}", err), + Some(rev) => eprintln!("\nerror in revision `{}`: {}", rev, err), + None => eprintln!("\nerror: {}", err), } } @@ -1972,7 +1972,7 @@ impl<'test> TestCx<'test> { if !self.config.has_html_tidy { return; } - println!("info: generating a diff against nightly rustdoc"); + eprintln!("info: generating a diff against nightly rustdoc"); let suffix = self.safe_revision().map_or("nightly".into(), |path| path.to_owned() + "-nightly"); @@ -2082,7 +2082,7 @@ impl<'test> TestCx<'test> { .output() .unwrap(); assert!(output.status.success()); - println!("{}", String::from_utf8_lossy(&output.stdout)); + eprintln!("{}", String::from_utf8_lossy(&output.stdout)); eprintln!("{}", String::from_utf8_lossy(&output.stderr)); } else { use colored::Colorize; @@ -2496,7 +2496,7 @@ impl<'test> TestCx<'test> { )"# ) .replace_all(&output, |caps: &Captures<'_>| { - println!("{}", &caps[0]); + eprintln!("{}", &caps[0]); caps[0].replace(r"\", "/") }) .replace("\r\n", "\n") @@ -2601,14 +2601,14 @@ impl<'test> TestCx<'test> { if let Err(err) = fs::write(&actual_path, &actual) { self.fatal(&format!("failed to write {stream} to `{actual_path:?}`: {err}",)); } - println!("Saved the actual {stream} to {actual_path:?}"); + eprintln!("Saved the actual {stream} to {actual_path:?}"); let expected_path = expected_output_path(self.testpaths, self.revision, &self.config.compare_mode, stream); if !self.config.bless { if expected.is_empty() { - println!("normalized {}:\n{}\n", stream, actual); + eprintln!("normalized {}:\n{}\n", stream, actual); } else { self.show_diff( stream, @@ -2631,10 +2631,10 @@ impl<'test> TestCx<'test> { if let Err(err) = fs::write(&expected_path, &actual) { self.fatal(&format!("failed to write {stream} to `{expected_path:?}`: {err}")); } - println!("Blessing the {stream} of {test_name} in {expected_path:?}"); + eprintln!("Blessing the {stream} of {test_name} in {expected_path:?}"); } - println!("\nThe actual {0} differed from the expected {0}.", stream); + eprintln!("\nThe actual {0} differed from the expected {0}.", stream); if self.config.bless { 0 } else { 1 } } @@ -2783,7 +2783,7 @@ impl<'test> TestCx<'test> { fs::create_dir_all(&incremental_dir).unwrap(); if self.config.verbose { - println!("init_incremental_test: incremental_dir={}", incremental_dir.display()); + eprintln!("init_incremental_test: incremental_dir={}", incremental_dir.display()); } } @@ -2841,7 +2841,7 @@ impl ProcRes { } } - println!( + eprintln!( "status: {}\ncommand: {}\n{}\n{}\n", self.status, self.cmdline, @@ -2852,7 +2852,7 @@ impl ProcRes { pub fn fatal(&self, err: Option<&str>, on_failure: impl FnOnce()) -> ! { if let Some(e) = err { - println!("\nerror: {}", e); + eprintln!("\nerror: {}", e); } self.print_info(); on_failure(); diff --git a/src/tools/compiletest/src/runtest/codegen_units.rs b/src/tools/compiletest/src/runtest/codegen_units.rs index 6c866cbef21..6acd140183d 100644 --- a/src/tools/compiletest/src/runtest/codegen_units.rs +++ b/src/tools/compiletest/src/runtest/codegen_units.rs @@ -64,13 +64,13 @@ impl TestCx<'_> { if !missing.is_empty() { missing.sort(); - println!("\nThese items should have been contained but were not:\n"); + eprintln!("\nThese items should have been contained but were not:\n"); for item in &missing { - println!("{}", item); + eprintln!("{}", item); } - println!("\n"); + eprintln!("\n"); } if !unexpected.is_empty() { @@ -80,24 +80,24 @@ impl TestCx<'_> { sorted }; - println!("\nThese items were contained but should not have been:\n"); + eprintln!("\nThese items were contained but should not have been:\n"); for item in sorted { - println!("{}", item); + eprintln!("{}", item); } - println!("\n"); + eprintln!("\n"); } if !wrong_cgus.is_empty() { wrong_cgus.sort_by_key(|pair| pair.0.name.clone()); - println!("\nThe following items were assigned to wrong codegen units:\n"); + eprintln!("\nThe following items were assigned to wrong codegen units:\n"); for &(ref expected_item, ref actual_item) in &wrong_cgus { - println!("{}", expected_item.name); - println!(" expected: {}", codegen_units_to_str(&expected_item.codegen_units)); - println!(" actual: {}", codegen_units_to_str(&actual_item.codegen_units)); - println!(); + eprintln!("{}", expected_item.name); + eprintln!(" expected: {}", codegen_units_to_str(&expected_item.codegen_units)); + eprintln!(" actual: {}", codegen_units_to_str(&actual_item.codegen_units)); + eprintln!(); } } diff --git a/src/tools/compiletest/src/runtest/debuginfo.rs b/src/tools/compiletest/src/runtest/debuginfo.rs index c621c22ac99..7322e730e53 100644 --- a/src/tools/compiletest/src/runtest/debuginfo.rs +++ b/src/tools/compiletest/src/runtest/debuginfo.rs @@ -260,7 +260,7 @@ impl TestCx<'_> { cmdline, }; if adb.kill().is_err() { - println!("Adb process is already finished."); + eprintln!("Adb process is already finished."); } } else { let rust_src_root = @@ -275,7 +275,7 @@ impl TestCx<'_> { match self.config.gdb_version { Some(version) => { - println!("NOTE: compiletest thinks it is using GDB version {}", version); + eprintln!("NOTE: compiletest thinks it is using GDB version {}", version); if version > extract_gdb_version("7.4").unwrap() { // Add the directory containing the pretty printers to @@ -297,7 +297,7 @@ impl TestCx<'_> { } } _ => { - println!( + eprintln!( "NOTE: compiletest does not know which version of \ GDB it is using" ); @@ -392,10 +392,10 @@ impl TestCx<'_> { match self.config.lldb_version { Some(ref version) => { - println!("NOTE: compiletest thinks it is using LLDB version {}", version); + eprintln!("NOTE: compiletest thinks it is using LLDB version {}", version); } _ => { - println!( + eprintln!( "NOTE: compiletest does not know which version of \ LLDB it is using" ); diff --git a/src/tools/compiletest/src/runtest/incremental.rs b/src/tools/compiletest/src/runtest/incremental.rs index 591aff0defe..4f26786129b 100644 --- a/src/tools/compiletest/src/runtest/incremental.rs +++ b/src/tools/compiletest/src/runtest/incremental.rs @@ -30,7 +30,7 @@ impl TestCx<'_> { assert!(incremental_dir.exists(), "init_incremental_test failed to create incremental dir"); if self.config.verbose { - print!("revision={:?} props={:#?}", revision, self.props); + eprint!("revision={:?} props={:#?}", revision, self.props); } if revision.starts_with("cpass") { diff --git a/src/tools/compiletest/src/runtest/mir_opt.rs b/src/tools/compiletest/src/runtest/mir_opt.rs index d1ec0035744..64a2addaa28 100644 --- a/src/tools/compiletest/src/runtest/mir_opt.rs +++ b/src/tools/compiletest/src/runtest/mir_opt.rs @@ -89,7 +89,7 @@ impl TestCx<'_> { } let expected_string = fs::read_to_string(&expected_file).unwrap(); if dumped_string != expected_string { - print!("{}", write_diff(&expected_string, &dumped_string, 3)); + eprint!("{}", write_diff(&expected_string, &dumped_string, 3)); panic!( "Actual MIR output differs from expected MIR output {}", expected_file.display() diff --git a/src/tools/compiletest/src/runtest/rustdoc_json.rs b/src/tools/compiletest/src/runtest/rustdoc_json.rs index 31fdb0a5d13..84376d346af 100644 --- a/src/tools/compiletest/src/runtest/rustdoc_json.rs +++ b/src/tools/compiletest/src/runtest/rustdoc_json.rs @@ -29,7 +29,7 @@ impl TestCx<'_> { if !res.status.success() { self.fatal_proc_rec_with_ctx("jsondocck failed!", &res, |_| { - println!("Rustdoc Output:"); + eprintln!("Rustdoc Output:"); proc_res.print_info(); }) } diff --git a/src/tools/compiletest/src/runtest/ui.rs b/src/tools/compiletest/src/runtest/ui.rs index 172b1e32aad..bc860bf18c7 100644 --- a/src/tools/compiletest/src/runtest/ui.rs +++ b/src/tools/compiletest/src/runtest/ui.rs @@ -109,10 +109,10 @@ impl TestCx<'_> { } if errors > 0 { - println!("To update references, rerun the tests and pass the `--bless` flag"); + eprintln!("To update references, rerun the tests and pass the `--bless` flag"); let relative_path_to_file = self.testpaths.relative_dir.join(self.testpaths.file.file_name().unwrap()); - println!( + eprintln!( "To only update this specific test, also pass `--test-args {}`", relative_path_to_file.display(), ); diff --git a/src/tools/compiletest/src/util.rs b/src/tools/compiletest/src/util.rs index bff02f1db9f..7b50e62c29b 100644 --- a/src/tools/compiletest/src/util.rs +++ b/src/tools/compiletest/src/util.rs @@ -30,7 +30,7 @@ fn path_div() -> &'static str { pub fn logv(config: &Config, s: String) { debug!("{}", s); if config.verbose { - println!("{}", s); + eprintln!("{}", s); } } -- cgit 1.4.1-3-g733a5 From d0986f45e094b011d132238563b05c09e4f1e20e Mon Sep 17 00:00:00 2001 From: DianQK Date: Mon, 9 Dec 2024 20:25:41 +0800 Subject: dataflow_const_prop: do not eval a ptr address in SwitchInt --- .../rustc_mir_transform/src/dataflow_const_prop.rs | 9 +++++++-- tests/crashes/131227.rs | 16 ---------------- .../ptr-in-switch-int-issue-131227.rs | 19 +++++++++++++++++++ 3 files changed, 26 insertions(+), 18 deletions(-) delete mode 100644 tests/crashes/131227.rs create mode 100644 tests/ui/dataflow_const_prop/ptr-in-switch-int-issue-131227.rs diff --git a/compiler/rustc_mir_transform/src/dataflow_const_prop.rs b/compiler/rustc_mir_transform/src/dataflow_const_prop.rs index d017202f48b..b94c925b1db 100644 --- a/compiler/rustc_mir_transform/src/dataflow_const_prop.rs +++ b/compiler/rustc_mir_transform/src/dataflow_const_prop.rs @@ -534,8 +534,13 @@ impl<'a, 'tcx> ConstAnalysis<'a, 'tcx> { // This allows the set of visited edges to grow monotonically with the lattice. FlatSet::Bottom => TerminatorEdges::None, FlatSet::Elem(scalar) => { - let choice = scalar.assert_scalar_int().to_bits_unchecked(); - TerminatorEdges::Single(targets.target_for_value(choice)) + if let Ok(scalar_int) = scalar.try_to_scalar_int() { + TerminatorEdges::Single( + targets.target_for_value(scalar_int.to_bits_unchecked()), + ) + } else { + TerminatorEdges::SwitchInt { discr, targets } + } } FlatSet::Top => TerminatorEdges::SwitchInt { discr, targets }, } diff --git a/tests/crashes/131227.rs b/tests/crashes/131227.rs deleted file mode 100644 index f46185b5b4a..00000000000 --- a/tests/crashes/131227.rs +++ /dev/null @@ -1,16 +0,0 @@ -//@ known-bug: #131227 -//@ compile-flags: -Zmir-opt-level=3 - -static mut G: () = (); - -fn myfunc() -> i32 { - let var = &raw mut G; - if var.is_null() { - return 0; - } - 0 -} - -fn main() { - myfunc(); -} diff --git a/tests/ui/dataflow_const_prop/ptr-in-switch-int-issue-131227.rs b/tests/ui/dataflow_const_prop/ptr-in-switch-int-issue-131227.rs new file mode 100644 index 00000000000..7a55e13d0ee --- /dev/null +++ b/tests/ui/dataflow_const_prop/ptr-in-switch-int-issue-131227.rs @@ -0,0 +1,19 @@ +//! Issue: +//! Test that constant propagation in SwitchInt does not crash +//! when encountering a ptr-to-int transmute. + +//@ check-pass +//@ compile-flags: -Zmir-enable-passes=+InstSimplify-before-inline,+DataflowConstProp + +#![crate_type = "lib"] + +static mut G: i32 = 0; + +pub fn myfunc() -> i32 { + let var = &raw mut G; + let u: usize = unsafe { std::mem::transmute(var) }; + match u { + 0 => 0, + _ => 1, + } +} -- cgit 1.4.1-3-g733a5 From 73dc95dad19e2fa513ea8ac2b76231474398c8ec Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Mon, 9 Dec 2024 08:52:23 +0100 Subject: interpret: clean up deduplicating allocation functions --- compiler/rustc_const_eval/src/interpret/place.rs | 44 ++++++-------- .../rustc_const_eval/src/util/caller_location.rs | 9 +-- compiler/rustc_middle/src/ty/context.rs | 2 +- src/tools/miri/src/shims/backtrace.rs | 10 +--- src/tools/miri/src/shims/panic.rs | 5 +- .../miri/tests/pass/backtrace/backtrace-api-v0.rs | 69 ---------------------- .../tests/pass/backtrace/backtrace-api-v0.stderr | 18 ------ .../tests/pass/backtrace/backtrace-api-v0.stdout | 5 -- 8 files changed, 24 insertions(+), 138 deletions(-) delete mode 100644 src/tools/miri/tests/pass/backtrace/backtrace-api-v0.rs delete mode 100644 src/tools/miri/tests/pass/backtrace/backtrace-api-v0.stderr delete mode 100644 src/tools/miri/tests/pass/backtrace/backtrace-api-v0.stdout diff --git a/compiler/rustc_const_eval/src/interpret/place.rs b/compiler/rustc_const_eval/src/interpret/place.rs index f54a932e1b6..810e9356b26 100644 --- a/compiler/rustc_const_eval/src/interpret/place.rs +++ b/compiler/rustc_const_eval/src/interpret/place.rs @@ -5,8 +5,7 @@ use std::assert_matches::assert_matches; use either::{Either, Left, Right}; -use rustc_abi::{Align, BackendRepr, HasDataLayout, Size}; -use rustc_ast::Mutability; +use rustc_abi::{BackendRepr, HasDataLayout, Size}; use rustc_middle::ty::Ty; use rustc_middle::ty::layout::{LayoutOf, TyAndLayout}; use rustc_middle::{bug, mir, span_bug}; @@ -1018,40 +1017,31 @@ where self.allocate_dyn(layout, kind, MemPlaceMeta::None) } - /// Allocates a sequence of bytes in the interpreter's memory. - /// For immutable allocations, uses deduplication to reuse existing memory. - /// For mutable allocations, creates a new unique allocation. - pub fn allocate_bytes( + /// Allocates a sequence of bytes in the interpreter's memory with alignment 1. + /// This is allocated in immutable global memory and deduplicated. + pub fn allocate_bytes_dedup( &mut self, bytes: &[u8], - align: Align, - kind: MemoryKind, - mutbl: Mutability, ) -> InterpResult<'tcx, Pointer> { - // Use cache for immutable strings. - if mutbl.is_not() { - // Use dedup'd allocation function. - let salt = M::get_global_alloc_salt(self, None); - let id = self.tcx.allocate_bytes_dedup(bytes, salt); - - // Turn untagged "global" pointers (obtained via `tcx`) into the machine pointer to the allocation. - M::adjust_alloc_root_pointer(&self, Pointer::from(id), Some(kind)) - } else { - // Allocate new memory for mutable data. - self.allocate_bytes_ptr(bytes, align, kind, mutbl) - } + let salt = M::get_global_alloc_salt(self, None); + let id = self.tcx.allocate_bytes_dedup(bytes, salt); + + // Turn untagged "global" pointers (obtained via `tcx`) into the machine pointer to the allocation. + M::adjust_alloc_root_pointer( + &self, + Pointer::from(id), + M::GLOBAL_KIND.map(MemoryKind::Machine), + ) } - /// Allocates a string in the interpreter's memory with metadata for length. - /// Uses `allocate_bytes` internally but adds string-specific metadata handling. - pub fn allocate_str( + /// Allocates a string in the interpreter's memory, returning it as a (wide) place. + /// This is allocated in immutable global memory and deduplicated. + pub fn allocate_str_dedup( &mut self, str: &str, - kind: MemoryKind, - mutbl: Mutability, ) -> InterpResult<'tcx, MPlaceTy<'tcx, M::Provenance>> { let bytes = str.as_bytes(); - let ptr = self.allocate_bytes(bytes, Align::ONE, kind, mutbl)?; + let ptr = self.allocate_bytes_dedup(bytes)?; // Create length metadata for the string. let meta = Scalar::from_target_usize(u64::try_from(bytes.len()).unwrap(), self); diff --git a/compiler/rustc_const_eval/src/util/caller_location.rs b/compiler/rustc_const_eval/src/util/caller_location.rs index 9bf16d4fe16..6593547cd23 100644 --- a/compiler/rustc_const_eval/src/util/caller_location.rs +++ b/compiler/rustc_const_eval/src/util/caller_location.rs @@ -1,7 +1,7 @@ use rustc_hir::LangItem; use rustc_middle::query::TyCtxtAt; use rustc_middle::ty::layout::LayoutOf; -use rustc_middle::ty::{self, Mutability}; +use rustc_middle::ty::{self}; use rustc_middle::{bug, mir}; use rustc_span::symbol::Symbol; use tracing::trace; @@ -20,12 +20,9 @@ fn alloc_caller_location<'tcx>( // This can fail if rustc runs out of memory right here. Trying to emit an error would be // pointless, since that would require allocating more memory than these short strings. let file = if loc_details.file { - ecx.allocate_str(filename.as_str(), MemoryKind::CallerLocation, Mutability::Not).unwrap() + ecx.allocate_str_dedup(filename.as_str()).unwrap() } else { - // FIXME: This creates a new allocation each time. It might be preferable to - // perform this allocation only once, and re-use the `MPlaceTy`. - // See https://github.com/rust-lang/rust/pull/89920#discussion_r730012398 - ecx.allocate_str("", MemoryKind::CallerLocation, Mutability::Not).unwrap() + ecx.allocate_str_dedup("").unwrap() }; let file = file.map_provenance(CtfeProvenance::as_immutable); let line = if loc_details.line { Scalar::from_u32(line) } else { Scalar::from_u32(0) }; diff --git a/compiler/rustc_middle/src/ty/context.rs b/compiler/rustc_middle/src/ty/context.rs index d4835bb07f6..2841470d248 100644 --- a/compiler/rustc_middle/src/ty/context.rs +++ b/compiler/rustc_middle/src/ty/context.rs @@ -1479,7 +1479,7 @@ impl<'tcx> TyCtxt<'tcx> { self.mk_adt_def_from_data(ty::AdtDefData::new(self, did, kind, variants, repr)) } - /// Allocates a read-only byte or string literal for `mir::interpret`. + /// Allocates a read-only byte or string literal for `mir::interpret` with alignment 1. /// Returns the same `AllocId` if called again with the same bytes. pub fn allocate_bytes_dedup(self, bytes: &[u8], salt: usize) -> interpret::AllocId { // Create an allocation that just contains these bytes. diff --git a/src/tools/miri/src/shims/backtrace.rs b/src/tools/miri/src/shims/backtrace.rs index 64bd546458d..c7b399228bf 100644 --- a/src/tools/miri/src/shims/backtrace.rs +++ b/src/tools/miri/src/shims/backtrace.rs @@ -1,5 +1,4 @@ use rustc_abi::{ExternAbi, Size}; -use rustc_ast::ast::Mutability; use rustc_middle::ty::layout::LayoutOf as _; use rustc_middle::ty::{self, Instance, Ty}; use rustc_span::{BytePos, Loc, Symbol, hygiene}; @@ -179,14 +178,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { match flags { 0 => { - // These are "mutable" allocations as we consider them to be owned by the callee. - let name_alloc = - this.allocate_str(&name, MiriMemoryKind::Rust.into(), Mutability::Mut)?; - let filename_alloc = - this.allocate_str(&filename, MiriMemoryKind::Rust.into(), Mutability::Mut)?; - - this.write_immediate(name_alloc.to_ref(this), &this.project_field(dest, 0)?)?; - this.write_immediate(filename_alloc.to_ref(this), &this.project_field(dest, 1)?)?; + throw_unsup_format!("miri_resolve_frame: v0 is not supported any more"); } 1 => { this.write_scalar( diff --git a/src/tools/miri/src/shims/panic.rs b/src/tools/miri/src/shims/panic.rs index 722c3a2f0c5..93479540009 100644 --- a/src/tools/miri/src/shims/panic.rs +++ b/src/tools/miri/src/shims/panic.rs @@ -12,7 +12,6 @@ //! metadata we remembered when pushing said frame. use rustc_abi::ExternAbi; -use rustc_ast::Mutability; use rustc_middle::{mir, ty}; use rustc_target::spec::PanicStrategy; @@ -161,7 +160,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { let this = self.eval_context_mut(); // First arg: message. - let msg = this.allocate_str(msg, MiriMemoryKind::Machine.into(), Mutability::Not)?; + let msg = this.allocate_str_dedup(msg)?; // Call the lang item. let panic = this.tcx.lang_items().panic_fn().unwrap(); @@ -180,7 +179,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { let this = self.eval_context_mut(); // First arg: message. - let msg = this.allocate_str(msg, MiriMemoryKind::Machine.into(), Mutability::Not)?; + let msg = this.allocate_str_dedup(msg)?; // Call the lang item. let panic = this.tcx.lang_items().panic_nounwind().unwrap(); diff --git a/src/tools/miri/tests/pass/backtrace/backtrace-api-v0.rs b/src/tools/miri/tests/pass/backtrace/backtrace-api-v0.rs deleted file mode 100644 index 3fff7921aff..00000000000 --- a/src/tools/miri/tests/pass/backtrace/backtrace-api-v0.rs +++ /dev/null @@ -1,69 +0,0 @@ -//@normalize-stderr-test: "::<.*>" -> "" - -#[inline(never)] -fn func_a() -> Box<[*mut ()]> { - func_b::() -} -#[inline(never)] -fn func_b() -> Box<[*mut ()]> { - func_c() -} - -macro_rules! invoke_func_d { - () => { - func_d() - }; -} - -#[inline(never)] -fn func_c() -> Box<[*mut ()]> { - invoke_func_d!() -} -#[inline(never)] -fn func_d() -> Box<[*mut ()]> { - unsafe { miri_get_backtrace(0) } -} - -fn main() { - let mut seen_main = false; - let frames = func_a(); - for frame in frames.iter() { - let miri_frame = unsafe { miri_resolve_frame(*frame, 0) }; - let name = String::from_utf8(miri_frame.name.into()).unwrap(); - let filename = String::from_utf8(miri_frame.filename.into()).unwrap(); - - if name == "func_a" { - assert_eq!(func_a as *mut (), miri_frame.fn_ptr); - } - - // Print every frame to stderr. - let out = format!("{}:{}:{} ({})", filename, miri_frame.lineno, miri_frame.colno, name); - eprintln!("{}", out); - // Print the 'main' frame (and everything before it) to stdout, skipping - // the printing of internal (and possibly fragile) libstd frames. - // Stdout is less normalized so we see more, but it also means we can print less - // as platform differences would lead to test suite failures. - if !seen_main { - println!("{}", out); - seen_main = name == "main"; - } - } -} - -// This goes at the bottom of the file so that we can change it -// without disturbing line numbers of the functions in the backtrace. - -extern "Rust" { - fn miri_get_backtrace(flags: u64) -> Box<[*mut ()]>; - fn miri_resolve_frame(ptr: *mut (), flags: u64) -> MiriFrame; -} - -#[derive(Debug)] -#[repr(C)] -struct MiriFrame { - name: Box<[u8]>, - filename: Box<[u8]>, - lineno: u32, - colno: u32, - fn_ptr: *mut (), -} diff --git a/src/tools/miri/tests/pass/backtrace/backtrace-api-v0.stderr b/src/tools/miri/tests/pass/backtrace/backtrace-api-v0.stderr deleted file mode 100644 index 9849a1aa74e..00000000000 --- a/src/tools/miri/tests/pass/backtrace/backtrace-api-v0.stderr +++ /dev/null @@ -1,18 +0,0 @@ -tests/pass/backtrace/backtrace-api-v0.rs:LL:CC (func_d) -tests/pass/backtrace/backtrace-api-v0.rs:LL:CC (func_c) -tests/pass/backtrace/backtrace-api-v0.rs:LL:CC (func_b) -tests/pass/backtrace/backtrace-api-v0.rs:LL:CC (func_a) -tests/pass/backtrace/backtrace-api-v0.rs:LL:CC (main) -RUSTLIB/core/src/ops/function.rs:LL:CC (>::call_once - shim(fn())) -RUSTLIB/std/src/sys/backtrace.rs:LL:CC (std::sys::backtrace::__rust_begin_short_backtrace) -RUSTLIB/std/src/rt.rs:LL:CC (std::rt::lang_start::{closure#0}) -RUSTLIB/core/src/ops/function.rs:LL:CC (std::ops::function::impls::call_once) -RUSTLIB/std/src/panicking.rs:LL:CC (std::panicking::r#try::do_call) -RUSTLIB/std/src/panicking.rs:LL:CC (std::panicking::r#try) -RUSTLIB/std/src/panic.rs:LL:CC (std::panic::catch_unwind) -RUSTLIB/std/src/rt.rs:LL:CC (std::rt::lang_start_internal::{closure#1}) -RUSTLIB/std/src/panicking.rs:LL:CC (std::panicking::r#try::do_call) -RUSTLIB/std/src/panicking.rs:LL:CC (std::panicking::r#try) -RUSTLIB/std/src/panic.rs:LL:CC (std::panic::catch_unwind) -RUSTLIB/std/src/rt.rs:LL:CC (std::rt::lang_start_internal) -RUSTLIB/std/src/rt.rs:LL:CC (std::rt::lang_start) diff --git a/src/tools/miri/tests/pass/backtrace/backtrace-api-v0.stdout b/src/tools/miri/tests/pass/backtrace/backtrace-api-v0.stdout deleted file mode 100644 index 8c1bc5c353e..00000000000 --- a/src/tools/miri/tests/pass/backtrace/backtrace-api-v0.stdout +++ /dev/null @@ -1,5 +0,0 @@ -tests/pass/backtrace/backtrace-api-v0.rs:24:14 (func_d) -tests/pass/backtrace/backtrace-api-v0.rs:14:9 (func_c) -tests/pass/backtrace/backtrace-api-v0.rs:9:5 (func_b::) -tests/pass/backtrace/backtrace-api-v0.rs:5:5 (func_a) -tests/pass/backtrace/backtrace-api-v0.rs:29:18 (main) -- cgit 1.4.1-3-g733a5 From a97404eee382141939459fb879cab84233d02d15 Mon Sep 17 00:00:00 2001 From: Eric Huss Date: Sun, 8 Dec 2024 12:09:58 -0800 Subject: Add test to check unicode identifier version --- compiler/rustc_lexer/src/lib.rs | 1 + compiler/rustc_parse/src/lib.rs | 1 + tests/ui-fulldeps/lexer/unicode-version.rs | 27 ++++++++++++++++++++++ tests/ui-fulldeps/lexer/unicode-version.run.stdout | 4 ++++ triagebot.toml | 7 ++++++ 5 files changed, 40 insertions(+) create mode 100644 tests/ui-fulldeps/lexer/unicode-version.rs create mode 100644 tests/ui-fulldeps/lexer/unicode-version.run.stdout diff --git a/compiler/rustc_lexer/src/lib.rs b/compiler/rustc_lexer/src/lib.rs index 6caeec1b5cc..aa4abf678b9 100644 --- a/compiler/rustc_lexer/src/lib.rs +++ b/compiler/rustc_lexer/src/lib.rs @@ -33,6 +33,7 @@ pub mod unescape; mod tests; use unicode_properties::UnicodeEmoji; +pub use unicode_xid::UNICODE_VERSION as UNICODE_XID_VERSION; use self::LiteralKind::*; use self::TokenKind::*; diff --git a/compiler/rustc_parse/src/lib.rs b/compiler/rustc_parse/src/lib.rs index 2792050a0b3..f963a424a7f 100644 --- a/compiler/rustc_parse/src/lib.rs +++ b/compiler/rustc_parse/src/lib.rs @@ -24,6 +24,7 @@ use rustc_data_structures::sync::Lrc; use rustc_errors::{Diag, FatalError, PResult}; use rustc_session::parse::ParseSess; use rustc_span::{FileName, SourceFile, Span}; +pub use unicode_normalization::UNICODE_VERSION as UNICODE_NORMALIZATION_VERSION; pub const MACRO_ARGUMENTS: Option<&str> = Some("macro arguments"); diff --git a/tests/ui-fulldeps/lexer/unicode-version.rs b/tests/ui-fulldeps/lexer/unicode-version.rs new file mode 100644 index 00000000000..cd02b952895 --- /dev/null +++ b/tests/ui-fulldeps/lexer/unicode-version.rs @@ -0,0 +1,27 @@ +// This test is used to validate which version of Unicode is used for parsing +// identifiers. If the Unicode version changes, it should also be updated in +// the reference at +// https://github.com/rust-lang/reference/blob/HEAD/src/identifiers.md. + +//@ run-pass +//@ check-run-results +//@ ignore-cross-compile +//@ reference: ident.unicode +//@ reference: ident.normalization + +#![feature(rustc_private)] + +extern crate rustc_driver; +extern crate rustc_lexer; +extern crate rustc_parse; + +fn main() { + println!("Checking if Unicode version changed."); + println!( + "If the Unicode version changes are intentional, \ + it should also be updated in the reference at \ + https://github.com/rust-lang/reference/blob/HEAD/src/identifiers.md." + ); + println!("Unicode XID version is: {:?}", rustc_lexer::UNICODE_XID_VERSION); + println!("Unicode normalization version is: {:?}", rustc_parse::UNICODE_NORMALIZATION_VERSION); +} diff --git a/tests/ui-fulldeps/lexer/unicode-version.run.stdout b/tests/ui-fulldeps/lexer/unicode-version.run.stdout new file mode 100644 index 00000000000..f32c8365cdf --- /dev/null +++ b/tests/ui-fulldeps/lexer/unicode-version.run.stdout @@ -0,0 +1,4 @@ +Checking if Unicode version changed. +If the Unicode version changes are intentional, it should also be updated in the reference at https://github.com/rust-lang/reference/blob/HEAD/src/identifiers.md. +Unicode XID version is: (16, 0, 0) +Unicode normalization version is: (16, 0, 0) diff --git a/triagebot.toml b/triagebot.toml index 4d6806711fb..e7c899d150b 100644 --- a/triagebot.toml +++ b/triagebot.toml @@ -991,6 +991,13 @@ cc = ["@Zalathar"] [mentions."src/tools/opt-dist"] cc = ["@kobzol"] +[mentions."tests/ui-fulldeps/lexer/unicode-version.run.stdout"] +message = """If the Unicode version changes are intentional, +it should also be updated in the reference at +https://github.com/rust-lang/reference/blob/HEAD/src/identifiers.md. +""" +cc = ["@ehuss"] + [assign] warn_non_default_branch = true contributing_url = "https://rustc-dev-guide.rust-lang.org/getting-started.html" -- cgit 1.4.1-3-g733a5 From 5404cbb9960c9aa15d104a658a94879237e5a845 Mon Sep 17 00:00:00 2001 From: Esteban Küber Date: Mon, 9 Dec 2024 17:16:14 +0000 Subject: Fix typo in RFC mention 3598 -> 3593 https://github.com/rust-lang/rfcs/blob/master/text/3593-unprefixed-guarded-strings.md --- compiler/rustc_parse/src/lexer/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/rustc_parse/src/lexer/mod.rs b/compiler/rustc_parse/src/lexer/mod.rs index d97f05dc7eb..2426eb81678 100644 --- a/compiler/rustc_parse/src/lexer/mod.rs +++ b/compiler/rustc_parse/src/lexer/mod.rs @@ -822,7 +822,7 @@ impl<'psess, 'src> Lexer<'psess, 'src> { /// Detect guarded string literal syntax /// - /// RFC 3598 reserved this syntax for future use. As of Rust 2024, + /// RFC 3593 reserved this syntax for future use. As of Rust 2024, /// using this syntax produces an error. In earlier editions, however, it /// only results in an (allowed by default) lint, and is treated as /// separate tokens. -- cgit 1.4.1-3-g733a5 From 2d71dd5a0f56bed87231ab223b80b64a99339371 Mon Sep 17 00:00:00 2001 From: Aarik Pokras <85502246+aarikpokras@users.noreply.github.com> Date: Sat, 7 Dec 2024 16:42:59 -0500 Subject: Grammar fixes --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 3690a9c93c5..d84d96a0e91 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ standard library, and documentation. ## Why Rust? -- **Performance:** Fast and memory-efficient, suitable for critical services, embedded devices, and easily integrate with other languages. +- **Performance:** Fast and memory-efficient, suitable for critical services, embedded devices, and easily integrated with other languages. - **Reliability:** Our rich type system and ownership model ensure memory and thread safety, reducing bugs at compile-time. -- cgit 1.4.1-3-g733a5