about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2025-07-08 03:30:58 +0000
committerbors <bors@rust-lang.org>2025-07-08 03:30:58 +0000
commit2783fc43fd13a669f314742890acd64200ad0bbf (patch)
tree61f7b83de01b9a9625f848943694ab53af77e37f /tests
parent688ea65df6a47866d0f72a00f1e18b47a7edf83b (diff)
parentfd05071727ede428ff9a3bf7844f22d2274b7363 (diff)
downloadrust-2783fc43fd13a669f314742890acd64200ad0bbf.tar.gz
rust-2783fc43fd13a669f314742890acd64200ad0bbf.zip
Auto merge of #143621 - matthiaskrgr:rollup-p1ce8l7, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - rust-lang/rust#142098 (Implement `int_format_into` feature)
 - rust-lang/rust#143567 (Point to correct argument in Func Call when Self type fails trait bound)
 - rust-lang/rust#143570 (consider nested cases for duplicate RPITIT)
 - rust-lang/rust#143571 (remove `has_nested` from builtin candidates)
 - rust-lang/rust#143586 (Fix wrong cache event query key)
 - rust-lang/rust#143589 (const-block-as-pattern: do not refer to no-longer-existing nightly feature)
 - rust-lang/rust#143608 (Fix in std::String docs)

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'tests')
-rw-r--r--tests/ui/associated-type-bounds/dedup-normalized-2-higher-ranked.current.stderr4
-rw-r--r--tests/ui/const-generics/infer/issue-77092.stderr2
-rw-r--r--tests/ui/impl-trait/auto-trait-selection-freeze.old.stderr4
-rw-r--r--tests/ui/impl-trait/auto-trait-selection.old.stderr4
-rw-r--r--tests/ui/impl-trait/in-trait/rpitit-duplicate-associated-fn-with-nested.rs46
-rw-r--r--tests/ui/impl-trait/in-trait/rpitit-duplicate-associated-fn-with-nested.stderr49
-rw-r--r--tests/ui/impl-trait/in-trait/rpitit-duplicate-associated-fn.rs11
-rw-r--r--tests/ui/impl-trait/in-trait/rpitit-duplicate-associated-fn.stderr33
-rw-r--r--tests/ui/inline-const/in-pat-recovery.rs2
-rw-r--r--tests/ui/inline-const/in-pat-recovery.stderr4
-rw-r--r--tests/ui/trait-bounds/false-span-in-trait-bound-label.rs10
-rw-r--r--tests/ui/trait-bounds/false-span-in-trait-bound-label.stderr17
-rw-r--r--tests/ui/traits/inheritance/repeated-supertrait-ambig.stderr4
-rw-r--r--tests/ui/traits/multidispatch-convert-ambig-dest.stderr2
14 files changed, 181 insertions, 11 deletions
diff --git a/tests/ui/associated-type-bounds/dedup-normalized-2-higher-ranked.current.stderr b/tests/ui/associated-type-bounds/dedup-normalized-2-higher-ranked.current.stderr
index 64304be9d6b..eaa212c6ce8 100644
--- a/tests/ui/associated-type-bounds/dedup-normalized-2-higher-ranked.current.stderr
+++ b/tests/ui/associated-type-bounds/dedup-normalized-2-higher-ranked.current.stderr
@@ -2,7 +2,9 @@ error[E0283]: type annotations needed
   --> $DIR/dedup-normalized-2-higher-ranked.rs:28:5
    |
 LL |     impls(rigid);
-   |     ^^^^^ cannot infer type of the type parameter `U` declared on the function `impls`
+   |     ^^^^^ ----- type must be known at this point
+   |     |
+   |     cannot infer type of the type parameter `U` declared on the function `impls`
    |
    = note: cannot satisfy `for<'b> <P as Trait>::Rigid: Bound<'b, _>`
 note: required by a bound in `impls`
diff --git a/tests/ui/const-generics/infer/issue-77092.stderr b/tests/ui/const-generics/infer/issue-77092.stderr
index 4ab80cec58d..3763cd738a8 100644
--- a/tests/ui/const-generics/infer/issue-77092.stderr
+++ b/tests/ui/const-generics/infer/issue-77092.stderr
@@ -20,7 +20,7 @@ error[E0284]: type annotations needed
 LL |         println!("{:?}", take_array_from_mut(&mut arr, i));
    |                   ----   ^^^^^^^^^^^^^^^^^^^ cannot infer the value of the const parameter `N` declared on the function `take_array_from_mut`
    |                   |
-   |                   type must be known at this point
+   |                   required by this formatting parameter
    |
    = note: required for `[i32; _]` to implement `Debug`
    = note: 1 redundant requirement hidden
diff --git a/tests/ui/impl-trait/auto-trait-selection-freeze.old.stderr b/tests/ui/impl-trait/auto-trait-selection-freeze.old.stderr
index b4d2229d408..b6c6e74f260 100644
--- a/tests/ui/impl-trait/auto-trait-selection-freeze.old.stderr
+++ b/tests/ui/impl-trait/auto-trait-selection-freeze.old.stderr
@@ -2,7 +2,9 @@ error[E0283]: type annotations needed
   --> $DIR/auto-trait-selection-freeze.rs:19:16
    |
 LL |     if false { is_trait(foo()) } else { Default::default() }
-   |                ^^^^^^^^ cannot infer type of the type parameter `U` declared on the function `is_trait`
+   |                ^^^^^^^^ ----- type must be known at this point
+   |                |
+   |                cannot infer type of the type parameter `U` declared on the function `is_trait`
    |
 note: multiple `impl`s satisfying `impl Sized: Trait<_>` found
   --> $DIR/auto-trait-selection-freeze.rs:16:1
diff --git a/tests/ui/impl-trait/auto-trait-selection.old.stderr b/tests/ui/impl-trait/auto-trait-selection.old.stderr
index 1b5fd95fdf9..8e441001771 100644
--- a/tests/ui/impl-trait/auto-trait-selection.old.stderr
+++ b/tests/ui/impl-trait/auto-trait-selection.old.stderr
@@ -2,7 +2,9 @@ error[E0283]: type annotations needed
   --> $DIR/auto-trait-selection.rs:15:16
    |
 LL |     if false { is_trait(foo()) } else { Default::default() }
-   |                ^^^^^^^^ cannot infer type of the type parameter `U` declared on the function `is_trait`
+   |                ^^^^^^^^ ----- type must be known at this point
+   |                |
+   |                cannot infer type of the type parameter `U` declared on the function `is_trait`
    |
 note: multiple `impl`s satisfying `impl Sized: Trait<_>` found
   --> $DIR/auto-trait-selection.rs:12:1
diff --git a/tests/ui/impl-trait/in-trait/rpitit-duplicate-associated-fn-with-nested.rs b/tests/ui/impl-trait/in-trait/rpitit-duplicate-associated-fn-with-nested.rs
new file mode 100644
index 00000000000..e3dc22c1992
--- /dev/null
+++ b/tests/ui/impl-trait/in-trait/rpitit-duplicate-associated-fn-with-nested.rs
@@ -0,0 +1,46 @@
+// issue#143560
+
+trait T {
+    type Target;
+}
+
+trait Foo {
+    fn foo() -> impl T<Target = impl T<Target = impl Sized>>;
+    fn foo() -> impl Sized;
+    //~^ ERROR: the name `foo` is defined multiple times
+}
+
+trait Bar {
+    fn foo() -> impl T<Target = impl T<Target = impl Sized>>;
+    fn foo() -> impl T<Target = impl T<Target = impl Sized>>;
+    //~^ ERROR: the name `foo` is defined multiple times
+}
+
+struct S<T> {
+    a: T
+}
+
+trait Baz {
+    fn foo() -> S<impl T<Target = S<S<impl Sized>>>>;
+    fn foo() -> S<impl T<Target = S<S<impl Sized>>>>;
+    //~^ ERROR: the name `foo` is defined multiple times
+}
+
+struct S1<T1, T2> {
+    a: T1,
+    b: T2
+}
+
+trait Qux {
+    fn foo() -> S1<
+        impl T<Target = impl T<Target = impl Sized>>,
+        impl T<Target = impl T<Target = S<impl Sized>>>
+        >;
+    fn foo() -> S1<
+        impl T<Target = impl T<Target = impl Sized>>,
+        impl T<Target = impl T<Target = S<impl Sized>>>
+        >;
+    //~^^^^ ERROR: the name `foo` is defined multiple times
+}
+
+fn main() {}
diff --git a/tests/ui/impl-trait/in-trait/rpitit-duplicate-associated-fn-with-nested.stderr b/tests/ui/impl-trait/in-trait/rpitit-duplicate-associated-fn-with-nested.stderr
new file mode 100644
index 00000000000..f4e73dc1798
--- /dev/null
+++ b/tests/ui/impl-trait/in-trait/rpitit-duplicate-associated-fn-with-nested.stderr
@@ -0,0 +1,49 @@
+error[E0428]: the name `foo` is defined multiple times
+  --> $DIR/rpitit-duplicate-associated-fn-with-nested.rs:9:5
+   |
+LL |     fn foo() -> impl T<Target = impl T<Target = impl Sized>>;
+   |     --------------------------------------------------------- previous definition of the value `foo` here
+LL |     fn foo() -> impl Sized;
+   |     ^^^^^^^^^^^^^^^^^^^^^^^ `foo` redefined here
+   |
+   = note: `foo` must be defined only once in the value namespace of this trait
+
+error[E0428]: the name `foo` is defined multiple times
+  --> $DIR/rpitit-duplicate-associated-fn-with-nested.rs:15:5
+   |
+LL |     fn foo() -> impl T<Target = impl T<Target = impl Sized>>;
+   |     --------------------------------------------------------- previous definition of the value `foo` here
+LL |     fn foo() -> impl T<Target = impl T<Target = impl Sized>>;
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `foo` redefined here
+   |
+   = note: `foo` must be defined only once in the value namespace of this trait
+
+error[E0428]: the name `foo` is defined multiple times
+  --> $DIR/rpitit-duplicate-associated-fn-with-nested.rs:25:5
+   |
+LL |     fn foo() -> S<impl T<Target = S<S<impl Sized>>>>;
+   |     ------------------------------------------------- previous definition of the value `foo` here
+LL |     fn foo() -> S<impl T<Target = S<S<impl Sized>>>>;
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `foo` redefined here
+   |
+   = note: `foo` must be defined only once in the value namespace of this trait
+
+error[E0428]: the name `foo` is defined multiple times
+  --> $DIR/rpitit-duplicate-associated-fn-with-nested.rs:39:5
+   |
+LL | /     fn foo() -> S1<
+LL | |         impl T<Target = impl T<Target = impl Sized>>,
+LL | |         impl T<Target = impl T<Target = S<impl Sized>>>
+LL | |         >;
+   | |__________- previous definition of the value `foo` here
+LL | /     fn foo() -> S1<
+LL | |         impl T<Target = impl T<Target = impl Sized>>,
+LL | |         impl T<Target = impl T<Target = S<impl Sized>>>
+LL | |         >;
+   | |__________^ `foo` redefined here
+   |
+   = note: `foo` must be defined only once in the value namespace of this trait
+
+error: aborting due to 4 previous errors
+
+For more information about this error, try `rustc --explain E0428`.
diff --git a/tests/ui/impl-trait/in-trait/rpitit-duplicate-associated-fn.rs b/tests/ui/impl-trait/in-trait/rpitit-duplicate-associated-fn.rs
index 4fddd7c4ac8..6db0c88f6c0 100644
--- a/tests/ui/impl-trait/in-trait/rpitit-duplicate-associated-fn.rs
+++ b/tests/ui/impl-trait/in-trait/rpitit-duplicate-associated-fn.rs
@@ -27,4 +27,15 @@ impl T for () {
     }
 }
 
+trait Baz {
+    fn foo();
+    fn foo() -> impl Sized;     //~ ERROR: the name `foo` is defined multiple times
+}
+
+trait Foo {
+    fn foo() -> impl Sized;
+    fn foo();                   //~ ERROR: the name `foo` is defined multiple times
+    fn foo() -> impl Sized;     //~ ERROR: the name `foo` is defined multiple times
+}
+
 fn main() {}
diff --git a/tests/ui/impl-trait/in-trait/rpitit-duplicate-associated-fn.stderr b/tests/ui/impl-trait/in-trait/rpitit-duplicate-associated-fn.stderr
index b58e8136479..faa65f45d33 100644
--- a/tests/ui/impl-trait/in-trait/rpitit-duplicate-associated-fn.stderr
+++ b/tests/ui/impl-trait/in-trait/rpitit-duplicate-associated-fn.stderr
@@ -8,6 +8,37 @@ LL |     fn method() -> impl Sized;
    |
    = note: `method` must be defined only once in the value namespace of this trait
 
+error[E0428]: the name `foo` is defined multiple times
+  --> $DIR/rpitit-duplicate-associated-fn.rs:32:5
+   |
+LL |     fn foo();
+   |     --------- previous definition of the value `foo` here
+LL |     fn foo() -> impl Sized;
+   |     ^^^^^^^^^^^^^^^^^^^^^^^ `foo` redefined here
+   |
+   = note: `foo` must be defined only once in the value namespace of this trait
+
+error[E0428]: the name `foo` is defined multiple times
+  --> $DIR/rpitit-duplicate-associated-fn.rs:37:5
+   |
+LL |     fn foo() -> impl Sized;
+   |     ----------------------- previous definition of the value `foo` here
+LL |     fn foo();
+   |     ^^^^^^^^^ `foo` redefined here
+   |
+   = note: `foo` must be defined only once in the value namespace of this trait
+
+error[E0428]: the name `foo` is defined multiple times
+  --> $DIR/rpitit-duplicate-associated-fn.rs:38:5
+   |
+LL |     fn foo() -> impl Sized;
+   |     ----------------------- previous definition of the value `foo` here
+LL |     fn foo();
+LL |     fn foo() -> impl Sized;
+   |     ^^^^^^^^^^^^^^^^^^^^^^^ `foo` redefined here
+   |
+   = note: `foo` must be defined only once in the value namespace of this trait
+
 error[E0201]: duplicate definitions with name `method`:
   --> $DIR/rpitit-duplicate-associated-fn.rs:12:5
    |
@@ -47,7 +78,7 @@ LL |     fn method() -> impl Sized;
 LL | impl Bar for () {
    | ^^^^^^^^^^^^^^^ missing `method` in implementation
 
-error: aborting due to 4 previous errors
+error: aborting due to 7 previous errors
 
 Some errors have detailed explanations: E0046, E0201, E0428.
 For more information about an error, try `rustc --explain E0046`.
diff --git a/tests/ui/inline-const/in-pat-recovery.rs b/tests/ui/inline-const/in-pat-recovery.rs
index e9e60116ff4..a46e56e3be6 100644
--- a/tests/ui/inline-const/in-pat-recovery.rs
+++ b/tests/ui/inline-const/in-pat-recovery.rs
@@ -4,7 +4,7 @@
 fn main() {
     match 1 {
         const { 1 + 7 } => {}
-        //~^ ERROR `inline_const_pat` has been removed
+        //~^ ERROR const blocks cannot be used as patterns
         2 => {}
         _ => {}
     }
diff --git a/tests/ui/inline-const/in-pat-recovery.stderr b/tests/ui/inline-const/in-pat-recovery.stderr
index e1f2e681e77..0698cff1480 100644
--- a/tests/ui/inline-const/in-pat-recovery.stderr
+++ b/tests/ui/inline-const/in-pat-recovery.stderr
@@ -1,10 +1,10 @@
-error: `inline_const_pat` has been removed
+error: const blocks cannot be used as patterns
   --> $DIR/in-pat-recovery.rs:6:15
    |
 LL |         const { 1 + 7 } => {}
    |               ^^^^^^^^^
    |
-   = help: use a named `const`-item or an `if`-guard instead
+   = help: use a named `const`-item or an `if`-guard (`x if x == const { ... }`) instead
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/trait-bounds/false-span-in-trait-bound-label.rs b/tests/ui/trait-bounds/false-span-in-trait-bound-label.rs
new file mode 100644
index 00000000000..0e307309860
--- /dev/null
+++ b/tests/ui/trait-bounds/false-span-in-trait-bound-label.rs
@@ -0,0 +1,10 @@
+// In this test, the span of the trait bound label should point to `1`, not `""`.
+// See issue #143336
+
+trait A<T> {
+    fn f(self, x: T);
+}
+
+fn main() {
+    A::f(1, ""); //~ ERROR the trait bound `{integer}: A<_>` is not satisfied [E0277]
+}
diff --git a/tests/ui/trait-bounds/false-span-in-trait-bound-label.stderr b/tests/ui/trait-bounds/false-span-in-trait-bound-label.stderr
new file mode 100644
index 00000000000..9a480273338
--- /dev/null
+++ b/tests/ui/trait-bounds/false-span-in-trait-bound-label.stderr
@@ -0,0 +1,17 @@
+error[E0277]: the trait bound `{integer}: A<_>` is not satisfied
+  --> $DIR/false-span-in-trait-bound-label.rs:9:10
+   |
+LL |     A::f(1, "");
+   |     ---- ^ the trait `A<_>` is not implemented for `{integer}`
+   |     |
+   |     required by a bound introduced by this call
+   |
+help: this trait has no implementations, consider adding one
+  --> $DIR/false-span-in-trait-bound-label.rs:4:1
+   |
+LL | trait A<T> {
+   | ^^^^^^^^^^
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/traits/inheritance/repeated-supertrait-ambig.stderr b/tests/ui/traits/inheritance/repeated-supertrait-ambig.stderr
index fdf0b1722be..23cced2bc28 100644
--- a/tests/ui/traits/inheritance/repeated-supertrait-ambig.stderr
+++ b/tests/ui/traits/inheritance/repeated-supertrait-ambig.stderr
@@ -34,10 +34,10 @@ LL |     <dyn CompareToInts>::same_as(c, 22)
              `i64` implements `CompareTo<u64>`
 
 error[E0277]: the trait bound `C: CompareTo<i32>` is not satisfied
-  --> $DIR/repeated-supertrait-ambig.rs:38:27
+  --> $DIR/repeated-supertrait-ambig.rs:38:24
    |
 LL |     CompareTo::same_as(c, 22)
-   |     ------------------    ^^ the trait `CompareTo<i32>` is not implemented for `C`
+   |     ------------------ ^ the trait `CompareTo<i32>` is not implemented for `C`
    |     |
    |     required by a bound introduced by this call
    |
diff --git a/tests/ui/traits/multidispatch-convert-ambig-dest.stderr b/tests/ui/traits/multidispatch-convert-ambig-dest.stderr
index 17c3db9ad33..12984c7936c 100644
--- a/tests/ui/traits/multidispatch-convert-ambig-dest.stderr
+++ b/tests/ui/traits/multidispatch-convert-ambig-dest.stderr
@@ -2,7 +2,7 @@ error[E0283]: type annotations needed
   --> $DIR/multidispatch-convert-ambig-dest.rs:26:5
    |
 LL |     test(22, std::default::Default::default());
-   |     ^^^^     -------------------------------- type must be known at this point
+   |     ^^^^ -- type must be known at this point
    |     |
    |     cannot infer type of the type parameter `U` declared on the function `test`
    |