From 8a29c826fe000dc47f5b09adb13f027e813a4252 Mon Sep 17 00:00:00 2001 From: zedddie Date: Wed, 3 Jun 2026 02:31:08 +0200 Subject: [PATCH 1/4] move batch --- .../assoc-type-unsatisfied-bound.rs} | 0 .../assoc-type-unsatisfied-bound.stderr} | 0 tests/ui/{issues/issue-18845.rs => box/box-deref-match-arm.rs} | 0 .../auxiliary/inline-fn-with-trait-method-as-value.rs} | 0 .../inline-fn-with-trait-method-as-value.rs} | 0 .../{issues/issue-18919.rs => dst/dyn-fn-type-in-generic-enum.rs} | 0 .../issue-18919.stderr => dst/dyn-fn-type-in-generic-enum.stderr} | 0 .../dyn-incompatible-supertrait.rs} | 0 .../dyn-incompatible-supertrait.stderr} | 0 .../auxiliary/duplicate-rlib-crate-name-precedence-1.rs} | 0 .../auxiliary/duplicate-rlib-crate-name-precedence-2.rs} | 0 .../duplicate-rlib-crate-name-precedence.rs} | 0 .../issue-18859.rs => macros/module-path-in-nested-modules.rs} | 0 .../object/trait-object-with-send-supertrait.rs} | 0 .../auxiliary/cross-crate-generic-fn-in-closure.rs} | 0 .../cross-crate-generic-fn-in-closure.rs} | 0 .../impl-method-where-clause-resolution.rs} | 0 17 files changed, 0 insertions(+), 0 deletions(-) rename tests/ui/{issues/issue-18611.rs => associated-types/assoc-type-unsatisfied-bound.rs} (100%) rename tests/ui/{issues/issue-18611.stderr => associated-types/assoc-type-unsatisfied-bound.stderr} (100%) rename tests/ui/{issues/issue-18845.rs => box/box-deref-match-arm.rs} (100%) rename tests/ui/{issues/auxiliary/issue-18501.rs => cross-crate/auxiliary/inline-fn-with-trait-method-as-value.rs} (100%) rename tests/ui/{issues/issue-18501.rs => cross-crate/inline-fn-with-trait-method-as-value.rs} (100%) rename tests/ui/{issues/issue-18919.rs => dst/dyn-fn-type-in-generic-enum.rs} (100%) rename tests/ui/{issues/issue-18919.stderr => dst/dyn-fn-type-in-generic-enum.stderr} (100%) rename tests/ui/{issues/issue-18959.rs => dyn-compatibility/dyn-incompatible-supertrait.rs} (100%) rename tests/ui/{issues/issue-18959.stderr => dyn-compatibility/dyn-incompatible-supertrait.stderr} (100%) rename tests/ui/{issues/auxiliary/issue-18913-1.rs => linking/auxiliary/duplicate-rlib-crate-name-precedence-1.rs} (100%) rename tests/ui/{issues/auxiliary/issue-18913-2.rs => linking/auxiliary/duplicate-rlib-crate-name-precedence-2.rs} (100%) rename tests/ui/{issues/issue-18913.rs => linking/duplicate-rlib-crate-name-precedence.rs} (100%) rename tests/ui/{issues/issue-18859.rs => macros/module-path-in-nested-modules.rs} (100%) rename tests/ui/{issues/issue-18988.rs => traits/object/trait-object-with-send-supertrait.rs} (100%) rename tests/ui/{issues/auxiliary/issue-18711.rs => unboxed-closures/auxiliary/cross-crate-generic-fn-in-closure.rs} (100%) rename tests/ui/{issues/issue-18711.rs => unboxed-closures/cross-crate-generic-fn-in-closure.rs} (100%) rename tests/ui/{issues/issue-18906.rs => where-clauses/impl-method-where-clause-resolution.rs} (100%) diff --git a/tests/ui/issues/issue-18611.rs b/tests/ui/associated-types/assoc-type-unsatisfied-bound.rs similarity index 100% rename from tests/ui/issues/issue-18611.rs rename to tests/ui/associated-types/assoc-type-unsatisfied-bound.rs diff --git a/tests/ui/issues/issue-18611.stderr b/tests/ui/associated-types/assoc-type-unsatisfied-bound.stderr similarity index 100% rename from tests/ui/issues/issue-18611.stderr rename to tests/ui/associated-types/assoc-type-unsatisfied-bound.stderr diff --git a/tests/ui/issues/issue-18845.rs b/tests/ui/box/box-deref-match-arm.rs similarity index 100% rename from tests/ui/issues/issue-18845.rs rename to tests/ui/box/box-deref-match-arm.rs diff --git a/tests/ui/issues/auxiliary/issue-18501.rs b/tests/ui/cross-crate/auxiliary/inline-fn-with-trait-method-as-value.rs similarity index 100% rename from tests/ui/issues/auxiliary/issue-18501.rs rename to tests/ui/cross-crate/auxiliary/inline-fn-with-trait-method-as-value.rs diff --git a/tests/ui/issues/issue-18501.rs b/tests/ui/cross-crate/inline-fn-with-trait-method-as-value.rs similarity index 100% rename from tests/ui/issues/issue-18501.rs rename to tests/ui/cross-crate/inline-fn-with-trait-method-as-value.rs diff --git a/tests/ui/issues/issue-18919.rs b/tests/ui/dst/dyn-fn-type-in-generic-enum.rs similarity index 100% rename from tests/ui/issues/issue-18919.rs rename to tests/ui/dst/dyn-fn-type-in-generic-enum.rs diff --git a/tests/ui/issues/issue-18919.stderr b/tests/ui/dst/dyn-fn-type-in-generic-enum.stderr similarity index 100% rename from tests/ui/issues/issue-18919.stderr rename to tests/ui/dst/dyn-fn-type-in-generic-enum.stderr diff --git a/tests/ui/issues/issue-18959.rs b/tests/ui/dyn-compatibility/dyn-incompatible-supertrait.rs similarity index 100% rename from tests/ui/issues/issue-18959.rs rename to tests/ui/dyn-compatibility/dyn-incompatible-supertrait.rs diff --git a/tests/ui/issues/issue-18959.stderr b/tests/ui/dyn-compatibility/dyn-incompatible-supertrait.stderr similarity index 100% rename from tests/ui/issues/issue-18959.stderr rename to tests/ui/dyn-compatibility/dyn-incompatible-supertrait.stderr diff --git a/tests/ui/issues/auxiliary/issue-18913-1.rs b/tests/ui/linking/auxiliary/duplicate-rlib-crate-name-precedence-1.rs similarity index 100% rename from tests/ui/issues/auxiliary/issue-18913-1.rs rename to tests/ui/linking/auxiliary/duplicate-rlib-crate-name-precedence-1.rs diff --git a/tests/ui/issues/auxiliary/issue-18913-2.rs b/tests/ui/linking/auxiliary/duplicate-rlib-crate-name-precedence-2.rs similarity index 100% rename from tests/ui/issues/auxiliary/issue-18913-2.rs rename to tests/ui/linking/auxiliary/duplicate-rlib-crate-name-precedence-2.rs diff --git a/tests/ui/issues/issue-18913.rs b/tests/ui/linking/duplicate-rlib-crate-name-precedence.rs similarity index 100% rename from tests/ui/issues/issue-18913.rs rename to tests/ui/linking/duplicate-rlib-crate-name-precedence.rs diff --git a/tests/ui/issues/issue-18859.rs b/tests/ui/macros/module-path-in-nested-modules.rs similarity index 100% rename from tests/ui/issues/issue-18859.rs rename to tests/ui/macros/module-path-in-nested-modules.rs diff --git a/tests/ui/issues/issue-18988.rs b/tests/ui/traits/object/trait-object-with-send-supertrait.rs similarity index 100% rename from tests/ui/issues/issue-18988.rs rename to tests/ui/traits/object/trait-object-with-send-supertrait.rs diff --git a/tests/ui/issues/auxiliary/issue-18711.rs b/tests/ui/unboxed-closures/auxiliary/cross-crate-generic-fn-in-closure.rs similarity index 100% rename from tests/ui/issues/auxiliary/issue-18711.rs rename to tests/ui/unboxed-closures/auxiliary/cross-crate-generic-fn-in-closure.rs diff --git a/tests/ui/issues/issue-18711.rs b/tests/ui/unboxed-closures/cross-crate-generic-fn-in-closure.rs similarity index 100% rename from tests/ui/issues/issue-18711.rs rename to tests/ui/unboxed-closures/cross-crate-generic-fn-in-closure.rs diff --git a/tests/ui/issues/issue-18906.rs b/tests/ui/where-clauses/impl-method-where-clause-resolution.rs similarity index 100% rename from tests/ui/issues/issue-18906.rs rename to tests/ui/where-clauses/impl-method-where-clause-resolution.rs From b972e77b789b4a825ca301d8ac5d8f1bca9e9149 Mon Sep 17 00:00:00 2001 From: zedddie Date: Wed, 3 Jun 2026 02:40:54 +0200 Subject: [PATCH 2/4] bless batch --- .../assoc-type-unsatisfied-bound.rs | 2 ++ .../assoc-type-unsatisfied-bound.stderr | 8 ++++---- tests/ui/box/box-deref-match-arm.rs | 11 +++++++---- .../inline-fn-with-trait-method-as-value.rs | 2 ++ .../inline-fn-with-trait-method-as-value.rs | 13 ++++++++----- tests/ui/dst/dyn-fn-type-in-generic-enum.rs | 2 ++ tests/ui/dst/dyn-fn-type-in-generic-enum.stderr | 6 +++--- .../dyn-incompatible-supertrait.rs | 2 ++ .../dyn-incompatible-supertrait.stderr | 12 ++++++------ .../duplicate-rlib-crate-name-precedence-1.rs | 2 ++ .../duplicate-rlib-crate-name-precedence-2.rs | 2 ++ .../linking/duplicate-rlib-crate-name-precedence.rs | 6 ++++-- tests/ui/macros/module-path-in-nested-modules.rs | 6 ++++-- .../object/trait-object-with-send-supertrait.rs | 2 ++ .../auxiliary/cross-crate-generic-fn-in-closure.rs | 2 ++ .../cross-crate-generic-fn-in-closure.rs | 11 ++++++----- .../impl-method-where-clause-resolution.rs | 2 ++ 17 files changed, 60 insertions(+), 31 deletions(-) diff --git a/tests/ui/associated-types/assoc-type-unsatisfied-bound.rs b/tests/ui/associated-types/assoc-type-unsatisfied-bound.rs index 57da57d83537c..76a93eed7b663 100644 --- a/tests/ui/associated-types/assoc-type-unsatisfied-bound.rs +++ b/tests/ui/associated-types/assoc-type-unsatisfied-bound.rs @@ -1,3 +1,5 @@ +//! Regression test for . + fn add_state(op: ::State) { //~^ ERROR `isize: HasState` is not satisfied //~| ERROR `isize: HasState` is not satisfied diff --git a/tests/ui/associated-types/assoc-type-unsatisfied-bound.stderr b/tests/ui/associated-types/assoc-type-unsatisfied-bound.stderr index 4fa699de63527..3e318fcac503a 100644 --- a/tests/ui/associated-types/assoc-type-unsatisfied-bound.stderr +++ b/tests/ui/associated-types/assoc-type-unsatisfied-bound.stderr @@ -1,23 +1,23 @@ error[E0277]: the trait bound `isize: HasState` is not satisfied - --> $DIR/issue-18611.rs:1:18 + --> $DIR/assoc-type-unsatisfied-bound.rs:3:18 | LL | fn add_state(op: ::State) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `HasState` is not implemented for `isize` | help: this trait has no implementations, consider adding one - --> $DIR/issue-18611.rs:6:1 + --> $DIR/assoc-type-unsatisfied-bound.rs:8:1 | LL | trait HasState { | ^^^^^^^^^^^^^^ error[E0277]: the trait bound `isize: HasState` is not satisfied - --> $DIR/issue-18611.rs:1:18 + --> $DIR/assoc-type-unsatisfied-bound.rs:3:18 | LL | fn add_state(op: ::State) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `HasState` is not implemented for `isize` | help: this trait has no implementations, consider adding one - --> $DIR/issue-18611.rs:6:1 + --> $DIR/assoc-type-unsatisfied-bound.rs:8:1 | LL | trait HasState { | ^^^^^^^^^^^^^^ diff --git a/tests/ui/box/box-deref-match-arm.rs b/tests/ui/box/box-deref-match-arm.rs index c9dc175b10a8a..621a577afa580 100644 --- a/tests/ui/box/box-deref-match-arm.rs +++ b/tests/ui/box/box-deref-match-arm.rs @@ -1,8 +1,11 @@ +//! Regression test for . +//! +//! This used to generate invalid IR in that even if we took the +//! `false` branch we'd still try to free the Box from the other +//! arm. This was due to treating `*Box::new(9)` as an rvalue datum +//! instead of as a place. + //@ run-pass -// This used to generate invalid IR in that even if we took the -// `false` branch we'd still try to free the Box from the other -// arm. This was due to treating `*Box::new(9)` as an rvalue datum -// instead of as a place. fn test(foo: bool) -> u8 { match foo { diff --git a/tests/ui/cross-crate/auxiliary/inline-fn-with-trait-method-as-value.rs b/tests/ui/cross-crate/auxiliary/inline-fn-with-trait-method-as-value.rs index dd914b464fa58..dd90b4a082331 100644 --- a/tests/ui/cross-crate/auxiliary/inline-fn-with-trait-method-as-value.rs +++ b/tests/ui/cross-crate/auxiliary/inline-fn-with-trait-method-as-value.rs @@ -1,3 +1,5 @@ +//! Auxiliary crate for . + #![crate_type = "rlib"] struct Foo; diff --git a/tests/ui/cross-crate/inline-fn-with-trait-method-as-value.rs b/tests/ui/cross-crate/inline-fn-with-trait-method-as-value.rs index 54e53e434c465..7c68f29352493 100644 --- a/tests/ui/cross-crate/inline-fn-with-trait-method-as-value.rs +++ b/tests/ui/cross-crate/inline-fn-with-trait-method-as-value.rs @@ -1,11 +1,14 @@ +//! Regression test for . +//! +//! Test that we don't ICE when inlining a function from another +//! crate that uses a trait method as a value due to incorrectly +//! translating the def ID of the trait during AST decoding. + //@ run-pass -// Test that we don't ICE when inlining a function from another -// crate that uses a trait method as a value due to incorrectly -// translating the def ID of the trait during AST decoding. -//@ aux-build:issue-18501.rs +//@ aux-build:inline-fn-with-trait-method-as-value.rs -extern crate issue_18501 as issue; +extern crate inline_fn_with_trait_method_as_value as issue; fn main() { issue::pass_method(); diff --git a/tests/ui/dst/dyn-fn-type-in-generic-enum.rs b/tests/ui/dst/dyn-fn-type-in-generic-enum.rs index f06771e9ea59d..a4d07b01007dc 100644 --- a/tests/ui/dst/dyn-fn-type-in-generic-enum.rs +++ b/tests/ui/dst/dyn-fn-type-in-generic-enum.rs @@ -1,3 +1,5 @@ +//! Regression test for . + type FuncType<'f> = dyn Fn(&isize) -> isize + 'f; fn ho_func(f: Option) { diff --git a/tests/ui/dst/dyn-fn-type-in-generic-enum.stderr b/tests/ui/dst/dyn-fn-type-in-generic-enum.stderr index 714b6d7d86be3..dc672399e6800 100644 --- a/tests/ui/dst/dyn-fn-type-in-generic-enum.stderr +++ b/tests/ui/dst/dyn-fn-type-in-generic-enum.stderr @@ -1,17 +1,17 @@ error[E0277]: the size for values of type `dyn for<'a> Fn(&'a isize) -> isize` cannot be known at compilation time - --> $DIR/issue-18919.rs:3:15 + --> $DIR/dyn-fn-type-in-generic-enum.rs:5:15 | LL | fn ho_func(f: Option) { | ^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `dyn for<'a> Fn(&'a isize) -> isize` note: required by an implicit `Sized` bound in `Option` - --> $DIR/issue-18919.rs:7:13 + --> $DIR/dyn-fn-type-in-generic-enum.rs:9:13 | LL | enum Option { | ^ required by the implicit `Sized` requirement on this type parameter in `Option` help: you could relax the implicit `Sized` bound on `T` if it were used through indirection like `&T` or `Box` - --> $DIR/issue-18919.rs:7:13 + --> $DIR/dyn-fn-type-in-generic-enum.rs:9:13 | LL | enum Option { | ^ this could be changed to `T: ?Sized`... diff --git a/tests/ui/dyn-compatibility/dyn-incompatible-supertrait.rs b/tests/ui/dyn-compatibility/dyn-incompatible-supertrait.rs index 415fe818f5308..90a30e7920544 100644 --- a/tests/ui/dyn-compatibility/dyn-incompatible-supertrait.rs +++ b/tests/ui/dyn-compatibility/dyn-incompatible-supertrait.rs @@ -1,3 +1,5 @@ +//! Regression test for . + pub trait Foo { fn foo(&self, ext_thing: &T); } pub trait Bar: Foo { } impl Bar for T { } diff --git a/tests/ui/dyn-compatibility/dyn-incompatible-supertrait.stderr b/tests/ui/dyn-compatibility/dyn-incompatible-supertrait.stderr index df47d50a01979..34f1ed729c135 100644 --- a/tests/ui/dyn-compatibility/dyn-incompatible-supertrait.stderr +++ b/tests/ui/dyn-compatibility/dyn-incompatible-supertrait.stderr @@ -1,12 +1,12 @@ error[E0038]: the trait `Bar` is not dyn compatible - --> $DIR/issue-18959.rs:11:12 + --> $DIR/dyn-incompatible-supertrait.rs:13:12 | LL | fn foo(b: &dyn Bar) { | ^^^^^^^ `Bar` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable for more information, visit - --> $DIR/issue-18959.rs:1:20 + --> $DIR/dyn-incompatible-supertrait.rs:3:20 | LL | pub trait Foo { fn foo(&self, ext_thing: &T); } | ^^^ ...because method `foo` has generic type parameters @@ -15,14 +15,14 @@ LL | pub trait Bar: Foo { } = help: consider moving `foo` to another trait error[E0038]: the trait `Bar` is not dyn compatible - --> $DIR/issue-18959.rs:18:20 + --> $DIR/dyn-incompatible-supertrait.rs:20:20 | LL | let test: &dyn Bar = &mut thing; | ^^^ `Bar` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable for more information, visit - --> $DIR/issue-18959.rs:1:20 + --> $DIR/dyn-incompatible-supertrait.rs:3:20 | LL | pub trait Foo { fn foo(&self, ext_thing: &T); } | ^^^ ...because method `foo` has generic type parameters @@ -31,14 +31,14 @@ LL | pub trait Bar: Foo { } = help: consider moving `foo` to another trait error[E0038]: the trait `Bar` is not dyn compatible - --> $DIR/issue-18959.rs:20:9 + --> $DIR/dyn-incompatible-supertrait.rs:22:9 | LL | foo(test); | ^^^^ `Bar` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable for more information, visit - --> $DIR/issue-18959.rs:1:20 + --> $DIR/dyn-incompatible-supertrait.rs:3:20 | LL | pub trait Foo { fn foo(&self, ext_thing: &T); } | ^^^ ...because method `foo` has generic type parameters diff --git a/tests/ui/linking/auxiliary/duplicate-rlib-crate-name-precedence-1.rs b/tests/ui/linking/auxiliary/duplicate-rlib-crate-name-precedence-1.rs index caa2c707b560d..7b2bfbba12e6e 100644 --- a/tests/ui/linking/auxiliary/duplicate-rlib-crate-name-precedence-1.rs +++ b/tests/ui/linking/auxiliary/duplicate-rlib-crate-name-precedence-1.rs @@ -1,3 +1,5 @@ +//! Auxiliary crate for . + //@ no-prefer-dynamic #![crate_type = "rlib"] diff --git a/tests/ui/linking/auxiliary/duplicate-rlib-crate-name-precedence-2.rs b/tests/ui/linking/auxiliary/duplicate-rlib-crate-name-precedence-2.rs index 802f5ab3899bb..fc0d3d6ea4283 100644 --- a/tests/ui/linking/auxiliary/duplicate-rlib-crate-name-precedence-2.rs +++ b/tests/ui/linking/auxiliary/duplicate-rlib-crate-name-precedence-2.rs @@ -1,3 +1,5 @@ +//! Auxiliary crate for . + //@ no-prefer-dynamic #![crate_type = "rlib"] diff --git a/tests/ui/linking/duplicate-rlib-crate-name-precedence.rs b/tests/ui/linking/duplicate-rlib-crate-name-precedence.rs index 7f9137d95c24f..5131df3903423 100644 --- a/tests/ui/linking/duplicate-rlib-crate-name-precedence.rs +++ b/tests/ui/linking/duplicate-rlib-crate-name-precedence.rs @@ -1,6 +1,8 @@ +//! Regression test for . + //@ run-pass -//@ aux-build:issue-18913-1.rs -//@ aux-build:issue-18913-2.rs +//@ aux-build:duplicate-rlib-crate-name-precedence-1.rs +//@ aux-build:duplicate-rlib-crate-name-precedence-2.rs extern crate foo; diff --git a/tests/ui/macros/module-path-in-nested-modules.rs b/tests/ui/macros/module-path-in-nested-modules.rs index 854b7ed62f05b..601599e92943e 100644 --- a/tests/ui/macros/module-path-in-nested-modules.rs +++ b/tests/ui/macros/module-path-in-nested-modules.rs @@ -1,3 +1,5 @@ +//! Regression test for . + //@ run-pass mod foo { @@ -11,6 +13,6 @@ mod foo { } fn main() { - assert_eq!(module_path!(), "issue_18859"); - assert_eq!(foo::bar::baz::name(), "issue_18859::foo::bar::baz"); + assert_eq!(module_path!(), "module_path_in_nested_modules"); + assert_eq!(foo::bar::baz::name(), "module_path_in_nested_modules::foo::bar::baz"); } diff --git a/tests/ui/traits/object/trait-object-with-send-supertrait.rs b/tests/ui/traits/object/trait-object-with-send-supertrait.rs index 9dffe5640809a..cbdc8693708c9 100644 --- a/tests/ui/traits/object/trait-object-with-send-supertrait.rs +++ b/tests/ui/traits/object/trait-object-with-send-supertrait.rs @@ -1,3 +1,5 @@ +//! Regression test for . + //@ check-pass #![allow(dead_code)] pub trait Foo : Send { } diff --git a/tests/ui/unboxed-closures/auxiliary/cross-crate-generic-fn-in-closure.rs b/tests/ui/unboxed-closures/auxiliary/cross-crate-generic-fn-in-closure.rs index 5cb1f9c43718e..06cd968caff1e 100644 --- a/tests/ui/unboxed-closures/auxiliary/cross-crate-generic-fn-in-closure.rs +++ b/tests/ui/unboxed-closures/auxiliary/cross-crate-generic-fn-in-closure.rs @@ -1,3 +1,5 @@ +//! Auxiliary crate for . + #![crate_type = "rlib"] pub fn inner(f: F) -> F { diff --git a/tests/ui/unboxed-closures/cross-crate-generic-fn-in-closure.rs b/tests/ui/unboxed-closures/cross-crate-generic-fn-in-closure.rs index 1d5e3349a6d42..5c943721103e6 100644 --- a/tests/ui/unboxed-closures/cross-crate-generic-fn-in-closure.rs +++ b/tests/ui/unboxed-closures/cross-crate-generic-fn-in-closure.rs @@ -1,10 +1,11 @@ -//@ run-pass -// Test that we don't panic on a RefCell borrow conflict in certain -// code paths involving unboxed closures. +//! Regression test for . +//! Test that we don't panic on a RefCell borrow conflict in certain +//! code paths involving unboxed closures. +//@ run-pass -//@ aux-build:issue-18711.rs -extern crate issue_18711 as issue; +//@ aux-build:cross-crate-generic-fn-in-closure.rs +extern crate cross_crate_generic_fn_in_closure as issue; fn main() { (|| issue::inner(()))(); diff --git a/tests/ui/where-clauses/impl-method-where-clause-resolution.rs b/tests/ui/where-clauses/impl-method-where-clause-resolution.rs index 84b0f5a178825..af2bf63ad106a 100644 --- a/tests/ui/where-clauses/impl-method-where-clause-resolution.rs +++ b/tests/ui/where-clauses/impl-method-where-clause-resolution.rs @@ -1,3 +1,5 @@ +//! Regression test for . + //@ check-pass #![allow(dead_code)] From e63c09fa47c89a45e6194d68db040460a310cc78 Mon Sep 17 00:00:00 2001 From: Luca Versari Date: Tue, 2 Jun 2026 11:41:43 +0200 Subject: [PATCH 3/4] Add more tests for the `optimize` attribute --- tests/ui/attributes/malformed-attrs.rs | 4 + tests/ui/attributes/malformed-attrs.stderr | 178 +++++++++++++-------- tests/ui/attributes/optimize.rs | 22 +++ tests/ui/attributes/optimize.stderr | 34 +++- 4 files changed, 168 insertions(+), 70 deletions(-) diff --git a/tests/ui/attributes/malformed-attrs.rs b/tests/ui/attributes/malformed-attrs.rs index 5823ea81bc7bd..084697f3a5d88 100644 --- a/tests/ui/attributes/malformed-attrs.rs +++ b/tests/ui/attributes/malformed-attrs.rs @@ -54,6 +54,10 @@ //~^ ERROR malformed #[optimize] //~^ ERROR malformed +#[optimize(none, none)] +//~^ ERROR malformed +#[optimize(none, speed)] +//~^ ERROR malformed #[cold = 1] //~^ ERROR malformed #[must_use()] diff --git a/tests/ui/attributes/malformed-attrs.stderr b/tests/ui/attributes/malformed-attrs.stderr index 9d82a84a45d4f..7d8bd3700d4bb 100644 --- a/tests/ui/attributes/malformed-attrs.stderr +++ b/tests/ui/attributes/malformed-attrs.stderr @@ -1,5 +1,5 @@ error[E0539]: malformed `cfg` attribute input - --> $DIR/malformed-attrs.rs:105:1 + --> $DIR/malformed-attrs.rs:109:1 | LL | #[cfg] | ^^^^^^ expected this to be a list @@ -11,7 +11,7 @@ LL | #[cfg(predicate)] | +++++++++++ error[E0539]: malformed `cfg_attr` attribute input - --> $DIR/malformed-attrs.rs:107:1 + --> $DIR/malformed-attrs.rs:111:1 | LL | #[cfg_attr] | ^^^^^^^^^^^ expected this to be a list @@ -23,13 +23,13 @@ LL | #[cfg_attr(predicate, attr1, attr2, ...)] | ++++++++++++++++++++++++++++++ error[E0463]: can't find crate for `wloop` - --> $DIR/malformed-attrs.rs:209:1 + --> $DIR/malformed-attrs.rs:213:1 | LL | extern crate wloop; | ^^^^^^^^^^^^^^^^^^^ can't find crate error: malformed `allow` attribute input - --> $DIR/malformed-attrs.rs:175:1 + --> $DIR/malformed-attrs.rs:179:1 | LL | #[allow] | ^^^^^^^^ @@ -45,7 +45,7 @@ LL | #[allow(lint1, lint2, lint3, reason = "...")] | +++++++++++++++++++++++++++++++++++++ error: malformed `expect` attribute input - --> $DIR/malformed-attrs.rs:177:1 + --> $DIR/malformed-attrs.rs:181:1 | LL | #[expect] | ^^^^^^^^^ @@ -61,7 +61,7 @@ LL | #[expect(lint1, lint2, lint3, reason = "...")] | +++++++++++++++++++++++++++++++++++++ error: malformed `warn` attribute input - --> $DIR/malformed-attrs.rs:179:1 + --> $DIR/malformed-attrs.rs:183:1 | LL | #[warn] | ^^^^^^^ @@ -77,7 +77,7 @@ LL | #[warn(lint1, lint2, lint3, reason = "...")] | +++++++++++++++++++++++++++++++++++++ error: malformed `deny` attribute input - --> $DIR/malformed-attrs.rs:181:1 + --> $DIR/malformed-attrs.rs:185:1 | LL | #[deny] | ^^^^^^^ @@ -93,7 +93,7 @@ LL | #[deny(lint1, lint2, lint3, reason = "...")] | +++++++++++++++++++++++++++++++++++++ error: malformed `forbid` attribute input - --> $DIR/malformed-attrs.rs:183:1 + --> $DIR/malformed-attrs.rs:187:1 | LL | #[forbid] | ^^^^^^^^^ @@ -109,19 +109,19 @@ LL | #[forbid(lint1, lint2, lint3, reason = "...")] | +++++++++++++++++++++++++++++++++++++ error: the `#[proc_macro]` attribute is only usable with crates of the `proc-macro` crate type - --> $DIR/malformed-attrs.rs:102:1 + --> $DIR/malformed-attrs.rs:106:1 | LL | #[proc_macro = 18] | ^^^^^^^^^^^^^^^^^^ error: the `#[proc_macro_attribute]` attribute is only usable with crates of the `proc-macro` crate type - --> $DIR/malformed-attrs.rs:119:1 + --> $DIR/malformed-attrs.rs:123:1 | LL | #[proc_macro_attribute = 19] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: the `#[proc_macro_derive]` attribute is only usable with crates of the `proc-macro` crate type - --> $DIR/malformed-attrs.rs:126:1 + --> $DIR/malformed-attrs.rs:130:1 | LL | #[proc_macro_derive] | ^^^^^^^^^^^^^^^^^^^^ @@ -263,9 +263,49 @@ LL | #[optimize(size)] LL | #[optimize(speed)] | +++++++ -error[E0565]: malformed `cold` attribute input +error[E0805]: malformed `optimize` attribute input --> $DIR/malformed-attrs.rs:57:1 | +LL | #[optimize(none, none)] + | ^^^^^^^^^^------------^ + | | + | expected a single argument here + | +help: try changing it to one of the following valid forms of the attribute + | +LL - #[optimize(none, none)] +LL + #[optimize(none)] + | +LL - #[optimize(none, none)] +LL + #[optimize(size)] + | +LL - #[optimize(none, none)] +LL + #[optimize(speed)] + | + +error[E0805]: malformed `optimize` attribute input + --> $DIR/malformed-attrs.rs:59:1 + | +LL | #[optimize(none, speed)] + | ^^^^^^^^^^-------------^ + | | + | expected a single argument here + | +help: try changing it to one of the following valid forms of the attribute + | +LL - #[optimize(none, speed)] +LL + #[optimize(none)] + | +LL - #[optimize(none, speed)] +LL + #[optimize(size)] + | +LL - #[optimize(none, speed)] +LL + #[optimize(speed)] + | + +error[E0565]: malformed `cold` attribute input + --> $DIR/malformed-attrs.rs:61:1 + | LL | #[cold = 1] | ^^^^^^^---^ | | @@ -278,7 +318,7 @@ LL + #[cold] | error[E0539]: malformed `must_use` attribute input - --> $DIR/malformed-attrs.rs:59:1 + --> $DIR/malformed-attrs.rs:63:1 | LL | #[must_use()] | ^^^^^^^^^^--^ @@ -296,7 +336,7 @@ LL + #[must_use] | error[E0565]: malformed `no_mangle` attribute input - --> $DIR/malformed-attrs.rs:61:1 + --> $DIR/malformed-attrs.rs:65:1 | LL | #[no_mangle = 1] | ^^^^^^^^^^^^---^ @@ -310,7 +350,7 @@ LL + #[no_mangle] | error[E0565]: malformed `naked` attribute input - --> $DIR/malformed-attrs.rs:63:1 + --> $DIR/malformed-attrs.rs:67:1 | LL | #[unsafe(naked())] | ^^^^^^^^^^^^^^--^^ @@ -324,7 +364,7 @@ LL + #[unsafe(naked)] | error[E0565]: malformed `track_caller` attribute input - --> $DIR/malformed-attrs.rs:65:1 + --> $DIR/malformed-attrs.rs:69:1 | LL | #[track_caller()] | ^^^^^^^^^^^^^^--^ @@ -338,7 +378,7 @@ LL + #[track_caller] | error[E0539]: malformed `export_name` attribute input - --> $DIR/malformed-attrs.rs:67:1 + --> $DIR/malformed-attrs.rs:71:1 | LL | #[export_name()] | ^^^^^^^^^^^^^^^^ @@ -350,7 +390,7 @@ LL + #[export_name = "name"] | error[E0805]: malformed `used` attribute input - --> $DIR/malformed-attrs.rs:69:1 + --> $DIR/malformed-attrs.rs:73:1 | LL | #[used()] | ^^^^^^--^ @@ -368,7 +408,7 @@ LL + #[used] | error: `#[used]` attribute cannot be used on functions - --> $DIR/malformed-attrs.rs:69:1 + --> $DIR/malformed-attrs.rs:73:1 | LL | #[used()] | ^^^^^^^^^ @@ -376,7 +416,7 @@ LL | #[used()] = help: `#[used]` can only be applied to statics error[E0539]: malformed `crate_name` attribute input - --> $DIR/malformed-attrs.rs:72:1 + --> $DIR/malformed-attrs.rs:76:1 | LL | #[crate_name] | ^^^^^^^^^^^^^ @@ -387,7 +427,7 @@ LL | #[crate_name = "name"] | ++++++++ error[E0539]: malformed `target_feature` attribute input - --> $DIR/malformed-attrs.rs:77:1 + --> $DIR/malformed-attrs.rs:81:1 | LL | #[target_feature] | ^^^^^^^^^^^^^^^^^ expected this to be a list @@ -398,7 +438,7 @@ LL | #[target_feature(enable = "feat1, feat2")] | +++++++++++++++++++++++++ error[E0565]: malformed `export_stable` attribute input - --> $DIR/malformed-attrs.rs:79:1 + --> $DIR/malformed-attrs.rs:83:1 | LL | #[export_stable = 1] | ^^^^^^^^^^^^^^^^---^ @@ -412,7 +452,7 @@ LL + #[export_stable] | error[E0539]: malformed `link` attribute input - --> $DIR/malformed-attrs.rs:81:1 + --> $DIR/malformed-attrs.rs:85:1 | LL | #[link] | ^^^^^^^ expected this to be a list @@ -420,7 +460,7 @@ LL | #[link] = note: for more information, visit error[E0539]: malformed `link_name` attribute input - --> $DIR/malformed-attrs.rs:85:1 + --> $DIR/malformed-attrs.rs:89:1 | LL | #[link_name] | ^^^^^^^^^^^^ @@ -432,7 +472,7 @@ LL | #[link_name = "name"] | ++++++++ error[E0539]: malformed `link_section` attribute input - --> $DIR/malformed-attrs.rs:89:1 + --> $DIR/malformed-attrs.rs:93:1 | LL | #[link_section] | ^^^^^^^^^^^^^^^ @@ -444,7 +484,7 @@ LL | #[link_section = "name"] | ++++++++ error[E0539]: malformed `coverage` attribute input - --> $DIR/malformed-attrs.rs:91:1 + --> $DIR/malformed-attrs.rs:95:1 | LL | #[coverage] | ^^^^^^^^^^^ expected this to be a list @@ -457,13 +497,13 @@ LL | #[coverage(on)] | ++++ error[E0539]: malformed `sanitize` attribute input - --> $DIR/malformed-attrs.rs:93:1 + --> $DIR/malformed-attrs.rs:97:1 | LL | #[sanitize] | ^^^^^^^^^^^ expected this to be a list error[E0565]: malformed `no_implicit_prelude` attribute input - --> $DIR/malformed-attrs.rs:98:1 + --> $DIR/malformed-attrs.rs:102:1 | LL | #[no_implicit_prelude = 23] | ^^^^^^^^^^^^^^^^^^^^^^----^ @@ -477,7 +517,7 @@ LL + #[no_implicit_prelude] | error[E0565]: malformed `proc_macro` attribute input - --> $DIR/malformed-attrs.rs:102:1 + --> $DIR/malformed-attrs.rs:106:1 | LL | #[proc_macro = 18] | ^^^^^^^^^^^^^----^ @@ -491,7 +531,7 @@ LL + #[proc_macro] | error[E0539]: malformed `instruction_set` attribute input - --> $DIR/malformed-attrs.rs:109:1 + --> $DIR/malformed-attrs.rs:113:1 | LL | #[instruction_set] | ^^^^^^^^^^^^^^^^^^ expected this to be a list @@ -503,7 +543,7 @@ LL | #[instruction_set(set)] | +++++ error[E0539]: malformed `patchable_function_entry` attribute input - --> $DIR/malformed-attrs.rs:111:1 + --> $DIR/malformed-attrs.rs:115:1 | LL | #[patchable_function_entry] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected this to be a list @@ -514,7 +554,7 @@ LL | #[patchable_function_entry(prefix_nops = m, entry_nops = n)] | +++++++++++++++++++++++++++++++++ error[E0565]: malformed `coroutine` attribute input - --> $DIR/malformed-attrs.rs:114:5 + --> $DIR/malformed-attrs.rs:118:5 | LL | #[coroutine = 63] || {} | ^^^^^^^^^^^^----^ @@ -528,7 +568,7 @@ LL + #[coroutine] || {} | error[E0565]: malformed `proc_macro_attribute` attribute input - --> $DIR/malformed-attrs.rs:119:1 + --> $DIR/malformed-attrs.rs:123:1 | LL | #[proc_macro_attribute = 19] | ^^^^^^^^^^^^^^^^^^^^^^^----^ @@ -542,7 +582,7 @@ LL + #[proc_macro_attribute] | error[E0539]: malformed `must_use` attribute input - --> $DIR/malformed-attrs.rs:122:1 + --> $DIR/malformed-attrs.rs:126:1 | LL | #[must_use = 1] | ^^^^^^^^^^^^^-^ @@ -560,7 +600,7 @@ LL + #[must_use] | error[E0539]: malformed `proc_macro_derive` attribute input - --> $DIR/malformed-attrs.rs:126:1 + --> $DIR/malformed-attrs.rs:130:1 | LL | #[proc_macro_derive] | ^^^^^^^^^^^^^^^^^^^^ expected this to be a list @@ -574,7 +614,7 @@ LL | #[proc_macro_derive(TraitName, attributes(name1, name2, ...))] | ++++++++++++++++++++++++++++++++++++++++++ error[E0539]: malformed `must_not_suspend` attribute input - --> $DIR/malformed-attrs.rs:131:1 + --> $DIR/malformed-attrs.rs:135:1 | LL | #[must_not_suspend()] | ^^^^^^^^^^^^^^^^^^--^ @@ -590,7 +630,7 @@ LL + #[must_not_suspend] | error[E0539]: malformed `cfi_encoding` attribute input - --> $DIR/malformed-attrs.rs:133:1 + --> $DIR/malformed-attrs.rs:137:1 | LL | #[cfi_encoding = ""] | ^^^^^^^^^^^^^^^^^--^ @@ -603,7 +643,7 @@ LL | #[cfi_encoding = "encoding"] | ++++++++ error[E0565]: malformed `marker` attribute input - --> $DIR/malformed-attrs.rs:152:1 + --> $DIR/malformed-attrs.rs:156:1 | LL | #[marker = 3] | ^^^^^^^^^---^ @@ -617,7 +657,7 @@ LL + #[marker] | error[E0565]: malformed `fundamental` attribute input - --> $DIR/malformed-attrs.rs:154:1 + --> $DIR/malformed-attrs.rs:158:1 | LL | #[fundamental()] | ^^^^^^^^^^^^^--^ @@ -631,7 +671,7 @@ LL + #[fundamental] | error[E0565]: malformed `ffi_pure` attribute input - --> $DIR/malformed-attrs.rs:162:5 + --> $DIR/malformed-attrs.rs:166:5 | LL | #[unsafe(ffi_pure = 1)] | ^^^^^^^^^^^^^^^^^^---^^ @@ -645,7 +685,7 @@ LL + #[unsafe(ffi_pure)] | error[E0539]: malformed `link_ordinal` attribute input - --> $DIR/malformed-attrs.rs:164:5 + --> $DIR/malformed-attrs.rs:168:5 | LL | #[link_ordinal] | ^^^^^^^^^^^^^^^ expected this to be a list @@ -657,7 +697,7 @@ LL | #[link_ordinal(ordinal)] | +++++++++ error[E0565]: malformed `ffi_const` attribute input - --> $DIR/malformed-attrs.rs:168:5 + --> $DIR/malformed-attrs.rs:172:5 | LL | #[unsafe(ffi_const = 1)] | ^^^^^^^^^^^^^^^^^^^---^^ @@ -671,13 +711,13 @@ LL + #[unsafe(ffi_const)] | error[E0539]: malformed `linkage` attribute input - --> $DIR/malformed-attrs.rs:170:5 + --> $DIR/malformed-attrs.rs:174:5 | LL | #[linkage] | ^^^^^^^^^^ expected this to be of the form `linkage = "..."` error[E0539]: malformed `debugger_visualizer` attribute input - --> $DIR/malformed-attrs.rs:185:1 + --> $DIR/malformed-attrs.rs:189:1 | LL | #[debugger_visualizer] | ^^^^^^^^^^^^^^^^^^^^^^ expected this to be a list @@ -689,7 +729,7 @@ LL | #[debugger_visualizer(natvis_file = "...", gdb_script_file = "...")] | ++++++++++++++++++++++++++++++++++++++++++++++ error[E0565]: malformed `automatically_derived` attribute input - --> $DIR/malformed-attrs.rs:187:1 + --> $DIR/malformed-attrs.rs:191:1 | LL | #[automatically_derived = 18] | ^^^^^^^^^^^^^^^^^^^^^^^^----^ @@ -703,7 +743,7 @@ LL + #[automatically_derived] | error[E0565]: malformed `non_exhaustive` attribute input - --> $DIR/malformed-attrs.rs:195:1 + --> $DIR/malformed-attrs.rs:199:1 | LL | #[non_exhaustive = 1] | ^^^^^^^^^^^^^^^^^---^ @@ -717,7 +757,7 @@ LL + #[non_exhaustive] | error[E0565]: malformed `thread_local` attribute input - --> $DIR/malformed-attrs.rs:201:1 + --> $DIR/malformed-attrs.rs:205:1 | LL | #[thread_local()] | ^^^^^^^^^^^^^^--^ @@ -731,7 +771,7 @@ LL + #[thread_local] | error[E0565]: malformed `no_link` attribute input - --> $DIR/malformed-attrs.rs:205:1 + --> $DIR/malformed-attrs.rs:209:1 | LL | #[no_link()] | ^^^^^^^^^--^ @@ -745,7 +785,7 @@ LL + #[no_link] | error[E0539]: malformed `macro_use` attribute input - --> $DIR/malformed-attrs.rs:207:1 + --> $DIR/malformed-attrs.rs:211:1 | LL | #[macro_use = 1] | ^^^^^^^^^^^^---^ @@ -763,7 +803,7 @@ LL + #[macro_use] | error[E0539]: malformed `macro_export` attribute input - --> $DIR/malformed-attrs.rs:212:1 + --> $DIR/malformed-attrs.rs:216:1 | LL | #[macro_export = 18] | ^^^^^^^^^^^^^^^----^ @@ -780,7 +820,7 @@ LL + #[macro_export] | error[E0658]: allow_internal_unsafe side-steps the unsafe_code lint - --> $DIR/malformed-attrs.rs:214:1 + --> $DIR/malformed-attrs.rs:218:1 | LL | #[allow_internal_unsafe = 1] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -789,7 +829,7 @@ LL | #[allow_internal_unsafe = 1] = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0565]: malformed `allow_internal_unsafe` attribute input - --> $DIR/malformed-attrs.rs:214:1 + --> $DIR/malformed-attrs.rs:218:1 | LL | #[allow_internal_unsafe = 1] | ^^^^^^^^^^^^^^^^^^^^^^^^---^ @@ -837,13 +877,13 @@ LL | #[inline = 5] = note: `#[deny(ill_formed_attribute_input)]` (part of `#[deny(future_incompatible)]`) on by default warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![crate_name]` - --> $DIR/malformed-attrs.rs:72:1 + --> $DIR/malformed-attrs.rs:76:1 | LL | #[crate_name] | ^^^^^^^^^^^^^ | note: this attribute does not have an `!`, which means it is applied to this function - --> $DIR/malformed-attrs.rs:113:1 + --> $DIR/malformed-attrs.rs:117:1 | LL | / fn test() { LL | | #[coroutine = 63] || {} @@ -853,13 +893,13 @@ LL | | } = note: requested on the command line with `-W unused-attributes` error: valid forms for the attribute are `#[doc = "string"]`, `#[doc(alias)]`, `#[doc(attribute)]`, `#[doc(auto_cfg)]`, `#[doc(cfg)]`, `#[doc(fake_variadic)]`, `#[doc(hidden)]`, `#[doc(html_favicon_url)]`, `#[doc(html_logo_url)]`, `#[doc(html_no_source)]`, `#[doc(html_playground_url)]`, `#[doc(html_root_url)]`, `#[doc(include)]`, `#[doc(inline)]`, `#[doc(issue_tracker_base_url)]`, `#[doc(keyword)]`, `#[doc(masked)]`, `#[doc(no_default_passes)]`, `#[doc(no_inline)]`, `#[doc(notable_trait)]`, `#[doc(passes)]`, `#[doc(plugins)]`, `#[doc(rust_logo)]`, `#[doc(search_unbox)]`, `#[doc(spotlight)]`, and `#[doc(test)]` - --> $DIR/malformed-attrs.rs:75:1 + --> $DIR/malformed-attrs.rs:79:1 | LL | #[doc] | ^^^^^^ warning: `#[link]` attribute cannot be used on functions - --> $DIR/malformed-attrs.rs:81:1 + --> $DIR/malformed-attrs.rs:85:1 | LL | #[link] | ^^^^^^^ @@ -868,7 +908,7 @@ 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! warning: `#[link_name]` attribute cannot be used on functions - --> $DIR/malformed-attrs.rs:85:1 + --> $DIR/malformed-attrs.rs:89:1 | LL | #[link_name] | ^^^^^^^^^^^^ @@ -877,7 +917,7 @@ LL | #[link_name] = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! error: valid forms for the attribute are `#[ignore = "reason"]` and `#[ignore]` - --> $DIR/malformed-attrs.rs:95:1 + --> $DIR/malformed-attrs.rs:99:1 | LL | #[ignore()] | ^^^^^^^^^^^ @@ -886,7 +926,7 @@ LL | #[ignore()] = note: for more information, see issue #57571 warning: `#[no_implicit_prelude]` attribute cannot be used on functions - --> $DIR/malformed-attrs.rs:98:1 + --> $DIR/malformed-attrs.rs:102:1 | LL | #[no_implicit_prelude = 23] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -895,7 +935,7 @@ LL | #[no_implicit_prelude = 23] = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: missing options for `diagnostic::on_unimplemented` attribute - --> $DIR/malformed-attrs.rs:137:1 + --> $DIR/malformed-attrs.rs:141:1 | LL | #[diagnostic::on_unimplemented] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -904,7 +944,7 @@ LL | #[diagnostic::on_unimplemented] = note: `#[warn(malformed_diagnostic_attributes)]` (part of `#[warn(unknown_or_malformed_diagnostic_attributes)]`) on by default warning: malformed `diagnostic::on_unimplemented` attribute - --> $DIR/malformed-attrs.rs:139:1 + --> $DIR/malformed-attrs.rs:143:1 | LL | #[diagnostic::on_unimplemented = 1] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ invalid option found here @@ -912,13 +952,13 @@ LL | #[diagnostic::on_unimplemented = 1] = help: only `message`, `note` and `label` are allowed as options warning: `#[diagnostic::do_not_recommend]` does not expect any arguments - --> $DIR/malformed-attrs.rs:146:1 + --> $DIR/malformed-attrs.rs:150:1 | LL | #[diagnostic::do_not_recommend()] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: `#[automatically_derived]` attribute cannot be used on modules - --> $DIR/malformed-attrs.rs:187:1 + --> $DIR/malformed-attrs.rs:191:1 | LL | #[automatically_derived = 18] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -927,7 +967,7 @@ LL | #[automatically_derived = 18] = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! error: valid forms for the attribute are `#[ignore = "reason"]` and `#[ignore]` - --> $DIR/malformed-attrs.rs:221:1 + --> $DIR/malformed-attrs.rs:225:1 | LL | #[ignore = 1] | ^^^^^^^^^^^^^ @@ -936,7 +976,7 @@ LL | #[ignore = 1] = note: for more information, see issue #57571 error[E0308]: mismatched types - --> $DIR/malformed-attrs.rs:114:23 + --> $DIR/malformed-attrs.rs:118:23 | LL | fn test() { | - help: a return type might be missing here: `-> _` @@ -944,9 +984,9 @@ LL | #[coroutine = 63] || {} | ^^^^^ expected `()`, found coroutine | = note: expected unit type `()` - found coroutine `{coroutine@$DIR/malformed-attrs.rs:114:23: 114:25}` + found coroutine `{coroutine@$DIR/malformed-attrs.rs:118:23: 118:25}` -error: aborting due to 72 previous errors; 8 warnings emitted +error: aborting due to 74 previous errors; 8 warnings emitted Some errors have detailed explanations: E0308, E0463, E0539, E0565, E0658, E0805. For more information about an error, try `rustc --explain E0308`. @@ -963,7 +1003,7 @@ LL | #[inline = 5] Future breakage diagnostic: error: valid forms for the attribute are `#[ignore = "reason"]` and `#[ignore]` - --> $DIR/malformed-attrs.rs:95:1 + --> $DIR/malformed-attrs.rs:99:1 | LL | #[ignore()] | ^^^^^^^^^^^ @@ -974,7 +1014,7 @@ LL | #[ignore()] Future breakage diagnostic: error: valid forms for the attribute are `#[ignore = "reason"]` and `#[ignore]` - --> $DIR/malformed-attrs.rs:221:1 + --> $DIR/malformed-attrs.rs:225:1 | LL | #[ignore = 1] | ^^^^^^^^^^^^^ diff --git a/tests/ui/attributes/optimize.rs b/tests/ui/attributes/optimize.rs index 78e05f111e7bf..c55353d4cfb3f 100644 --- a/tests/ui/attributes/optimize.rs +++ b/tests/ui/attributes/optimize.rs @@ -40,3 +40,25 @@ fn async_block() -> impl Future { async fn async_fn() { () } + +trait Foo { + #[optimize(speed)] //~ ERROR attribute cannot be used on + fn invalid(); + #[optimize(speed)] + fn valid() {} +} + +impl Foo for () { + #[optimize(speed)] + fn invalid() {} + #[optimize(size)] + fn valid() {} +} + +#[optimize(speed)] +#[optimize(speed)] //~ ERROR multiple `optimize` attributes +fn duplicate_same() {} + +#[optimize(speed)] +#[optimize(size)] //~ ERROR multiple `optimize` attributes +fn duplicate_different() {} diff --git a/tests/ui/attributes/optimize.stderr b/tests/ui/attributes/optimize.stderr index 2ded1a973f33d..ba766e1dd8bb5 100644 --- a/tests/ui/attributes/optimize.stderr +++ b/tests/ui/attributes/optimize.stderr @@ -30,5 +30,37 @@ LL | #[optimize(speed)] | = help: `#[optimize]` can only be applied to functions -error: aborting due to 4 previous errors +error: `#[optimize]` attribute cannot be used on required trait methods + --> $DIR/optimize.rs:45:5 + | +LL | #[optimize(speed)] + | ^^^^^^^^^^^^^^^^^^ + | + = help: `#[optimize]` can be applied to closures, functions, inherent methods, provided trait methods, and trait methods in impl blocks + +error: multiple `optimize` attributes + --> $DIR/optimize.rs:59:1 + | +LL | #[optimize(speed)] + | ^^^^^^^^^^^^^^^^^^ help: remove this attribute + | +note: attribute also specified here + --> $DIR/optimize.rs:58:1 + | +LL | #[optimize(speed)] + | ^^^^^^^^^^^^^^^^^^ + +error: multiple `optimize` attributes + --> $DIR/optimize.rs:63:1 + | +LL | #[optimize(size)] + | ^^^^^^^^^^^^^^^^^ help: remove this attribute + | +note: attribute also specified here + --> $DIR/optimize.rs:62:1 + | +LL | #[optimize(speed)] + | ^^^^^^^^^^^^^^^^^^ + +error: aborting due to 7 previous errors From 9cef6416816485625457d62f494ff77bd254dc80 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Tue, 2 Jun 2026 16:05:47 +0200 Subject: [PATCH 4/4] Fix ICE when wrong intra-doc link on type alias --- .../passes/collect_intra_doc_links.rs | 7 ++++++- tests/rustdoc-ui/intra-doc/ty-alias-field.rs | 11 ++++++++++ .../intra-doc/ty-alias-field.stderr | 20 +++++++++++++++++++ 3 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 tests/rustdoc-ui/intra-doc/ty-alias-field.rs create mode 100644 tests/rustdoc-ui/intra-doc/ty-alias-field.stderr diff --git a/src/librustdoc/passes/collect_intra_doc_links.rs b/src/librustdoc/passes/collect_intra_doc_links.rs index ed0883ef76e71..68dceb103037e 100644 --- a/src/librustdoc/passes/collect_intra_doc_links.rs +++ b/src/librustdoc/passes/collect_intra_doc_links.rs @@ -328,7 +328,12 @@ impl<'tcx> LinkCollector<'_, 'tcx> { }) } } - _ => unreachable!(), + _ => Err(UnresolvedPath { + item_id, + module_id, + partial_res: Some(Res::Def(DefKind::TyAlias, did)), + unresolved: variant_name.to_string().into(), + }), } } _ => Err(UnresolvedPath { diff --git a/tests/rustdoc-ui/intra-doc/ty-alias-field.rs b/tests/rustdoc-ui/intra-doc/ty-alias-field.rs new file mode 100644 index 0000000000000..85701ff13c021 --- /dev/null +++ b/tests/rustdoc-ui/intra-doc/ty-alias-field.rs @@ -0,0 +1,11 @@ +#![deny(rustdoc::broken_intra_doc_links)] +//~^ NOTE the lint level is defined here + +/// [Self::a::b] +//~^ ERROR unresolved link to `Self::a::b` +//~| NOTE the struct `MyStruct` has no field or associated item named `a` +pub struct MyStruct; +/// [Self::a::b] +//~^ ERROR unresolved link to `Self::a::b` +//~| NOTE the type alias `MyAlias` has no associated item named `a` +pub type MyAlias = MyStruct; diff --git a/tests/rustdoc-ui/intra-doc/ty-alias-field.stderr b/tests/rustdoc-ui/intra-doc/ty-alias-field.stderr new file mode 100644 index 0000000000000..82b38a154dcd4 --- /dev/null +++ b/tests/rustdoc-ui/intra-doc/ty-alias-field.stderr @@ -0,0 +1,20 @@ +error: unresolved link to `Self::a::b` + --> $DIR/ty-alias-field.rs:4:6 + | +LL | /// [Self::a::b] + | ^^^^^^^^^^ the struct `MyStruct` has no field or associated item named `a` + | +note: the lint level is defined here + --> $DIR/ty-alias-field.rs:1:9 + | +LL | #![deny(rustdoc::broken_intra_doc_links)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: unresolved link to `Self::a::b` + --> $DIR/ty-alias-field.rs:8:6 + | +LL | /// [Self::a::b] + | ^^^^^^^^^^ the type alias `MyAlias` has no associated item named `a` + +error: aborting due to 2 previous errors +