Skip to content

Error on projection of dyn noncompat type in old trait solver#154992

Open
spirali wants to merge 2 commits into
rust-lang:mainfrom
spirali:fix-dyn-projection
Open

Error on projection of dyn noncompat type in old trait solver#154992
spirali wants to merge 2 commits into
rust-lang:mainfrom
spirali:fix-dyn-projection

Conversation

@spirali

@spirali spirali commented Apr 8, 2026

Copy link
Copy Markdown
Contributor

View all comments

Trying to fix rust-lang/trait-system-refactor-initiative#269

I am not sure that the check is placed into the right place in the code.

r? lcnr

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Apr 8, 2026
@rustbot rustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Apr 8, 2026
//~^ ERROR the trait `Foo` is not dyn compatible
x.method();
//~^ ERROR the trait `Foo` is not dyn compatible
//~^ ERROR no method named `method` found for reference `&dyn Foo`

@lcnr lcnr Apr 9, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

View changes since the review

that's annoying :< ideally we'd silence method errors if the self type is not well-formed, tracking that is non-trivial and I don't know how we'd do so myself rn

@lcnr

lcnr commented Apr 9, 2026

Copy link
Copy Markdown
Contributor

lgtm, let's do a crater run, there should be exactly 1 regression from this

@bors try

@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Apr 9, 2026
Error on projection of dyn noncompat type in old trait solver
@rust-bors

rust-bors Bot commented Apr 9, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: a611f2a (a611f2a14e38407ec6717a86a01424ee6fc80762, parent: 1fe72d35998dea48aeecaf7fc07783b0b553f24f)

@lcnr

lcnr commented Apr 9, 2026

Copy link
Copy Markdown
Contributor

@craterbot check

@craterbot

Copy link
Copy Markdown
Collaborator

👌 Experiment pr-154992 created and queued.
🤖 Automatically detected try build a611f2a
🔍 You can check out the queue and this experiment's details.

ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@craterbot craterbot added S-waiting-on-crater Status: Waiting on a crater run to be completed. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 9, 2026
@craterbot

Copy link
Copy Markdown
Collaborator

🚧 Experiment pr-154992 is now running

ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@craterbot

Copy link
Copy Markdown
Collaborator

🎉 Experiment pr-154992 is completed!
📊 18 regressed and 6 fixed (886019 total)
📊 5676 spurious results on the retry-regressed-list.txt, consider a retry1 if this is a significant amount.
📰 Open the summary report.

⚠️ If you notice any spurious failure please add them to the denylist!
ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

Footnotes

  1. re-run the experiment with crates=https://crater-reports.s3.amazonaws.com/pr-154992/retry-regressed-list.txt

@craterbot craterbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-crater Status: Waiting on a crater run to be completed. labels Apr 22, 2026
@lcnr

lcnr commented Apr 27, 2026

Copy link
Copy Markdown
Contributor

@craterbot

Copy link
Copy Markdown
Collaborator

👌 Experiment pr-154992-1 created and queued.
🤖 Automatically detected try build a611f2a
🔍 You can check out the queue and this experiment's details.

ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@craterbot craterbot added S-waiting-on-crater Status: Waiting on a crater run to be completed. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 27, 2026
@lcnr

lcnr commented Apr 27, 2026

Copy link
Copy Markdown
Contributor

@craterbot p=1

@craterbot

Copy link
Copy Markdown
Collaborator

📝 Configuration of the pr-154992-1 experiment changed.

ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@craterbot

Copy link
Copy Markdown
Collaborator

🚧 Experiment pr-154992-1 is now running

ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@craterbot

Copy link
Copy Markdown
Collaborator

🎉 Experiment pr-154992-1 is completed!
📊 13 regressed and 0 fixed (5381 total)
📊 968 spurious results on the retry-regressed-list.txt, consider a retry1 if this is a significant amount.
📰 Open the summary report.

⚠️ If you notice any spurious failure please add them to the denylist!
ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

Footnotes

  1. re-run the experiment with crates=https://crater-reports.s3.amazonaws.com/pr-154992-1/retry-regressed-list.txt

@craterbot craterbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-crater Status: Waiting on a crater run to be completed. labels Apr 27, 2026
@lcnr

lcnr commented Apr 29, 2026

Copy link
Copy Markdown
Contributor

@craterbot check crates=https://crater-reports.s3.amazonaws.com/pr-154992-1/retry-regressed-list.txt p=1

surprising that we have that many spurious regressions still?

it's caused by build OOMs and unlike the new solver, this PR shouldn't really change max-rss in any way 😅 cc @rust-lang/infra

@craterbot

Copy link
Copy Markdown
Collaborator

👌 Experiment pr-154992-2 created and queued.
🤖 Automatically detected try build a611f2a
🔍 You can check out the queue and this experiment's details.

ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@craterbot craterbot added S-waiting-on-crater Status: Waiting on a crater run to be completed. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 29, 2026
@craterbot

Copy link
Copy Markdown
Collaborator

🚧 Experiment pr-154992-2 is now running

ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@craterbot

Copy link
Copy Markdown
Collaborator

🎉 Experiment pr-154992-2 is completed!
📊 12 regressed and 0 fixed (981 total)
📊 777 spurious results on the retry-regressed-list.txt, consider a retry1 if this is a significant amount.
📰 Open the summary report.

⚠️ If you notice any spurious failure please add them to the denylist!
ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

Footnotes

  1. re-run the experiment with crates=https://crater-reports.s3.amazonaws.com/pr-154992-2/retry-regressed-list.txt

@craterbot craterbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-crater Status: Waiting on a crater run to be completed. labels Apr 30, 2026
@lcnr

lcnr commented May 5, 2026

Copy link
Copy Markdown
Contributor

@craterbot

Copy link
Copy Markdown
Collaborator

👌 Experiment pr-154992-3 created and queued.
🤖 Automatically detected try build a611f2a
🔍 You can check out the queue and this experiment's details.

ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@craterbot craterbot added S-waiting-on-crater Status: Waiting on a crater run to be completed. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels May 5, 2026
@craterbot

Copy link
Copy Markdown
Collaborator

🚧 Experiment pr-154992-3 is now running

ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@craterbot

Copy link
Copy Markdown
Collaborator

🎉 Experiment pr-154992-3 is completed!
📊 12 regressed and 0 fixed (789 total)
📊 731 spurious results on the retry-regressed-list.txt, consider a retry1 if this is a significant amount.
📰 Open the summary report.

⚠️ If you notice any spurious failure please add them to the denylist!
ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

Footnotes

  1. re-run the experiment with crates=https://crater-reports.s3.amazonaws.com/pr-154992-3/retry-regressed-list.txt

@craterbot craterbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-crater Status: Waiting on a crater run to be completed. labels May 6, 2026
@lcnr

lcnr commented May 7, 2026

Copy link
Copy Markdown
Contributor

Alright 🤔 @spirali can you look at the crater report and figure out whether they are expected?

@spirali

spirali commented Jun 5, 2026

Copy link
Copy Markdown
Contributor Author

Oh, I had some problems with notifications again. I will look at it.

Alright 🤔 @spirali can you look at the crater report and figure out whether they are expected?

@spirali

spirali commented Jun 23, 2026

Copy link
Copy Markdown
Contributor Author

It seems that all fails are realated to a single crate: git-url-parse crate; in code:

    fn path_abempty_parser<'url>(
    ) -> impl Parser<
        &'url str,
        Output = <dyn Parser<&'url str, Output = &'url str, Error = nom::error::Error<&'url str>> as Parser<
            &'url str,
        >>::Output,
        Error = nom::error::Error<&'url str>,
    >{

it fails with error:

info: `cargo` is unavailable for the active toolchain
info: falling back to "/home/ada/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/cargo"
    Checking git-url-parse v0.6.0 (/home/ada/projects/git-url-parse-rs)
error[E0271]: type mismatch resolving `<Context<...> as Parser<...>>::Output == <... as Parser<...>>::Output`
   --> src/types/spec.rs:374:10
    |
374 |       ) -> impl Parser<
    |  __________^
375 | |         &'url str,
376 | |         Output = <dyn Parser<&'url str, Output = &'url str, Error = nom::error::Error<&'url str>> as Parser<
377 | |             &'url str,
378 | |         >>::Output,
379 | |         Error = nom::error::Error<&'url str>,
380 | |     >{
    | |_____^ expected associated type, found `&str`
    |
    = note: expected associated type `<(dyn Parser<&'url str, Error = nom::error::Error<&'url str>, Output = &'url str> + 'static) as Parser<&'url str>>::Output`
                     found reference `&'url str`
    = help: consider constraining the associated type `<(dyn Parser<&'url str, Error = nom::error::Error<&'url str>, Output = &'url str> + 'static) as Parser<&'url str>>::Output` to `&'url str` or calling a method that returns `<(dyn Parser<&'url str, Error = nom::error::Error<&'url str>, Output = &'url str> + 'static) as Parser<&'url str>>::Output`
    = note: for more information, visit https://doc.rust-lang.org/book/ch19-03-advanced-traits.html
    = note: the full name for the type has been written to '/home/ada/projects/git-url-parse-rs/target/debug/deps/git_url_parse-15b0a6ff9f5232d5.long-type-8233111347681804376.txt'
    = note: consider using `--verbose` to print the full type name to the console

error[E0271]: type mismatch resolving `<Context<...> as Parser<...>>::Output == <... as Parser<...>>::Output`
   --> src/types/spec.rs:398:10
    |
398 |       ) -> impl Parser<
    |  __________^
399 | |         &'url str,
400 | |         Output = <dyn Parser<&'url str, Output = &'url str, Error = nom::error::Error<&'url str>> as Parser<
401 | |             &'url str,
402 | |         >>::Output,
403 | |         Error = nom::error::Error<&'url str>,
404 | |     >{
    | |_____^ expected associated type, found `&str`
    |
    = note: expected associated type `<(dyn Parser<&'url str, Error = nom::error::Error<&'url str>, Output = &'url str> + 'static) as Parser<&'url str>>::Output`
                     found reference `&'url str`
    = help: consider constraining the associated type `<(dyn Parser<&'url str, Error = nom::error::Error<&'url str>, Output = &'url str> + 'static) as Parser<&'url str>>::Output` to `&'url str` or calling a method that returns `<(dyn Parser<&'url str, Error = nom::error::Error<&'url str>, Output = &'url str> + 'static) as Parser<&'url str>>::Output`
    = note: for more information, visit https://doc.rust-lang.org/book/ch19-03-advanced-traits.html
    = note: the full name for the type has been written to '/home/ada/projects/git-url-parse-rs/target/debug/deps/git_url_parse-15b0a6ff9f5232d5.long-type-5159688081705980566.txt'
    = note: consider using `--verbose` to print the full type name to the console

error[E0271]: type mismatch resolving `<Context<...> as Parser<...>>::Output == <... as Parser<...>>::Output`
   --> src/types/spec.rs:422:10
    |
422 |       ) -> impl Parser<
    |  __________^
423 | |         &'url str,
424 | |         Output = <dyn Parser<&'url str, Output = &'url str, Error = nom::error::Error<&'url str>> as Parser<
425 | |             &'url str,
426 | |         >>::Output,
427 | |         Error = nom::error::Error<&'url str>,
428 | |     >{
    | |_____^ expected associated type, found `&str`
    |
    = note: expected associated type `<(dyn Parser<&'url str, Error = nom::error::Error<&'url str>, Output = &'url str> + 'static) as Parser<&'url str>>::Output`
                     found reference `&'url str`
    = help: consider constraining the associated type `<(dyn Parser<&'url str, Error = nom::error::Error<&'url str>, Output = &'url str> + 'static) as Parser<&'url str>>::Output` to `&'url str` or calling a method that returns `<(dyn Parser<&'url str, Error = nom::error::Error<&'url str>, Output = &'url str> + 'static) as Parser<&'url str>>::Output`
    = note: for more information, visit https://doc.rust-lang.org/book/ch19-03-advanced-traits.html
    = note: the full name for the type has been written to '/home/ada/projects/git-url-parse-rs/target/debug/deps/git_url_parse-15b0a6ff9f5232d5.long-type-15696984571572880886.txt'
    = note: consider using `--verbose` to print the full type name to the console

error[E0271]: type mismatch resolving `<Context<...> as Parser<...>>::Output == <... as Parser<...>>::Output`
   --> src/types/spec.rs:444:43
    |
444 |       fn short_git_scheme_parser<'url>() -> impl Parser<
    |  ___________________________________________^
445 | |         &'url str,
446 | |         Output = <dyn Parser<
447 | |             &'url str,
...   |
451 | |         Error = nom::error::Error<&'url str>,
452 | |     > {
    | |_____^ expected associated type, found `Option<&str>`
...
458 | /         context(
459 | |             "short git scheme parse",
460 | |             opt(terminated(
461 | |                 tag::<&str, &str, nom::error::Error<&str>>("git"),
462 | |                 tag::<&str, &str, nom::error::Error<&str>>(":"),
463 | |             )),
464 | |         )
    | |_________- return type was inferred to be `Context<impl Parser<&str, Output = Option<...>, Error = ...>>` here
    |
    = note: expected associated type `<(dyn Parser<&'url str, Error = nom::error::Error<&'url str>, Output = Option<&'url str>> + 'static) as Parser<&'url str>>::Output`
                          found enum `Option<&'url str>`
    = help: consider constraining the associated type `<(dyn Parser<&'url str, Error = nom::error::Error<&'url str>, Output = Option<&'url str>> + 'static) as Parser<&'url str>>::Output` to `Option<&'url str>` or calling a method that returns `<(dyn Parser<&'url str, Error = nom::error::Error<&'url str>, Output = Option<&'url str>> + 'static) as Parser<&'url str>>::Output`
    = note: for more information, visit https://doc.rust-lang.org/book/ch19-03-advanced-traits.html
    = note: the full name for the type has been written to '/home/ada/projects/git-url-parse-rs/target/debug/deps/git_url_parse-15b0a6ff9f5232d5.long-type-14154493317055821403.txt'
    = note: consider using `--verbose` to print the full type name to the console

error[E0038]: the trait `Parser` is not dyn compatible
   --> src/types/spec.rs:78:74
    |
 78 |             if let Ok((input, scheme)) = Self::short_git_scheme_parser().parse(input) {
    |                                                                          ^^^^^ `Parser` is not dyn compatible
    |
note: for a trait to be dyn compatible it needs to allow building a vtable
      for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
   --> /home/ada/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/nom-8.0.0/src/internal.rs:425:6
    |
425 |   fn process<OM: OutputMode>(
    |      ^^^^^^^ the trait is not dyn compatible because method `process` has generic type parameters

error[E0599]: the method `map` exists for associated type `<dyn Parser<&str, Error = ..., Output = ...> as Parser<...>>::Output`, but its trait bounds were not satisfied
  --> src/types/spec.rs:79:42
   |
79 |                 return Ok((input, scheme.map(|s| s.to_string())));
   |                                          ^^^ method cannot be called due to unsatisfied trait bounds
   |
   = note: the following trait bounds were not satisfied:
           `<<(dyn Parser<&str, Error = nom::error::Error<&str>, Output = Option<&str>> + 'static) as Parser<&str>>::Output as FnOnce<(_,)>>::Output = Result<(_, _), nom::Err<_>>`
           which is required by `<(dyn Parser<&str, Error = nom::error::Error<&str>, Output = Option<&str>> + 'static) as Parser<&str>>::Output: Parser<_>`
           `<(dyn Parser<&str, Error = nom::error::Error<&str>, Output = Option<&str>> + 'static) as Parser<&str>>::Output: FnMut<(_,)>`
           which is required by `<(dyn Parser<&str, Error = nom::error::Error<&str>, Output = Option<&str>> + 'static) as Parser<&str>>::Output: Parser<_>`
           `<&<(dyn Parser<&str, Error = nom::error::Error<&str>, Output = Option<&str>> + 'static) as Parser<&str>>::Output as FnOnce<(_,)>>::Output = Result<(_, _), nom::Err<_>>`
           which is required by `&<(dyn Parser<&str, Error = nom::error::Error<&str>, Output = Option<&str>> + 'static) as Parser<&str>>::Output: Parser<_>`
           `&<(dyn Parser<&str, Error = nom::error::Error<&str>, Output = Option<&str>> + 'static) as Parser<&str>>::Output: FnMut<(_,)>`
           which is required by `&<(dyn Parser<&str, Error = nom::error::Error<&str>, Output = Option<&str>> + 'static) as Parser<&str>>::Output: Parser<_>`
           `<&mut <(dyn Parser<&str, Error = nom::error::Error<&str>, Output = Option<&str>> + 'static) as Parser<&str>>::Output as FnOnce<(_,)>>::Output = Result<(_, _), nom::Err<_>>`
           which is required by `&mut <(dyn Parser<&str, Error = nom::error::Error<&str>, Output = Option<&str>> + 'static) as Parser<&str>>::Output: Parser<_>`
           `&mut <(dyn Parser<&str, Error = nom::error::Error<&str>, Output = Option<&str>> + 'static) as Parser<&str>>::Output: FnMut<(_,)>`
           which is required by `&mut <(dyn Parser<&str, Error = nom::error::Error<&str>, Output = Option<&str>> + 'static) as Parser<&str>>::Output: Parser<_>`
           `<(dyn Parser<&str, Error = nom::error::Error<&str>, Output = Option<&str>> + 'static) as Parser<&str>>::Output: Iterator`
           which is required by `&mut <(dyn Parser<&str, Error = nom::error::Error<&str>, Output = Option<&str>> + 'static) as Parser<&str>>::Output: Iterator`
   = note: the full name for the type has been written to '/home/ada/projects/git-url-parse-rs/target/debug/deps/git_url_parse-15b0a6ff9f5232d5.long-type-14690613962513128976.txt'
   = note: consider using `--verbose` to print the full type name to the console

error[E0038]: the trait `Parser` is not dyn compatible
   --> src/types/spec.rs:143:13
    |
143 |             verify(
    |             ^^^^^^ `Parser` is not dyn compatible
    |
note: for a trait to be dyn compatible it needs to allow building a vtable
      for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
   --> /home/ada/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/nom-8.0.0/src/internal.rs:425:6
    |
425 |   fn process<OM: OutputMode>(
    |      ^^^^^^^ the trait is not dyn compatible because method `process` has generic type parameters

error[E0631]: type mismatch in closure arguments
   --> src/types/spec.rs:143:13
    |
143 | /             verify(
144 | |                 alt((
145 | |                     //preceded(tag("//"), Self::path_abempty_parser()),
146 | |                     Self::path_abempty_parser(),
...   |
150 | |                 |s: &str| !s.is_empty(),
    | |                 --------- found signature defined here
151 | |             ),
    | |_____________^ expected due to this
    |
    = note: expected closure signature `for<'a> fn(&'a <(dyn Parser<&str, Error = nom::error::Error<&str>, Output = &str> + 'static) as Parser<&str>>::Output) -> _`
               found closure signature `fn(&str) -> _`
note: required by a bound in `verify`
   --> /home/ada/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/nom-8.0.0/src/combinator/mod.rs:501:6
    |
495 | pub fn verify<I: Clone, O2, E: ParseError<I>, F, G>(
    |        ------ required by a bound in this function
...
501 |   G: Fn(&O2) -> bool,
    |      ^^^^^^^^^^^^^^^ required by this bound in `verify`

error[E0038]: the trait `Parser` is not dyn compatible
   --> src/types/spec.rs:143:13
    |
143 | /             verify(
144 | |                 alt((
145 | |                     //preceded(tag("//"), Self::path_abempty_parser()),
146 | |                     Self::path_abempty_parser(),
...   |
150 | |                 |s: &str| !s.is_empty(),
151 | |             ),
    | |_____________^ `Parser` is not dyn compatible
    |
note: for a trait to be dyn compatible it needs to allow building a vtable
      for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
   --> /home/ada/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/nom-8.0.0/src/internal.rs:425:6
    |
425 |   fn process<OM: OutputMode>(
    |      ^^^^^^^ the trait is not dyn compatible because method `process` has generic type parameters

error[E0631]: type mismatch in closure arguments
   --> src/types/spec.rs:141:29
    |
141 |         let (input, path) = context(
    |                             ^^^^^^^ expected due to this
...
150 |                 |s: &str| !s.is_empty(),
    |                 --------- found signature defined here
    |
    = note: expected closure signature `for<'a> fn(&'a <(dyn Parser<&str, Error = nom::error::Error<&str>, Output = &str> + 'static) as Parser<&str>>::Output) -> _`
               found closure signature `fn(&str) -> _`
note: required by a bound in `verify`
   --> /home/ada/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/nom-8.0.0/src/combinator/mod.rs:501:6
    |
495 | pub fn verify<I: Clone, O2, E: ParseError<I>, F, G>(
    |        ------ required by a bound in this function
...
501 |   G: Fn(&O2) -> bool,
    |      ^^^^^^^^^^^^^^^ required by this bound in `verify`

error[E0038]: the trait `Parser` is not dyn compatible
   --> src/types/spec.rs:141:29
    |
141 |         let (input, path) = context(
    |                             ^^^^^^^ `Parser` is not dyn compatible
    |
note: for a trait to be dyn compatible it needs to allow building a vtable
      for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
   --> /home/ada/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/nom-8.0.0/src/internal.rs:425:6
    |
425 |   fn process<OM: OutputMode>(
    |      ^^^^^^^ the trait is not dyn compatible because method `process` has generic type parameters

error[E0631]: type mismatch in closure arguments
   --> src/types/spec.rs:141:29
    |
141 |           let (input, path) = context(
    |  _____________________________^
142 | |             "Top of path parsers",
143 | |             verify(
144 | |                 alt((
...   |
150 | |                 |s: &str| !s.is_empty(),
    | |                 --------- found signature defined here
151 | |             ),
152 | |         )
    | |_________^ expected due to this
    |
    = note: expected closure signature `for<'a> fn(&'a <(dyn Parser<&str, Error = nom::error::Error<&str>, Output = &str> + 'static) as Parser<&str>>::Output) -> _`
               found closure signature `fn(&str) -> _`
note: required by a bound in `verify`
   --> /home/ada/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/nom-8.0.0/src/combinator/mod.rs:501:6
    |
495 | pub fn verify<I: Clone, O2, E: ParseError<I>, F, G>(
    |        ------ required by a bound in this function
...
501 |   G: Fn(&O2) -> bool,
    |      ^^^^^^^^^^^^^^^ required by this bound in `verify`

error[E0038]: the trait `Parser` is not dyn compatible
   --> src/types/spec.rs:141:29
    |
141 |           let (input, path) = context(
    |  _____________________________^
142 | |             "Top of path parsers",
143 | |             verify(
144 | |                 alt((
...   |
151 | |             ),
152 | |         )
    | |_________^ `Parser` is not dyn compatible
    |
note: for a trait to be dyn compatible it needs to allow building a vtable
      for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
   --> /home/ada/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/nom-8.0.0/src/internal.rs:425:6
    |
425 |   fn process<OM: OutputMode>(
    |      ^^^^^^^ the trait is not dyn compatible because method `process` has generic type parameters

error[E0631]: type mismatch in closure arguments
   --> src/types/spec.rs:141:29
    |
141 |           let (input, path) = context(
    |  _____________________________^
142 | |             "Top of path parsers",
143 | |             verify(
144 | |                 alt((
...   |
150 | |                 |s: &str| !s.is_empty(),
    | |                 --------- found signature defined here
...   |
153 | |         .parse(input)?;
    | |_____________________^ expected due to this
    |
    = note: expected closure signature `for<'a> fn(&'a <(dyn Parser<&str, Error = nom::error::Error<&str>, Output = &str> + 'static) as Parser<&str>>::Output) -> _`
               found closure signature `fn(&str) -> _`
note: required by a bound in `verify`
   --> /home/ada/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/nom-8.0.0/src/combinator/mod.rs:501:6
    |
495 | pub fn verify<I: Clone, O2, E: ParseError<I>, F, G>(
    |        ------ required by a bound in this function
...
501 |   G: Fn(&O2) -> bool,
    |      ^^^^^^^^^^^^^^^ required by this bound in `verify`

error[E0038]: the trait `Parser` is not dyn compatible
   --> src/types/spec.rs:141:29
    |
141 |           let (input, path) = context(
    |  _____________________________^
142 | |             "Top of path parsers",
143 | |             verify(
144 | |                 alt((
...   |
153 | |         .parse(input)?;
    | |_____________________^ `Parser` is not dyn compatible
    |
note: for a trait to be dyn compatible it needs to allow building a vtable
      for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
   --> /home/ada/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/nom-8.0.0/src/internal.rs:425:6
    |
425 |   fn process<OM: OutputMode>(
    |      ^^^^^^^ the trait is not dyn compatible because method `process` has generic type parameters

error[E0038]: the trait `Parser` is not dyn compatible
   --> src/types/spec.rs:141:29
    |
141 |           let (input, path) = context(
    |  _____________________________^
142 | |             "Top of path parsers",
143 | |             verify(
144 | |                 alt((
...   |
153 | |         .parse(input)?;
    | |______________________^ `Parser` is not dyn compatible
    |
note: for a trait to be dyn compatible it needs to allow building a vtable
      for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
   --> /home/ada/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/nom-8.0.0/src/internal.rs:425:6
    |
425 |   fn process<OM: OutputMode>(
    |      ^^^^^^^ the trait is not dyn compatible because method `process` has generic type parameters

error[E0599]: `<dyn Parser<&str, Error = ..., Output = ...> as Parser<...>>::Output` doesn't implement `std::fmt::Display`
   --> src/types/spec.rs:157:24
    |
157 |             path: path.to_string(),
    |                        ^^^^^^^^^ method cannot be called due to unsatisfied trait bounds
    |
    = note: the following trait bounds were not satisfied:
            `<(dyn Parser<&str, Error = nom::error::Error<&str>, Output = &str> + 'static) as Parser<&str>>::Output: std::fmt::Display`
            which is required by `<(dyn Parser<&str, Error = nom::error::Error<&str>, Output = &str> + 'static) as Parser<&str>>::Output: ToString`
    = note: the full name for the type has been written to '/home/ada/projects/git-url-parse-rs/target/debug/deps/git_url_parse-15b0a6ff9f5232d5.long-type-9985031168499164621.txt'
    = note: consider using `--verbose` to print the full type name to the console

Some errors have detailed explanations: E0038, E0271, E0599, E0631.
For more information about an error, try `rustc --explain E0038`.
error: could not compile `git-url-parse` (lib) due to 17 previous errors

It seems that error message is correct as the Parser (that comes from nom) is not dyn-compatible.

@lcnr

lcnr commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

yeah, valid regression, these error messages are horrible though 😅

I think getting errors at every callsite is hard to avoid rn. I don't quite get why we get type mismatch errors here though. I would hope that failing to normalize would instead just result in stuff being tainted or sth, silencing/avoidng the type mismatch

do you have an idea what's going on there/are you able to minimize that?

@rustbot

This comment has been minimized.

@spirali spirali force-pushed the fix-dyn-projection branch from a17fd3c to 882e563 Compare June 29, 2026 10:08
@rustbot

rustbot commented Jun 29, 2026

Copy link
Copy Markdown
Collaborator

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@rust-log-analyzer

This comment has been minimized.

@spirali spirali force-pushed the fix-dyn-projection branch from 882e563 to 2ffefb5 Compare June 29, 2026 10:16
@spirali

spirali commented Jun 29, 2026

Copy link
Copy Markdown
Contributor Author

I have implemented a new version. It suppresses downstream errors by returning a Progress with a tainted type. As I understand, the previous version had a problem that leads to find no candidates and eventually returns NoProgress from project() that triggers unrelated errors.

git-url-parse-rs now returns the following error messages that just straightforwardly indicates that Parser is not dyn compatible.

error[E0038]: the trait `Parser` is not dyn compatible
   --> src/types/spec.rs:374:10
    |
374 |       ) -> impl Parser<
    |  __________^
375 | |         &'url str,
376 | |         Output = <dyn Parser<&'url str, Output = &'url str, Error = nom::error::Error<&'url str>> as Parser<
377 | |             &'url str,
378 | |         >>::Output,
379 | |         Error = nom::error::Error<&'url str>,
380 | |     >{
    | |_____^ `Parser` is not dyn compatible
    |
note: for a trait to be dyn compatible it needs to allow building a vtable
      for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
   --> /home/ada/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/nom-8.0.0/src/internal.rs:425:6
    |
425 |   fn process<OM: OutputMode>(
    |      ^^^^^^^ the trait is not dyn compatible because method `process` has generic type parameters

error[E0038]: the trait `Parser` is not dyn compatible
   --> src/types/spec.rs:398:10
    |
398 |       ) -> impl Parser<
    |  __________^
399 | |         &'url str,
400 | |         Output = <dyn Parser<&'url str, Output = &'url str, Error = nom::error::Error<&'url str>> as Parser<
401 | |             &'url str,
402 | |         >>::Output,
403 | |         Error = nom::error::Error<&'url str>,
404 | |     >{
    | |_____^ `Parser` is not dyn compatible
    |
note: for a trait to be dyn compatible it needs to allow building a vtable
      for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
   --> /home/ada/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/nom-8.0.0/src/internal.rs:425:6
    |
425 |   fn process<OM: OutputMode>(
    |      ^^^^^^^ the trait is not dyn compatible because method `process` has generic type parameters

error[E0038]: the trait `Parser` is not dyn compatible
   --> src/types/spec.rs:422:10
    |
422 |       ) -> impl Parser<
    |  __________^
423 | |         &'url str,
424 | |         Output = <dyn Parser<&'url str, Output = &'url str, Error = nom::error::Error<&'url str>> as Parser<
425 | |             &'url str,
426 | |         >>::Output,
427 | |         Error = nom::error::Error<&'url str>,
428 | |     >{
    | |_____^ `Parser` is not dyn compatible
    |
note: for a trait to be dyn compatible it needs to allow building a vtable
      for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
   --> /home/ada/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/nom-8.0.0/src/internal.rs:425:6
    |
425 |   fn process<OM: OutputMode>(
    |      ^^^^^^^ the trait is not dyn compatible because method `process` has generic type parameters

error[E0038]: the trait `Parser` is not dyn compatible
   --> src/types/spec.rs:444:43
    |
444 |       fn short_git_scheme_parser<'url>() -> impl Parser<
    |  ___________________________________________^
445 | |         &'url str,
446 | |         Output = <dyn Parser<
447 | |             &'url str,
...   |
451 | |         Error = nom::error::Error<&'url str>,
452 | |     > {
    | |_____^ `Parser` is not dyn compatible
    |
note: for a trait to be dyn compatible it needs to allow building a vtable
      for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
   --> /home/ada/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/nom-8.0.0/src/internal.rs:425:6
    |
425 |   fn process<OM: OutputMode>(
    |      ^^^^^^^ the trait is not dyn compatible because method `process` has generic type parameters

error[E0038]: the trait `Parser` is not dyn compatible
   --> src/types/spec.rs:78:74
    |
 78 |             if let Ok((input, scheme)) = Self::short_git_scheme_parser().parse(input) {
    |                                                                          ^^^^^ `Parser` is not dyn compatible
    |
note: for a trait to be dyn compatible it needs to allow building a vtable
      for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
   --> /home/ada/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/nom-8.0.0/src/internal.rs:425:6
    |
425 |   fn process<OM: OutputMode>(
    |      ^^^^^^^ the trait is not dyn compatible because method `process` has generic type parameters

error[E0038]: the trait `Parser` is not dyn compatible
   --> src/types/spec.rs:143:13
    |
143 | /             verify(
144 | |                 alt((
145 | |                     //preceded(tag("//"), Self::path_abempty_parser()),
146 | |                     Self::path_abempty_parser(),
...   |
150 | |                 |s: &str| !s.is_empty(),
151 | |             ),
    | |_____________^ `Parser` is not dyn compatible
    |
note: for a trait to be dyn compatible it needs to allow building a vtable
      for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
   --> /home/ada/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/nom-8.0.0/src/internal.rs:425:6
    |
425 |   fn process<OM: OutputMode>(
    |      ^^^^^^^ the trait is not dyn compatible because method `process` has generic type parameters

For more information about this error, try `rustc --explain E0038`.
error: could not compile `git-url-parse` (lib) due to 6 previous errors

@rust-log-analyzer

Copy link
Copy Markdown
Collaborator

The job 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)
+ note: for a trait to be dyn compatible it needs to allow building a vtable
+       for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
+   --> $DIR/almost-supertrait-associated-type.rs:32:34
+    |
+ LL | trait Foo<T, U>: Super<ActuallySuper, Assoc = T>
+    |       --- this trait is not dyn compatible...
+ ...
+ LL |     fn transmute(&self, t: T) -> <Self as Super<NotActuallySuper>>::Assoc;
+    |                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ...because method `transmute` references the `Self` type in its return type
+    = help: consider moving `transmute` to another trait
+ 
+ error[E0038]: the trait `Foo` is not dyn compatible
2   --> $DIR/almost-supertrait-associated-type.rs:20:20
3    |
4 LL | impl<T, U> Dyn for dyn Foo<T, U> + '_ {

32    |                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ...because method `transmute` references the `Self` type in its return type
33    = help: consider moving `transmute` to another trait
34 
- error: aborting due to 2 previous errors
---
+ note: for a trait to be dyn compatible it needs to allow building a vtable
+       for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
+   --> $DIR/almost-supertrait-associated-type.rs:32:34
+    |
+ LL | trait Foo<T, U>: Super<ActuallySuper, Assoc = T>
+    |       --- this trait is not dyn compatible...
+ ...
+ LL |     fn transmute(&self, t: T) -> <Self as Super<NotActuallySuper>>::Assoc;
+    |                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ...because method `transmute` references the `Self` type in its return type
+    = help: consider moving `transmute` to another trait
+ 
+ error[E0038]: the trait `Foo` is not dyn compatible
+ 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 dyn-compatibility/almost-supertrait-associated-type.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/dyn-compatibility/almost-supertrait-associated-type.rs" "-Zthreads=1" "-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/dyn-compatibility/almost-supertrait-associated-type" "-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[E0038]: the trait `Foo` is not dyn compatible
##[error]  --> /checkout/tests/ui/dyn-compatibility/almost-supertrait-associated-type.rs:22:16
   |
LL |     type Out = U;
   |                ^ `Foo` is not dyn compatible
   |
note: for a trait to be dyn compatible it needs to allow building a vtable
      for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
  --> /checkout/tests/ui/dyn-compatibility/almost-supertrait-associated-type.rs:32:34
   |
LL | trait Foo<T, U>: Super<ActuallySuper, Assoc = T>
   |       --- this trait is not dyn compatible...
...
LL |     fn transmute(&self, t: T) -> <Self as Super<NotActuallySuper>>::Assoc;
   |                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ...because method `transmute` references the `Self` type in its return type
   = help: consider moving `transmute` to another trait

error[E0038]: the trait `Foo` is not dyn compatible
##[error]  --> /checkout/tests/ui/dyn-compatibility/almost-supertrait-associated-type.rs:20:20
   |
LL | impl<T, U> Dyn for dyn Foo<T, U> + '_ {
   |                    ^^^^^^^^^^^^^^^^^^ `Foo` is not dyn compatible
   |
note: for a trait to be dyn compatible it needs to allow building a vtable
      for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
  --> /checkout/tests/ui/dyn-compatibility/almost-supertrait-associated-type.rs:32:34
   |
LL | trait Foo<T, U>: Super<ActuallySuper, Assoc = T>
   |       --- this trait is not dyn compatible...
...
LL |     fn transmute(&self, t: T) -> <Self as Super<NotActuallySuper>>::Assoc;
   |                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ...because method `transmute` references the `Self` type in its return type
   = help: consider moving `transmute` to another trait

error[E0038]: the trait `Foo` is not dyn compatible
##[error]  --> /checkout/tests/ui/dyn-compatibility/almost-supertrait-associated-type.rs:7:32
   |
LL |     (&PhantomData::<T> as &dyn Foo<T, U>).transmute(t)
   |                                ^^^^^^^^^ `Foo` is not dyn compatible
   |
note: for a trait to be dyn compatible it needs to allow building a vtable
      for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
  --> /checkout/tests/ui/dyn-compatibility/almost-supertrait-associated-type.rs:32:34
   |
LL | trait Foo<T, U>: Super<ActuallySuper, Assoc = T>
   |       --- this trait is not dyn compatible...
...
LL |     fn transmute(&self, t: T) -> <Self as Super<NotActuallySuper>>::Assoc;
   |                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ...because method `transmute` references the `Self` type in its return type
   = help: consider moving `transmute` to another trait

error: aborting due to 3 previous errors

For more information about this error, try `rustc --explain E0038`.

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.

old solver: check dyn compatability when normalizing

5 participants