Moving some code around results in linking error with incremental comp

af58776
Opened by Sage Griffin at 2023-04-05 17:42:26

I've had this happen 3 times now today. It's fixed by cargo clean, so is not a critical issue, but still is a moderately interesting incremental compilation bug. The change was moving the trait query_dsl::OffsetDsl to query_dsl::methods::OffsetDsl. The code in question that is failing was importing OffsetDsl::offset from diesel::prelude instead, the x.offset is now resolving to query_dsl::QueryDsl::offset, which simply calls OffsetDsl::offset, and is exported from prelude.

Anyway, this is the error <img width="1360" alt="screen shot 2017-12-03 at 11 07 06 am" src="https://user-images.githubusercontent.com/1529387/33528246-9d44600a-d81a-11e7-889c-374ee6b3f195.png"> and the patch that caused it is https://gist.github.com/sgrif/8bb17b2a143d482e060fc3fd08705067

rustc --version: rustc 1.24.0-nightly (73bca2b9f 2017-11-28)

  1. Heh, you might have provided a neat regression test for https://github.com/rust-lang/rust/pull/46427 :) It sounds like it might be the same underlying problem.

    Michael Woerister at 2017-12-04 12:33:38

  2. I'm having a hard time reproducing this. Do you have two consecutive commits somewhere that trigger the problem?

    Michael Woerister at 2017-12-04 13:14:07

  3. Not off-hand, but I can try to recreate the state things were in when I noticed this on a branch.

    Sage Griffin at 2017-12-04 17:33:09

  4. That would be awesome.

    Michael Woerister at 2017-12-04 19:33:02

  5. I ran into a semi-related case today (sorry, these repro steps require libpq to be installed):

    • Check out the sg-bug-repro branch of Diesel. https://github.com/diesel-rs/diesel/tree/sg-bug-repro
    • cd examples/postgres/all_about_inserts
    • EXPORT CARGO_INCREMENTAL=1
    • cargo test (it'll probably fail but that doesn't matter)
    • Change this line to unwrap
    • cargo test

    Sage Griffin at 2017-12-16 17:58:24

  6. Thanks, that's very helpful!

    Michael Woerister at 2017-12-16 23:27:04

  7. Triage: image

    @sgrif have you seen this bug lately?

    Steve Klabnik at 2020-05-07 12:20:00