Skip to content

search_graph incorrectly overwrites existing cache entry #234

@lcnr

Description

@lcnr
#![feature(fn_delegation)]
#![allow(incomplete_features)]

mod opaque {
    trait Trait {}
    impl Trait for () {}

    mod to_reuse {
        use super::Trait;
        pub fn opaque_ret() -> impl Trait { () }
    }

    trait ToReuse {
        fn opaque_ret() -> impl Trait { () }
    }

    // FIXME: Inherited `impl Trait`s create query cycles when used inside trait impls.
    impl ToReuse for u8 {
        reuse to_reuse::opaque_ret; //~ ERROR cycle detected when computing type
    }
}
error[E0391]: cycle detected when computing type of `opaque::<impl at src/main.rs:18:5: 18:24>::opaque_ret::{anon_assoc#0}`
  --> src/main.rs:19:25
   |
19 |         reuse to_reuse::opaque_ret; //~ ERROR cycle detected when computing type
   |                         ^^^^^^^^^^
   |
note: ...which requires comparing an impl and trait method signature, inferring any hidden `impl Trait` types in the process...
  --> src/main.rs:19:25
   |
19 |         reuse to_reuse::opaque_ret; //~ ERROR cycle detected when computing type
   |                         ^^^^^^^^^^
   = note: ...which again requires computing type of `opaque::<impl at src/main.rs:18:5: 18:24>::opaque_ret::{anon_assoc#0}`, completing the cycle
   = note: cycle used when computing implied outlives bounds for `<u8 as opaque::ToReuse>::opaque_ret::{anon_assoc#0}` (hack disabled = false)
   = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information


thread 'rustc' panicked at /home/lcnr/rust/compiler/rustc_type_ir/src/search_graph/global_cache.rs:65:17:
assertion failed: cx.evaluation_is_concurrent()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    in progress

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions