Skip to content

fix ice for unresolved inherent delegation - #162917

Open
paradoxicalguy wants to merge 1 commit into
rust-lang:mainfrom
paradoxicalguy:delegation-ice-fix
Open

paradoxicalguy wants to merge 1 commit into
rust-lang:mainfrom
paradoxicalguy:delegation-ice-fix

Conversation

@paradoxicalguy

Copy link
Copy Markdown
Contributor

fixes: 162774
also adds a regression test for the ICE

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Sep 17, 2026
@rustbot rustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Sep 17, 2026
@rustbot

rustbot commented Sep 17, 2026

Copy link
Copy Markdown
Collaborator

r? @khyperia

rustbot has assigned @khyperia.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: compiler
  • compiler expanded to 77 candidates
  • Random selection from 21 candidates

@rust-log-analyzer

Copy link
Copy Markdown
Collaborator

The job test-aarch64-gnu-llvm-21-1 failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
81 
+ error: failed to resolve delegation to inherent impl
+   --> $DIR/bad-resolve.rs:45:27
+    |
+ LL | reuse unresolved_prefix::{a, b, c};
+    |                           ^
+ 
+ error: failed to resolve delegation to inherent impl
+   --> $DIR/bad-resolve.rs:45:30
+    |
+ LL | reuse unresolved_prefix::{a, b, c};
+    |                              ^
+ 
+ error: failed to resolve delegation to inherent impl
+   --> $DIR/bad-resolve.rs:45:33
+    |
+ LL | reuse unresolved_prefix::{a, b, c};
+    |                                 ^
+ 
+ error: failed to resolve delegation to inherent impl
+   --> $DIR/bad-resolve.rs:46:16
+    |
+ LL | reuse prefix::{self, super, crate};
+    |                ^^^^
+ 
+ error: failed to resolve delegation to inherent impl
+   --> $DIR/bad-resolve.rs:46:22
+    |
+ LL | reuse prefix::{self, super, crate};
+    |                      ^^^^^
+ 
+ error: failed to resolve delegation to inherent impl
+   --> $DIR/bad-resolve.rs:46:29
+    |
+ LL | reuse prefix::{self, super, crate};
+    |                             ^^^^^
+ 
82 error[E0186]: method `foo` has a `&self` declaration in the trait, but not in the impl
83   --> $DIR/bad-resolve.rs:34:11
84    |

157 LL | reuse prefix::{self, super, crate};
158    |                             ^^^^^ can only be used in path start position
159 
- error: aborting due to 14 previous errors; 1 warning emitted
+ error: aborting due to 20 previous errors; 1 warning emitted
161 
162 Some errors have detailed explanations: E0038, E0046, E0186, E0324, E0407, E0423, E0425, E0433, E0575...
163 For more information about an error, try `rustc --explain E0038`.

Note: some mismatched output was normalized before being compared
-   --> /checkout/tests/ui/delegation/bad-resolve.rs:45:27
- LL | reuse unresolved_prefix::{a, b, c}; //~ ERROR cannot find module or crate `unresolved_prefix`
-   --> /checkout/tests/ui/delegation/bad-resolve.rs:45:30
- LL | reuse unresolved_prefix::{a, b, c}; //~ ERROR cannot find module or crate `unresolved_prefix`
-   --> /checkout/tests/ui/delegation/bad-resolve.rs:45:33
- LL | reuse unresolved_prefix::{a, b, c}; //~ ERROR cannot find module or crate `unresolved_prefix`
-   --> /checkout/tests/ui/delegation/bad-resolve.rs:46:16
- LL | reuse prefix::{self, super, crate}; //~ ERROR `crate` in paths can only be used in start position
-   --> /checkout/tests/ui/delegation/bad-resolve.rs:46:22
- LL | reuse prefix::{self, super, crate}; //~ ERROR `crate` in paths can only be used in start position
-   --> /checkout/tests/ui/delegation/bad-resolve.rs:46:29
- LL | reuse prefix::{self, super, crate}; //~ ERROR `crate` in paths can only be used in start position
+ error: failed to resolve delegation to inherent impl
+   --> $DIR/bad-resolve.rs:45:27
+    |
+ LL | reuse unresolved_prefix::{a, b, c};
+    |                           ^
+ 
+ error: failed to resolve delegation to inherent impl
+   --> $DIR/bad-resolve.rs:45:30
+    |
+ LL | reuse unresolved_prefix::{a, b, c};
+    |                              ^
+ 
+ error: failed to resolve delegation to inherent impl
+   --> $DIR/bad-resolve.rs:45:33
+    |
+ LL | reuse unresolved_prefix::{a, b, c};
+    |                                 ^
+ 
+ error: failed to resolve delegation to inherent impl
+   --> $DIR/bad-resolve.rs:46:16
+    |
+ LL | reuse prefix::{self, super, crate};
+    |                ^^^^
+ 
+ error: failed to resolve delegation to inherent impl
+   --> $DIR/bad-resolve.rs:46:22
+    |
+ LL | reuse prefix::{self, super, crate};
+    |                      ^^^^^
+ 
+ error: failed to resolve delegation to inherent impl
+   --> $DIR/bad-resolve.rs:46:29
+    |
+ LL | reuse prefix::{self, super, crate};
+    |                             ^^^^^
+ 
+ error: aborting due to 20 previous errors; 1 warning emitted


The actual stderr differed from the expected stderr
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args delegation/bad-resolve.rs`

error: 1 errors occurred comparing output.
status: exit status: 1
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/delegation/bad-resolve.rs" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2" "--target=aarch64-unknown-linux-gnu" "--check-cfg" "cfg(test,FALSE)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/delegation/bad-resolve" "-Znext-solver=coherence" "-A" "unused" "-W" "unused_attributes" "-A" "internal_features" "-A" "incomplete_features" "-A" "unused_parens" "-A" "unused_braces" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/aarch64-unknown-linux-gnu/native/rust-test-helpers"
stdout: none
--- stderr -------------------------------
error[E0324]: item `C` is an associated method, which doesn't match its trait `Trait`
##[error]  --> /checkout/tests/ui/delegation/bad-resolve.rs:23:5
   |
LL |     const C: u32 = 0;
   |     ----------------- item in trait
...
LL |     reuse <F as Trait>::C;
   |     ^^^^^^^^^^^^^^^^^^^^^^ does not match trait

error[E0324]: item `Type` is an associated method, which doesn't match its trait `Trait`
##[error]  --> /checkout/tests/ui/delegation/bad-resolve.rs:26:5
   |
---

error[E0407]: method `baz` is not a member of trait `Trait`
##[error]  --> /checkout/tests/ui/delegation/bad-resolve.rs:29:5
   |
LL |     reuse <F as Trait>::baz;
   |     ^^^^^^^^^^^^^^^^^^^^---^
   |     |                   |
   |     |                   help: there is an associated function with a similar name: `bar`
   |     not a member of trait `Trait`

error[E0407]: method `foo2` is not a member of trait `Trait`
---

error[E0423]: expected function, found associated constant `Trait::C`
##[error]  --> /checkout/tests/ui/delegation/bad-resolve.rs:23:11
   |
LL |     reuse <F as Trait>::C;
   |           ^^^^^^^^^^^^^^^ not a function

error[E0575]: cannot find method or associated constant `Type` in trait `Trait`
##[error]  --> /checkout/tests/ui/delegation/bad-resolve.rs:26:25
   |
---

error[E0576]: cannot find method or associated constant `baz` in trait `Trait`
##[error]  --> /checkout/tests/ui/delegation/bad-resolve.rs:29:25
   |
LL |     reuse <F as Trait>::baz;
   |                         ^^^ not found in `Trait`
   |
note: similarly named associated function `bar` defined here
  --> /checkout/tests/ui/delegation/bad-resolve.rs:6:5
   |
LL |     fn bar() {}
   |     ^^^^^^^^
help: an associated function with a similar name exists
   |
LL -     reuse <F as Trait>::baz;
LL +     reuse <F as Trait>::bar;
   |

error[E0425]: cannot find function `foo` in this scope
##[error]  --> /checkout/tests/ui/delegation/bad-resolve.rs:34:11
   |
LL |     reuse foo { &self.0 }
   |           ^^^ not found in this scope

error[E0423]: cannot find function `self` in module `prefix`
##[error]  --> /checkout/tests/ui/delegation/bad-resolve.rs:46:16
   |
LL | reuse prefix::{self, super, crate}; //~ ERROR `crate` in paths can only be used in start position
   |                ^^^^ not found in `prefix`
   |
   = note: a module named `prefix::self` exists in another namespace

error: failed to resolve delegation to inherent impl
##[error]  --> /checkout/tests/ui/delegation/bad-resolve.rs:45:27
   |
LL | reuse unresolved_prefix::{a, b, c}; //~ ERROR cannot find module or crate `unresolved_prefix`
   |                           ^

error: failed to resolve delegation to inherent impl
##[error]  --> /checkout/tests/ui/delegation/bad-resolve.rs:45:30
   |
LL | reuse unresolved_prefix::{a, b, c}; //~ ERROR cannot find module or crate `unresolved_prefix`
   |                              ^

error: failed to resolve delegation to inherent impl
##[error]  --> /checkout/tests/ui/delegation/bad-resolve.rs:45:33
   |
LL | reuse unresolved_prefix::{a, b, c}; //~ ERROR cannot find module or crate `unresolved_prefix`
   |                                 ^

error: failed to resolve delegation to inherent impl
##[error]  --> /checkout/tests/ui/delegation/bad-resolve.rs:46:16
   |
LL | reuse prefix::{self, super, crate}; //~ ERROR `crate` in paths can only be used in start position
   |                ^^^^

error: failed to resolve delegation to inherent impl
##[error]  --> /checkout/tests/ui/delegation/bad-resolve.rs:46:22
   |
LL | reuse prefix::{self, super, crate}; //~ ERROR `crate` in paths can only be used in start position
   |                      ^^^^^

error: failed to resolve delegation to inherent impl
##[error]  --> /checkout/tests/ui/delegation/bad-resolve.rs:46:29
   |
LL | reuse prefix::{self, super, crate}; //~ ERROR `crate` in paths can only be used in start position
   |                             ^^^^^

error[E0186]: method `foo` has a `&self` declaration in the trait, but not in the impl
##[error]  --> /checkout/tests/ui/delegation/bad-resolve.rs:34:11
   |
---
   = help: consider moving `C` to another trait
   = help: the following types implement `Trait`:
             F
             S
           consider defining an enum where each variant holds one of these types,
           implementing `Trait` for this new enum and using it instead
help: consider turning `bar` into a method by giving it a `&self` argument, so that it is accessible through the trait object's vtable
   |
LL |     fn bar(&self) {}
   |            +++++
help: alternatively, consider constraining `bar` so it is explicitly marked as not applying to trait objects
   |
LL |     fn bar() where Self: Sized {}
   |              +++++++++++++++++

error[E0433]: cannot find module or crate `unresolved_prefix` in this scope
##[error]  --> /checkout/tests/ui/delegation/bad-resolve.rs:45:7
   |
LL | reuse unresolved_prefix::{a, b, c}; //~ ERROR cannot find module or crate `unresolved_prefix`
   |       ^^^^^^^^^^^^^^^^^ use of unresolved module or unlinked crate `unresolved_prefix`
   |
   = help: you might be missing a crate named `unresolved_prefix`

error[E0433]: `crate` in paths can only be used in start position
##[error]  --> /checkout/tests/ui/delegation/bad-resolve.rs:46:29
   |
LL | reuse prefix::{self, super, crate}; //~ ERROR `crate` in paths can only be used in start position
   |                             ^^^^^ can only be used in path start position

error: aborting due to 20 previous errors; 1 warning emitted

Some errors have detailed explanations: E0038, E0046, E0186, E0324, E0407, E0423, E0425, E0433, E0575...
---
To only update this specific test, also pass `--test-args delegation/delegation-inherent-impl-issue-162774.rs`

error: 1 errors occurred comparing output.
status: exit status: 1
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/delegation/delegation-inherent-impl-issue-162774.rs" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2" "--target=aarch64-unknown-linux-gnu" "--check-cfg" "cfg(test,FALSE)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/delegation/delegation-inherent-impl-issue-162774" "-Znext-solver=coherence" "-A" "unused" "-W" "unused_attributes" "-A" "internal_features" "-A" "incomplete_features" "-A" "unused_parens" "-A" "unused_braces" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/aarch64-unknown-linux-gnu/native/rust-test-helpers"
stdout: none
--- stderr -------------------------------
error: failed to resolve delegation to inherent impl
##[error]  --> /checkout/tests/ui/delegation/delegation-inherent-impl-issue-162774.rs:14:17
   |
LL |     reuse Self::foo::<> as bar { self }
   |                 ^^^

error: aborting due to 1 previous error
------------------------------------------

---
8 
+ error: failed to resolve delegation to inherent impl
+   --> $DIR/def-path-hash-collision-ice-153410.rs:21:58
+    |
+ LL |     reuse< < <for<'a> fn()>::Output>::Item as Iterator>::*;
+    |                                                          ^
+ 
9 error[E0782]: expected a type, found a trait
10   --> $DIR/def-path-hash-collision-ice-153410.rs:19:6
11    |

36 LL +     reuse< < <fn() as IntoFuture>::Output>::Item as Iterator>::*;
37    |
38 
- error: aborting due to 3 previous errors
+ error: aborting due to 4 previous errors
40 
---
-   --> /checkout/tests/ui/delegation/generics/def-path-hash-collision-ice-153410.rs:21:58
+ error: failed to resolve delegation to inherent impl
+   --> $DIR/def-path-hash-collision-ice-153410.rs:21:58
+    |
+ LL |     reuse< < <for<'a> fn()>::Output>::Item as Iterator>::*;
+    |                                                          ^
+ 
+ error: aborting due to 4 previous errors


The actual stderr differed from the expected stderr
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args delegation/generics/def-path-hash-collision-ice-153410.rs`

error: 1 errors occurred comparing output.
status: exit status: 1
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/delegation/generics/def-path-hash-collision-ice-153410.rs" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2" "--target=aarch64-unknown-linux-gnu" "--check-cfg" "cfg(test,FALSE)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/delegation/generics/def-path-hash-collision-ice-153410" "-Znext-solver=coherence" "-A" "unused" "-W" "unused_attributes" "-A" "internal_features" "-A" "incomplete_features" "-A" "unused_parens" "-A" "unused_braces" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/aarch64-unknown-linux-gnu/native/rust-test-helpers" "--edition=2024" "-Z" "deduplicate-diagnostics=yes"
stdout: none
--- stderr -------------------------------
error[E0575]: cannot find method or associated constant `Item` in trait `Iterator`
##[error]  --> /checkout/tests/ui/delegation/generics/def-path-hash-collision-ice-153410.rs:21:58
   |
LL |     reuse< < <for<'a> fn()>::Output>::Item as Iterator>::*;
   |                                                          ^ not found in `Iterator`
   |
   = note: an associated type named `Iterator::Item` exists in another namespace

error: failed to resolve delegation to inherent impl
##[error]  --> /checkout/tests/ui/delegation/generics/def-path-hash-collision-ice-153410.rs:21:58
   |
LL |     reuse< < <for<'a> fn()>::Output>::Item as Iterator>::*;
   |                                                          ^

error[E0782]: expected a type, found a trait
##[error]  --> /checkout/tests/ui/delegation/generics/def-path-hash-collision-ice-153410.rs:19:6
   |
---
LL | impl dyn Iterator {
   |      +++
help: you might have intended to implement this trait for a given type
   |
LL | impl Iterator for /* Type */ {
   |               ++++++++++++++

error[E0223]: ambiguous associated type
##[error]  --> /checkout/tests/ui/delegation/generics/def-path-hash-collision-ice-153410.rs:21:14
   |
LL |     reuse< < <for<'a> fn()>::Output>::Item as Iterator>::*;
   |              ^^^^^^^^^^^^^^^^^^^^^^
   |
help: use fully-qualified syntax
   |
LL -     reuse< < <for<'a> fn()>::Output>::Item as Iterator>::*;
LL +     reuse< < <fn() as BitOr>::Output>::Item as Iterator>::*;
   |
LL -     reuse< < <for<'a> fn()>::Output>::Item as Iterator>::*;
LL +     reuse< < <fn() as IntoFuture>::Output>::Item as Iterator>::*;
   |

error: aborting due to 4 previous errors

Some errors have detailed explanations: E0223, E0575, E0782.
---
14 
+ error: failed to resolve delegation to inherent impl
+   --> $DIR/synth-params-ice-143498.rs:21:43
+    |
+ LL |     reuse< std::fmt::Debug as Iterator >::*;
+    |                                           ^
+ 
15 error[E0782]: expected a type, found a trait
16   --> $DIR/synth-params-ice-143498.rs:21:12
17    |

23 LL |     reuse< dyn std::fmt::Debug as Iterator >::*;
24    |            +++
25 
- error: aborting due to 3 previous errors
+ error: aborting due to 4 previous errors
27 
---
-   --> /checkout/tests/ui/delegation/generics/synth-params-ice-143498.rs:21:43
+ error: failed to resolve delegation to inherent impl
+   --> $DIR/synth-params-ice-143498.rs:21:43
+    |
+ LL |     reuse< std::fmt::Debug as Iterator >::*;
+    |                                           ^
+ 
+ error: aborting due to 4 previous errors


The actual stderr differed from the expected stderr
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args delegation/generics/synth-params-ice-143498.rs`

error: 1 errors occurred comparing output.
status: exit status: 1
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/delegation/generics/synth-params-ice-143498.rs" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2" "--target=aarch64-unknown-linux-gnu" "--check-cfg" "cfg(test,FALSE)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/delegation/generics/synth-params-ice-143498" "-Znext-solver=coherence" "-A" "unused" "-W" "unused_attributes" "-A" "internal_features" "-A" "incomplete_features" "-A" "unused_parens" "-A" "unused_braces" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/aarch64-unknown-linux-gnu/native/rust-test-helpers" "--edition=2024" "-Z" "deduplicate-diagnostics=yes"
stdout: none
--- stderr -------------------------------
error[E0425]: cannot find type `X` in this scope
##[error]  --> /checkout/tests/ui/delegation/generics/synth-params-ice-143498.rs:19:6
   |
LL | impl X {
   |      ^ not found in this scope

error[E0575]: cannot find method or associated constant `Item` in trait `Iterator`
##[error]  --> /checkout/tests/ui/delegation/generics/synth-params-ice-143498.rs:21:43
   |
LL |     reuse< std::fmt::Debug as Iterator >::*;
   |                                           ^ not found in `Iterator`
   |
   = note: an associated type named `Iterator::Item` exists in another namespace

error: failed to resolve delegation to inherent impl
##[error]  --> /checkout/tests/ui/delegation/generics/synth-params-ice-143498.rs:21:43
   |
LL |     reuse< std::fmt::Debug as Iterator >::*;
   |                                           ^

error[E0782]: expected a type, found a trait
##[error]  --> /checkout/tests/ui/delegation/generics/synth-params-ice-143498.rs:21:12
   |
LL |     reuse< std::fmt::Debug as Iterator >::*;
   |            ^^^^^^^^^^^^^^^
   |
help: you can add the `dyn` keyword if you want a trait object
   |
LL |     reuse< dyn std::fmt::Debug as Iterator >::*;
   |            +++

error: aborting due to 4 previous errors

Some errors have detailed explanations: E0425, E0575, E0782.
---
To only update this specific test, also pass `--test-args delegation/ice-issue-124342.rs`

error: 1 errors occurred comparing output.
status: exit status: 1
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/delegation/ice-issue-124342.rs" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2" "--target=aarch64-unknown-linux-gnu" "--check-cfg" "cfg(test,FALSE)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/delegation/ice-issue-124342" "-Znext-solver=coherence" "-A" "unused" "-W" "unused_attributes" "-A" "internal_features" "-A" "incomplete_features" "-A" "unused_parens" "-A" "unused_braces" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/aarch64-unknown-linux-gnu/native/rust-test-helpers"
stdout: none
--- stderr -------------------------------
error[E0425]: cannot find function `foo` in module `to_reuse`
##[error]  --> /checkout/tests/ui/delegation/ice-issue-124342.rs:6:21
   |
---
- error: aborting due to 2 previous errors
+ error: failed to resolve delegation to inherent impl
+   --> $DIR/ice-non-fn-target-in-trait-impl.rs:13:16
+    |
+ LL |     reuse std::path::<> as bar;
+    |                ^^^^
+ 
+ error: aborting due to 3 previous errors
18 
19 For more information about this error, try `rustc --explain E0423`.
20 

Note: some mismatched output was normalized before being compared
-   --> /checkout/tests/ui/delegation/ice-non-fn-target-in-trait-impl.rs:13:16
+ error: failed to resolve delegation to inherent impl
+   --> $DIR/ice-non-fn-target-in-trait-impl.rs:13:16
+    |
+ LL |     reuse std::path::<> as bar;
+    |                ^^^^
+ 
+ error: aborting due to 3 previous errors


The actual stderr differed from the expected stderr
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args delegation/ice-non-fn-target-in-trait-impl.rs`

error: 1 errors occurred comparing output.
status: exit status: 1
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/delegation/ice-non-fn-target-in-trait-impl.rs" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2" "--target=aarch64-unknown-linux-gnu" "--check-cfg" "cfg(test,FALSE)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/delegation/ice-non-fn-target-in-trait-impl" "-Znext-solver=coherence" "-A" "unused" "-W" "unused_attributes" "-A" "internal_features" "-A" "incomplete_features" "-A" "unused_parens" "-A" "unused_braces" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/aarch64-unknown-linux-gnu/native/rust-test-helpers"
stdout: none
--- stderr -------------------------------
error[E0423]: cannot find function `path` in crate `std`
##[error]  --> /checkout/tests/ui/delegation/ice-non-fn-target-in-trait-impl.rs:13:16
   |
---
---- [ui] tests/ui/delegation/ice-line-bounds-issue-148732.rs stdout ----
Saved the actual stderr to `/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/delegation/ice-line-bounds-issue-148732/ice-line-bounds-issue-148732.stderr`
diff of stderr:

19    = help: add `#![feature(fn_delegation)]` to the crate attributes to enable
20    = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
21 
+ error: failed to resolve delegation to inherent impl
+   --> $DIR/ice-line-bounds-issue-148732.rs:1:7
+    |
+ LL | reuse a as b {
+    |       ^
+ 
22 error[E0277]: `fn() {b}` doesn't implement `Debug`
23   --> $DIR/ice-line-bounds-issue-148732.rs:4:5
24    |

30    |
31    = help: use parentheses to call this function: `b()`
---
-   --> /checkout/tests/ui/delegation/ice-line-bounds-issue-148732.rs:1:7
+ error: failed to resolve delegation to inherent impl
+   --> $DIR/ice-line-bounds-issue-148732.rs:1:7
+    |
+ LL | reuse a as b {
+    |       ^
+ 
+ error: aborting due to 4 previous errors


The actual stderr differed from the expected stderr
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args delegation/ice-line-bounds-issue-148732.rs`

error: 1 errors occurred comparing output.
status: exit status: 1
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/delegation/ice-line-bounds-issue-148732.rs" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2" "--target=aarch64-unknown-linux-gnu" "--check-cfg" "cfg(test,FALSE)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/delegation/ice-line-bounds-issue-148732" "-Znext-solver=coherence" "-A" "unused" "-W" "unused_attributes" "-A" "internal_features" "-A" "incomplete_features" "-A" "unused_parens" "-A" "unused_braces" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/aarch64-unknown-linux-gnu/native/rust-test-helpers"
stdout: none
--- stderr -------------------------------
error[E0425]: cannot find function `a` in this scope
##[error]  --> /checkout/tests/ui/delegation/ice-line-bounds-issue-148732.rs:1:7
   |
LL | reuse a as b {
   |       ^ not found in this scope

error[E0658]: functions delegation is not yet fully implemented
##[error]  --> /checkout/tests/ui/delegation/ice-line-bounds-issue-148732.rs:1:1
   |
LL | / reuse a as b {
LL | |     //~^ ERROR cannot find function `a` in this scope
LL | |     //~| ERROR functions delegation is not yet fully implemented
LL | |     dbg!(b);
LL | |     //~^ ERROR: `fn() {b}` doesn't implement `Debug`
LL | | }
   | |_^
   |
   = note: see issue #118212 <https://github.com/rust-lang/rust/issues/118212> for more information
   = help: add `#![feature(fn_delegation)]` to the crate attributes to enable
   = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date

error: failed to resolve delegation to inherent impl
##[error]  --> /checkout/tests/ui/delegation/ice-line-bounds-issue-148732.rs:1:7
   |
LL | reuse a as b {
   |       ^

error[E0277]: `fn() {b}` doesn't implement `Debug`
##[error]  --> /checkout/tests/ui/delegation/ice-line-bounds-issue-148732.rs:4:5
   |
LL | reuse a as b {
   |            - consider calling this function
...
---

+ error: failed to resolve delegation to inherent impl
+   --> $DIR/inherent-impls-non-local-crate.rs:7:25
+    |
+ LL | reuse inherent_impl::S::not_existing;
+    |                         ^^^^^^^^^^^^
+ 
+ error: failed to resolve delegation to inherent impl
+   --> $DIR/inherent-impls-non-local-crate.rs:9:25
+    |
+ LL | reuse inherent_impl::S::TYPE;
+    |                         ^^^^
+ 
+ error: failed to resolve delegation to inherent impl
+   --> $DIR/inherent-impls-non-local-crate.rs:11:25
+    |
+ LL | reuse inherent_impl::S::CONST;
+    |                         ^^^^^
+ 
+ error: failed to resolve delegation to inherent impl
+   --> $DIR/inherent-impls-non-local-crate.rs:14:25
+    |
+ LL | reuse inherent_impl::S::bar;
+    |                         ^^^
+ 
1 error: ambiguous delegation to inherent impl function
2   --> $DIR/inherent-impls-non-local-crate.rs:19:25
3    |

43    = note: candidate #1 is defined in an impl for the type `X<String>`
44    = note: candidate #2 is defined in an impl for the type `X<usize>`
45 
- error: aborting due to 6 previous errors
+ error: aborting due to 10 previous errors
47 
48 Some errors have detailed explanations: E0034, E0599, E0618.
---
-   --> /checkout/tests/ui/delegation/inherent-impls-non-local-crate.rs:14:25
+ error: failed to resolve delegation to inherent impl
+   --> $DIR/inherent-impls-non-local-crate.rs:7:25
+    |
+ LL | reuse inherent_impl::S::not_existing;
+    |                         ^^^^^^^^^^^^
+ 
+ error: failed to resolve delegation to inherent impl
+   --> $DIR/inherent-impls-non-local-crate.rs:9:25
+    |
+ LL | reuse inherent_impl::S::TYPE;
+    |                         ^^^^
+ 
+ error: failed to resolve delegation to inherent impl
+   --> $DIR/inherent-impls-non-local-crate.rs:11:25
+    |
+ LL | reuse inherent_impl::S::CONST;
+    |                         ^^^^^
+ 
+ error: failed to resolve delegation to inherent impl
+   --> $DIR/inherent-impls-non-local-crate.rs:14:25
+    |
+ LL | reuse inherent_impl::S::bar;
+    |                         ^^^
+ 
+ error: aborting due to 10 previous errors


The actual stderr differed from the expected stderr
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args delegation/inherent-impls-non-local-crate.rs`

error: 1 errors occurred comparing output.
status: exit status: 1
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/delegation/inherent-impls-non-local-crate.rs" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2" "--target=aarch64-unknown-linux-gnu" "--check-cfg" "cfg(test,FALSE)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/delegation/inherent-impls-non-local-crate" "-Znext-solver=coherence" "-A" "unused" "-W" "unused_attributes" "-A" "internal_features" "-A" "incomplete_features" "-A" "unused_parens" "-A" "unused_braces" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/aarch64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/delegation/inherent-impls-non-local-crate/auxiliary" "--extern" "inherent_impl=/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/delegation/inherent-impls-non-local-crate/auxiliary/libinherent_impl.so"
stdout: none
--- stderr -------------------------------
error: failed to resolve delegation to inherent impl
##[error]  --> /checkout/tests/ui/delegation/inherent-impls-non-local-crate.rs:7:25
   |
LL | reuse inherent_impl::S::not_existing;
   |                         ^^^^^^^^^^^^

error: failed to resolve delegation to inherent impl
##[error]  --> /checkout/tests/ui/delegation/inherent-impls-non-local-crate.rs:9:25
   |
LL | reuse inherent_impl::S::TYPE;
   |                         ^^^^

error: failed to resolve delegation to inherent impl
##[error]  --> /checkout/tests/ui/delegation/inherent-impls-non-local-crate.rs:11:25
   |
LL | reuse inherent_impl::S::CONST;
   |                         ^^^^^

error: failed to resolve delegation to inherent impl
##[error]  --> /checkout/tests/ui/delegation/inherent-impls-non-local-crate.rs:14:25
   |
LL | reuse inherent_impl::S::bar;
   |                         ^^^

error: ambiguous delegation to inherent impl function
##[error]  --> /checkout/tests/ui/delegation/inherent-impls-non-local-crate.rs:19:25
   |
LL | reuse inherent_impl::X::foo as x_foo;
   |                         ^^^

error[E0599]: no associated function or constant named `not_existing` found for struct `S` in the current scope
##[error]  --> /checkout/tests/ui/delegation/inherent-impls-non-local-crate.rs:7:25
   |
LL | reuse inherent_impl::S::not_existing;
   |                         ^^^^^^^^^^^^ associated function or constant not found in `S`

error[E0599]: no associated function or constant named `TYPE` found for struct `S` in the current scope
##[error]  --> /checkout/tests/ui/delegation/inherent-impls-non-local-crate.rs:9:25
   |
LL | reuse inherent_impl::S::TYPE;
   |                         ^^^^ associated function or constant not found in `S`

error[E0618]: expected function, found `usize`
##[error]  --> /checkout/tests/ui/delegation/inherent-impls-non-local-crate.rs:11:25
   |
LL | reuse inherent_impl::S::CONST;
   |                         ^^^^^ call expression requires function

error[E0599]: no associated function or constant named `bar` found for struct `S` in the current scope
##[error]  --> /checkout/tests/ui/delegation/inherent-impls-non-local-crate.rs:14:25
   |
LL | reuse inherent_impl::S::bar;
   |                         ^^^ associated function or constant not found in `S`
   |
   = help: items from traits can only be used if the trait is in scope
help: trait `Trait` which provides `bar` is implemented but not in scope; perhaps you want to import it
   |
LL + use inherent_impl::Trait;
   |

error[E0034]: multiple applicable items in scope
##[error]  --> /checkout/tests/ui/delegation/inherent-impls-non-local-crate.rs:19:25
   |
LL | reuse inherent_impl::X::foo as x_foo;
   |                         ^^^ multiple `foo` found
   |
   = note: candidate #1 is defined in an impl for the type `X<String>`
   = note: candidate #2 is defined in an impl for the type `X<usize>`

error: aborting due to 10 previous errors

Some errors have detailed explanations: E0034, E0599, E0618.
For more information about an error, try `rustc --explain E0034`.
---
- error: aborting due to 2 previous errors
+ error: failed to resolve delegation to inherent impl
+   --> $DIR/unused-import-ice-144594.rs:3:7
+    |
+ LL | reuse a as b {
+    |       ^
+ 
+ error: aborting due to 3 previous errors
14 
15 For more information about this error, try `rustc --explain E0425`.
16 

Note: some mismatched output was normalized before being compared
-   --> /checkout/tests/ui/delegation/unused-import-ice-144594.rs:3:7
+ error: failed to resolve delegation to inherent impl
+   --> $DIR/unused-import-ice-144594.rs:3:7
+    |
+ LL | reuse a as b {
+    |       ^
+ 
+ error: aborting due to 3 previous errors


The actual stderr differed from the expected stderr
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args delegation/unused-import-ice-144594.rs`

error: 1 errors occurred comparing output.
status: exit status: 1
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/delegation/unused-import-ice-144594.rs" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2" "--target=aarch64-unknown-linux-gnu" "--check-cfg" "cfg(test,FALSE)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/delegation/unused-import-ice-144594" "-Znext-solver=coherence" "-A" "unused" "-W" "unused_attributes" "-A" "internal_features" "-A" "incomplete_features" "-A" "unused_parens" "-A" "unused_braces" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/aarch64-unknown-linux-gnu/native/rust-test-helpers"
stdout: none
--- stderr -------------------------------
error[E0425]: cannot find function `a` in this scope
##[error]  --> /checkout/tests/ui/delegation/unused-import-ice-144594.rs:3:7
   |
---
To only update this specific test, also pass `--test-args delegation/wrong-lifetime-rib.rs`

error: 1 errors occurred comparing output.
status: exit status: 1
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/delegation/wrong-lifetime-rib.rs" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2" "--target=aarch64-unknown-linux-gnu" "--check-cfg" "cfg(test,FALSE)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/delegation/wrong-lifetime-rib" "-Znext-solver=coherence" "-A" "unused" "-W" "unused_attributes" "-A" "internal_features" "-A" "incomplete_features" "-A" "unused_parens" "-A" "unused_braces" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/aarch64-unknown-linux-gnu/native/rust-test-helpers" "--edition=2024"
stdout: none
--- stderr -------------------------------
error[E0423]: expected function, found unit variant `None`
##[error]  --> /checkout/tests/ui/delegation/wrong-lifetime-rib.rs:11:15
   |
---

error: inferred lifetimes are not allowed in delegations as we need to inherit signature
##[error]  --> /checkout/tests/ui/delegation/wrong-lifetime-rib.rs:17:18
   |
LL |     reuse foo::<&&&&&&&&&&()> as foo1;
   |                  ^

error: inferred lifetimes are not allowed in delegations as we need to inherit signature
##[error]  --> /checkout/tests/ui/delegation/wrong-lifetime-rib.rs:17:19
   |
LL |     reuse foo::<&&&&&&&&&&()> as foo1;
   |                   ^

error: inferred lifetimes are not allowed in delegations as we need to inherit signature
##[error]  --> /checkout/tests/ui/delegation/wrong-lifetime-rib.rs:17:20
   |
LL |     reuse foo::<&&&&&&&&&&()> as foo1;
   |                    ^

error: inferred lifetimes are not allowed in delegations as we need to inherit signature
##[error]  --> /checkout/tests/ui/delegation/wrong-lifetime-rib.rs:17:21
   |
LL |     reuse foo::<&&&&&&&&&&()> as foo1;
   |                     ^

error: inferred lifetimes are not allowed in delegations as we need to inherit signature
##[error]  --> /checkout/tests/ui/delegation/wrong-lifetime-rib.rs:17:22
   |
LL |     reuse foo::<&&&&&&&&&&()> as foo1;
   |                      ^

error: inferred lifetimes are not allowed in delegations as we need to inherit signature
##[error]  --> /checkout/tests/ui/delegation/wrong-lifetime-rib.rs:17:23
   |
LL |     reuse foo::<&&&&&&&&&&()> as foo1;
   |                       ^

error: inferred lifetimes are not allowed in delegations as we need to inherit signature
##[error]  --> /checkout/tests/ui/delegation/wrong-lifetime-rib.rs:17:24
   |
LL |     reuse foo::<&&&&&&&&&&()> as foo1;
   |                        ^

error: inferred lifetimes are not allowed in delegations as we need to inherit signature
##[error]  --> /checkout/tests/ui/delegation/wrong-lifetime-rib.rs:17:25
   |
LL |     reuse foo::<&&&&&&&&&&()> as foo1;
   |                         ^

error: inferred lifetimes are not allowed in delegations as we need to inherit signature
##[error]  --> /checkout/tests/ui/delegation/wrong-lifetime-rib.rs:17:26
   |
LL |     reuse foo::<&&&&&&&&&&()> as foo1;
   |                          ^

error: inferred lifetimes are not allowed in delegations as we need to inherit signature
##[error]  --> /checkout/tests/ui/delegation/wrong-lifetime-rib.rs:17:27
   |
LL |     reuse foo::<&&&&&&&&&&()> as foo1;
   |                           ^

error: inferred lifetimes are not allowed in delegations as we need to inherit signature
##[error]  --> /checkout/tests/ui/delegation/wrong-lifetime-rib.rs:28:18
   |
LL |     reuse foo::<&std::borrow::Cow<'_, &()>> as foo2;
   |                  ^

error: inferred lifetimes are not allowed in delegations as we need to inherit signature
##[error]  --> /checkout/tests/ui/delegation/wrong-lifetime-rib.rs:28:35
   |
LL |     reuse foo::<&std::borrow::Cow<'_, &()>> as foo2;
   |                                   ^^

error: inferred lifetimes are not allowed in delegations as we need to inherit signature
##[error]  --> /checkout/tests/ui/delegation/wrong-lifetime-rib.rs:28:40
   |
LL |     reuse foo::<&std::borrow::Cow<'_, &()>> as foo2;
   |                                        ^

error[E0782]: expected a type, found a trait
##[error]  --> /checkout/tests/ui/delegation/wrong-lifetime-rib.rs:39:10
   |
LL |     impl X { //~ ERROR: expected a type, found a trait
   |          ^
   |
help: you can add the `dyn` keyword if you want a trait object
   |
LL |     impl dyn X { //~ ERROR: expected a type, found a trait
   |          +++
help: you might have intended to implement this trait for a given type
   |
LL |     impl X for /* Type */ { //~ ERROR: expected a type, found a trait
   |            ++++++++++++++

error[E0782]: expected a type, found a trait
##[error]  --> /checkout/tests/ui/delegation/wrong-lifetime-rib.rs:48:10
   |
LL |     impl X { //~ ERROR: expected a type, found a trait
   |          ^
   |
help: you can add the `dyn` keyword if you want a trait object
   |
LL |     impl dyn X { //~ ERROR: expected a type, found a trait
   |          +++
help: you might have intended to implement this trait for a given type
   |
LL |     impl X for /* Type */ { //~ ERROR: expected a type, found a trait
   |            ++++++++++++++

error[E0116]: cannot define inherent `impl` for a type outside of the crate where the type is defined
##[error]  --> /checkout/tests/ui/delegation/wrong-lifetime-rib.rs:9:5
   |
LL |     impl Trait {
   |     ^^^^^^^^^^ impl for type defined outside of crate
   |
   = help: consider defining a trait and implementing it for the type or using a newtype wrapper like `struct MyType(ExternalType);` and implement it
   = note: for more details about the orphan rules, see <https://doc.rust-lang.org/reference/items/implementations.html?highlight=orphan#orphan-rules>

error[E0223]: ambiguous associated type
##[error]  --> /checkout/tests/ui/delegation/wrong-lifetime-rib.rs:40:16
   |
LL |         reuse<<<&Project> :: Ty> :: Ty as Iterator>::next;
   |                ^^^^^^^^^^^^^^^^
   |
help: if there were a trait named `Example` with associated type `Ty` implemented for `&()`, you could use the fully-qualified path
   |
LL -         reuse<<<&Project> :: Ty> :: Ty as Iterator>::next;
LL +         reuse<<<&() as Example>::Ty> :: Ty as Iterator>::next;
   |

error[E0782]: expected a type, found a trait
##[error]  --> /checkout/tests/ui/delegation/wrong-lifetime-rib.rs:50:21
   |
LL |             let _: &X; //~ ERROR: expected a type, found a trait
   |                     ^
   |
help: you can add the `dyn` keyword if you want a trait object
   |
LL |             let _: &dyn X; //~ ERROR: expected a type, found a trait
   |                     +++

error: aborting due to 20 previous errors

Some errors have detailed explanations: E0116, E0223, E0423, E0782.

@sylvesterkaczmarek sylvesterkaczmarek left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this is broader than the ICE case. Every TypeRelativeDelegationRes::Error now emits a fresh generic diagnostic, including failures that already reported the real resolution error; the current bad-resolve.rs CI diff shows six extra messages. Could we keep an already-reported ErrorGuaranteed path and only emit this diagnostic for the unresolved inherent case?

View changes since this review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[ICE]: failed to resolve delegation to inherent impl

5 participants