Skip to content

ice: "indeterminate path result in resolve_qpath" #95327

Closed
@matthiaskrgr

Description

@matthiaskrgr

Code

code from ./src/tools/rustfmt/tests/target/where-clause-rfc.rs

fn reflow_list_node_with_rule(node: &CompoundNode, rule: &Rule, args: &[Arg], shape: &Shape)
where
    T: FOo,
    U: Bar,
{
    let mut effects = HashMap::new();
}

fn reflow_list_node_with_rule(node: &CompoundNode, rule: &Rule, args: &[Arg], shape: &Shape)
where
    T: FOo,
{
    let mut effects = HashMap::new();
}

fn reflow_list_node_with_rule(
    node: &CompoundNode,
    rule: &Rule,
    args: &[Arg],
    shape: &Shape,
    shape: &Shape,
) where
    T: FOo,
    U: Bar,
{
    let mut effects = HashMap::new();
}

fn reflow_list_node_with_rule(
    node: &CompoundNode,
    rule: &Rule,
    args: &[Arg],
    shape: &Shape,
    shape: &Shape,
) where
    T: FOo,
{
    let mut effects = HashMap::new();
}

fn reflow_list_node_with_rule(
    node: &CompoundNode,
    rule: &Rule,
    args: &[Arg],
    shape: &Shape,
) -> Option<String>
where
    T: FOo,
    U: Bar,
{
    let mut effects = HashMap::new();
}

fn reflow_list_node_with_rule(
    node: &CompoundNode,
    rule: &Rule,
    args: &[Arg],
    shape: &Shape,
) -> Option<String>
where
    T: FOo,
{
    let mut effects = HashMap::new();
}

pub trait Test {
    fn very_long_method_name<F>(self, f: F) -> MyVeryLongReturnType
    where
        F: FnMut(Self::Item) -> bool;

    fn exactly_100_chars1<F>(self, f: F) -> MyVeryLongReturnType
    where
        F: FnMut(Self::Item) -> bool;
}

fn very_long_function_name<F>(very_long_argument: F) -> MyVeryLongReturnType
where
    F: FnMut(Self::Item) -> bool,
{
}

struct VeryLongTupleStructName<A, B, C, D, E>(LongLongTypename, LongLongTypename, i32, i32)
where
    A: LongTrait;

struct Exactly100CharsToSemicolon<A, B, C, D, E>(LongLongTypename, i32, i32)
where
    A: LongTrait1234;

struct AlwaysOnNextLine<LongLongTypename, LongTypename, A, B, C, D, E, F>
where
    A: LongTrait,
{
    x: i32,
}

pub trait SomeTrait<T>
where
    T: Something
        + Sync
        + Send
        + Display
        + Debug
        + Copy
        + Hash
        + Debug
        + Display
        + Write
        + Read
        + FromStr,
{
}

// #2020
impl<'a, 'gcx, 'tcx> ProbeContext<'a, 'gcx, 'tcx> {
    fn elaborate_bounds<F>(&mut self, bounds: &[ty::PolyTraitRef<'tcx>], mut mk_cand: F)
    where
        F: for<'b> FnMut(
            &mut ProbeContext<'b, 'gcx, 'tcx>,
            ty::PolyTraitRef<'tcx>,
            ty::AssociatedItem,
        ),
    {
        // ...
    }
}

// #2497
fn handle_update<'a, Tab, Conn, R, C>(
    executor: &Executor<PooledConnection<ConnectionManager<Conn>>>,
    change_set: &'a C,
) -> ExecutionResult
where
    &'a C: Identifiable + AsChangeset<Target = Tab> + HasTable<Table = Tab>,
    <&'a C as AsChangeset>::Changeset: QueryFragment<Conn::Backend>,
    Tab: Table + HasTable<Table = Tab>,
    Tab::PrimaryKey: EqAll<<&'a C as Identifiable>::Id>,
    Tab::FromClause: QueryFragment<Conn::Backend>,
    Tab: FindDsl<<&'a C as Identifiable>::Id>,
    Find<Tab, <&'a C as Identifiable>::Id>: IntoUpdateTarget<Table = Tab>,
    <Find<Tab, <&'a C as Identifiable>::Id> as IntoUpdateTarget>::WhereClause:
        QueryFragment<Conn::Backend>,
    Tab::Query: FilterDsl<<Tab::PrimaryKey as EqAll<<&'a C as Identifiable>::Id>>::Output>,
    Filter<Tab::Query, <Tab::PrimaryKey as EqAll<<&'a C as Identifiable>::Id>>::Output>: LimitDsl,
    Limit<Filter<Tab::Query, <Tab::PrimaryKey as EqAll<<&'a C as Identifiable>::Id>>::Output>>:
        QueryDsl
            + BoxedDsl<
                'a,
                Conn::Backend,
                Output = BoxedSelectStatement<'a, R::SqlType, Tab, Conn::Backend>,
            >,
    R: LoadingHandler<Conn, Table = Tab, SqlType = Tab::SqlType>
        + GraphQLType<TypeInfo = (), Context = ()>,
{
    unimplemented!()
}

Meta

rustc --version --verbose:

rustc 1.61.0-nightly (d53246fed 2022-03-25)
binary: rustc
commit-hash: d53246fedde4c193eae8a003546a8f0f9f85d223
commit-date: 2022-03-25
host: x86_64-unknown-linux-gnu
release: 1.61.0-nightly
LLVM version: 14.0.0

Error output

error[E0428]: the name `reflow_list_node_with_rule` is defined multiple times
  --> ./src/tools/rustfmt/tests/target/where-clause-rfc.rs:9:1
   |
1  | / fn reflow_list_node_with_rule(node: &CompoundNode, rule: &Rule, args: &[Arg], shape: &Shape)
2  | | where
3  | |     T: FOo,
4  | |     U: Bar,
5  | | {
6  | |     let mut effects = HashMap::new();
7  | | }
   | |_- previous definition of the value `reflow_list_node_with_rule` here
8  |
9  | / fn reflow_list_node_with_rule(node: &CompoundNode, rule: &Rule, args: &[Arg], shape: &Shape)
10 | | where
11 | |     T: FOo,
12 | | {
13 | |     let mut effects = HashMap::new();
14 | | }
   | |_^ `reflow_list_node_with_rule` redefined here
   |
   = note: `reflow_list_node_with_rule` must be defined only once in the value namespace of this module

error[E0428]: the name `reflow_list_node_with_rule` is defined multiple times
  --> ./src/tools/rustfmt/tests/target/where-clause-rfc.rs:16:1
   |
1  | / fn reflow_list_node_with_rule(node: &CompoundNode, rule: &Rule, args: &[Arg], shape: &Shape)
2  | | where
3  | |     T: FOo,
4  | |     U: Bar,
5  | | {
6  | |     let mut effects = HashMap::new();
7  | | }
   | |_- previous definition of the value `reflow_list_node_with_rule` here
...
16 | / fn reflow_list_node_with_rule(
17 | |     node: &CompoundNode,
18 | |     rule: &Rule,
19 | |     args: &[Arg],
...  |
26 | |     let mut effects = HashMap::new();
27 | | }
   | |_^ `reflow_list_node_with_rule` redefined here
   |
   = note: `reflow_list_node_with_rule` must be defined only once in the value namespace of this module

error[E0428]: the name `reflow_list_node_with_rule` is defined multiple times
  --> ./src/tools/rustfmt/tests/target/where-clause-rfc.rs:29:1
   |
1  | / fn reflow_list_node_with_rule(node: &CompoundNode, rule: &Rule, args: &[Arg], shape: &Shape)
2  | | where
3  | |     T: FOo,
4  | |     U: Bar,
5  | | {
6  | |     let mut effects = HashMap::new();
7  | | }
   | |_- previous definition of the value `reflow_list_node_with_rule` here
...
29 | / fn reflow_list_node_with_rule(
30 | |     node: &CompoundNode,
31 | |     rule: &Rule,
32 | |     args: &[Arg],
...  |
38 | |     let mut effects = HashMap::new();
39 | | }
   | |_^ `reflow_list_node_with_rule` redefined here
   |
   = note: `reflow_list_node_with_rule` must be defined only once in the value namespace of this module

error[E0428]: the name `reflow_list_node_with_rule` is defined multiple times
  --> ./src/tools/rustfmt/tests/target/where-clause-rfc.rs:41:1
   |
1  | / fn reflow_list_node_with_rule(node: &CompoundNode, rule: &Rule, args: &[Arg], shape: &Shape)
2  | | where
3  | |     T: FOo,
4  | |     U: Bar,
5  | | {
6  | |     let mut effects = HashMap::new();
7  | | }
   | |_- previous definition of the value `reflow_list_node_with_rule` here
...
41 | / fn reflow_list_node_with_rule(
42 | |     node: &CompoundNode,
43 | |     rule: &Rule,
44 | |     args: &[Arg],
...  |
51 | |     let mut effects = HashMap::new();
52 | | }
   | |_^ `reflow_list_node_with_rule` redefined here
   |
   = note: `reflow_list_node_with_rule` must be defined only once in the value namespace of this module

error[E0428]: the name `reflow_list_node_with_rule` is defined multiple times
  --> ./src/tools/rustfmt/tests/target/where-clause-rfc.rs:54:1
   |
1  | / fn reflow_list_node_with_rule(node: &CompoundNode, rule: &Rule, args: &[Arg], shape: &Shape)
2  | | where
3  | |     T: FOo,
4  | |     U: Bar,
5  | | {
6  | |     let mut effects = HashMap::new();
7  | | }
   | |_- previous definition of the value `reflow_list_node_with_rule` here
...
54 | / fn reflow_list_node_with_rule(
55 | |     node: &CompoundNode,
56 | |     rule: &Rule,
57 | |     args: &[Arg],
...  |
63 | |     let mut effects = HashMap::new();
64 | | }
   | |_^ `reflow_list_node_with_rule` redefined here
   |
   = note: `reflow_list_node_with_rule` must be defined only once in the value namespace of this module

error[E0415]: identifier `shape` is bound more than once in this parameter list
  --> ./src/tools/rustfmt/tests/target/where-clause-rfc.rs:21:5
   |
21 |     shape: &Shape,
   |     ^^^^^ used as parameter more than once

error[E0415]: identifier `shape` is bound more than once in this parameter list
  --> ./src/tools/rustfmt/tests/target/where-clause-rfc.rs:34:5
   |
34 |     shape: &Shape,
   |     ^^^^^ used as parameter more than once

error[E0433]: failed to resolve: use of undeclared type `Self`
  --> ./src/tools/rustfmt/tests/target/where-clause-rfc.rs:78:14
   |
78 |     F: FnMut(Self::Item) -> bool,
   |              ^^^^ use of undeclared type `Self`

error[E0433]: failed to resolve: use of undeclared crate or module `ty`
   --> ./src/tools/rustfmt/tests/target/where-clause-rfc.rs:120:13
    |
120 |             ty::PolyTraitRef<'tcx>,
    |             ^^ use of undeclared crate or module `ty`

error[E0433]: failed to resolve: use of undeclared crate or module `ty`
   --> ./src/tools/rustfmt/tests/target/where-clause-rfc.rs:121:13
    |
121 |             ty::AssociatedItem,
    |             ^^ use of undeclared crate or module `ty`

error[E0433]: failed to resolve: use of undeclared crate or module `ty`
   --> ./src/tools/rustfmt/tests/target/where-clause-rfc.rs:116:49
    |
116 |     fn elaborate_bounds<F>(&mut self, bounds: &[ty::PolyTraitRef<'tcx>], mut mk_cand: F)
    |                                                 ^^ use of undeclared crate or module `ty`

error[E0433]: failed to resolve: use of undeclared type `AsChangeset`
   --> ./src/tools/rustfmt/tests/target/where-clause-rfc.rs:135:15
    |
135 |     <&'a C as AsChangeset>::Changeset: QueryFragment<Conn::Backend>,
    |               ^^^^^^^^^^^ use of undeclared type `AsChangeset`

thread 'rustc' panicked at 'compiler/rustc_resolve/src/late.rs:2235:42: indeterminate path result in resolve_qpath', compiler/rustc_middle/src/util/bug.rs:35:26
stack backtrace:
Backtrace

thread 'rustc' panicked at 'compiler/rustc_resolve/src/late.rs:2235:42: indeterminate path result in resolve_qpath', compiler/rustc_middle/src/util/bug.rs:35:26
stack backtrace:
   0:     0x7f260769d59d - std::backtrace_rs::backtrace::libunwind::trace::h4f2e7ab643c2a72d
                               at /rustc/d53246fedde4c193eae8a003546a8f0f9f85d223/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7f260769d59d - std::backtrace_rs::backtrace::trace_unsynchronized::hd8122d89d466155f
                               at /rustc/d53246fedde4c193eae8a003546a8f0f9f85d223/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f260769d59d - std::sys_common::backtrace::_print_fmt::ha14304a8be4cab4e
                               at /rustc/d53246fedde4c193eae8a003546a8f0f9f85d223/library/std/src/sys_common/backtrace.rs:66:5
   3:     0x7f260769d59d - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h678e56b07ae20456
                               at /rustc/d53246fedde4c193eae8a003546a8f0f9f85d223/library/std/src/sys_common/backtrace.rs:45:22
   4:     0x7f26076f759c - core::fmt::write::he02f153a6985c4ab
                               at /rustc/d53246fedde4c193eae8a003546a8f0f9f85d223/library/core/src/fmt/mod.rs:1190:17
   5:     0x7f260768eb91 - std::io::Write::write_fmt::h7060a030ecb1908e
                               at /rustc/d53246fedde4c193eae8a003546a8f0f9f85d223/library/std/src/io/mod.rs:1655:15
   6:     0x7f26076a0685 - std::sys_common::backtrace::_print::h43aa906fea8f5fa6
                               at /rustc/d53246fedde4c193eae8a003546a8f0f9f85d223/library/std/src/sys_common/backtrace.rs:48:5
   7:     0x7f26076a0685 - std::sys_common::backtrace::print::h983a1d6d27ade7a7
                               at /rustc/d53246fedde4c193eae8a003546a8f0f9f85d223/library/std/src/sys_common/backtrace.rs:35:9
   8:     0x7f26076a0685 - std::panicking::default_hook::{{closure}}::h2519cebbcdfbe142
                               at /rustc/d53246fedde4c193eae8a003546a8f0f9f85d223/library/std/src/panicking.rs:295:22
   9:     0x7f26076a0339 - std::panicking::default_hook::hd3049586fce1b82d
                               at /rustc/d53246fedde4c193eae8a003546a8f0f9f85d223/library/std/src/panicking.rs:314:9
  10:     0x7f2607ece491 - rustc_driver[38891ed57d3cc9fe]::DEFAULT_HOOK::{closure#0}::{closure#0}
  11:     0x7f26076a0dd0 - std::panicking::rust_panic_with_hook::he52c9b5b92154d6b
                               at /rustc/d53246fedde4c193eae8a003546a8f0f9f85d223/library/std/src/panicking.rs:702:17
  12:     0x7f2608eb0fa2 - std[5850aa4fa0ff8327]::panicking::begin_panic::<alloc[3f7f9b7bc81cb604]::string::String>::{closure#0}
  13:     0x7f2608eafaaa - std[5850aa4fa0ff8327]::sys_common::backtrace::__rust_end_short_backtrace::<std[5850aa4fa0ff8327]::panicking::begin_panic<alloc[3f7f9b7bc81cb604]::string::String>::{closure#0}, !>
  14:     0x7f2608e446dd - std[5850aa4fa0ff8327]::panicking::begin_panic::<alloc[3f7f9b7bc81cb604]::string::String>
  15:     0x7f2608eadf64 - std[5850aa4fa0ff8327]::panic::panic_any::<alloc[3f7f9b7bc81cb604]::string::String>
  16:     0x7f2608eb7b2f - rustc_middle[bed5e002fa9a46a6]::ty::context::tls::with_opt::<rustc_middle[bed5e002fa9a46a6]::util::bug::opt_span_bug_fmt<rustc_span[e45475953e4748e8]::span_encoding::Span>::{closure#0}, ()>
  17:     0x7f2608ebac56 - rustc_middle[bed5e002fa9a46a6]::util::bug::opt_span_bug_fmt::<rustc_span[e45475953e4748e8]::span_encoding::Span>
  18:     0x7f2608ebabc3 - rustc_middle[bed5e002fa9a46a6]::util::bug::bug_fmt
  19:     0x7f26083265ab - <rustc_resolve[9690008cbc250a8b]::late::LateResolutionVisitor>::resolve_qpath_anywhere
  20:     0x7f260831e9d7 - <rustc_resolve[9690008cbc250a8b]::late::LateResolutionVisitor>::smart_resolve_report_errors
  21:     0x7f2608325769 - <rustc_resolve[9690008cbc250a8b]::late::LateResolutionVisitor>::smart_resolve_path_fragment::{closure#0}
  22:     0x7f2609434606 - <rustc_resolve[9690008cbc250a8b]::late::LateResolutionVisitor>::smart_resolve_path_fragment
  23:     0x7f2609432eae - <rustc_resolve[9690008cbc250a8b]::late::LateResolutionVisitor>::smart_resolve_path
  24:     0x7f2608324cdd - <rustc_resolve[9690008cbc250a8b]::late::LateResolutionVisitor as rustc_ast[2e35aed86258e97d]::visit::Visitor>::visit_poly_trait_ref
  25:     0x7f260a076554 - rustc_ast[2e35aed86258e97d]::visit::walk_where_predicate::<rustc_resolve[9690008cbc250a8b]::late::LateResolutionVisitor>
  26:     0x7f260942a0ea - <rustc_resolve[9690008cbc250a8b]::late::LateResolutionVisitor as rustc_ast[2e35aed86258e97d]::visit::Visitor>::visit_generics
  27:     0x7f26093e1aa1 - rustc_ast[2e35aed86258e97d]::visit::walk_item::<rustc_resolve[9690008cbc250a8b]::late::LateResolutionVisitor>
  28:     0x7f260942d2f8 - <rustc_resolve[9690008cbc250a8b]::late::LateResolutionVisitor>::resolve_item
  29:     0x7f260a099fec - <rustc_resolve[9690008cbc250a8b]::Resolver>::late_resolve_crate
  30:     0x7f260a07e88b - <rustc_session[e437362c7cae097c]::session::Session>::time::<(), <rustc_resolve[9690008cbc250a8b]::Resolver>::resolve_crate::{closure#0}>
  31:     0x7f2609d692b9 - rustc_interface[b6318c27d1922a93]::passes::configure_and_expand
  32:     0x7f2609d611a1 - <rustc_interface[b6318c27d1922a93]::queries::Queries>::expansion
  33:     0x7f2609d269c9 - <rustc_interface[b6318c27d1922a93]::interface::Compiler>::enter::<rustc_driver[38891ed57d3cc9fe]::run_compiler::{closure#1}::{closure#2}, core[44969af2fb509f55]::result::Result<core[44969af2fb509f55]::option::Option<rustc_interface[b6318c27d1922a93]::queries::Linker>, rustc_errors[d0d198d29b8f4acb]::ErrorGuaranteed>>
  34:     0x7f2609d39acf - rustc_span[e45475953e4748e8]::with_source_map::<core[44969af2fb509f55]::result::Result<(), rustc_errors[d0d198d29b8f4acb]::ErrorGuaranteed>, rustc_interface[b6318c27d1922a93]::interface::create_compiler_and_run<core[44969af2fb509f55]::result::Result<(), rustc_errors[d0d198d29b8f4acb]::ErrorGuaranteed>, rustc_driver[38891ed57d3cc9fe]::run_compiler::{closure#1}>::{closure#1}>
  35:     0x7f2609d39344 - rustc_interface[b6318c27d1922a93]::interface::create_compiler_and_run::<core[44969af2fb509f55]::result::Result<(), rustc_errors[d0d198d29b8f4acb]::ErrorGuaranteed>, rustc_driver[38891ed57d3cc9fe]::run_compiler::{closure#1}>
  36:     0x7f2609d25be2 - <scoped_tls[8d65246331caf6b8]::ScopedKey<rustc_span[e45475953e4748e8]::SessionGlobals>>::set::<rustc_interface[b6318c27d1922a93]::interface::run_compiler<core[44969af2fb509f55]::result::Result<(), rustc_errors[d0d198d29b8f4acb]::ErrorGuaranteed>, rustc_driver[38891ed57d3cc9fe]::run_compiler::{closure#1}>::{closure#0}, core[44969af2fb509f55]::result::Result<(), rustc_errors[d0d198d29b8f4acb]::ErrorGuaranteed>>
  37:     0x7f2609d2280f - std[5850aa4fa0ff8327]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[b6318c27d1922a93]::util::run_in_thread_pool_with_globals<rustc_interface[b6318c27d1922a93]::interface::run_compiler<core[44969af2fb509f55]::result::Result<(), rustc_errors[d0d198d29b8f4acb]::ErrorGuaranteed>, rustc_driver[38891ed57d3cc9fe]::run_compiler::{closure#1}>::{closure#0}, core[44969af2fb509f55]::result::Result<(), rustc_errors[d0d198d29b8f4acb]::ErrorGuaranteed>>::{closure#0}, core[44969af2fb509f55]::result::Result<(), rustc_errors[d0d198d29b8f4acb]::ErrorGuaranteed>>
  38:     0x7f2609d3aa62 - <<std[5850aa4fa0ff8327]::thread::Builder>::spawn_unchecked_<rustc_interface[b6318c27d1922a93]::util::run_in_thread_pool_with_globals<rustc_interface[b6318c27d1922a93]::interface::run_compiler<core[44969af2fb509f55]::result::Result<(), rustc_errors[d0d198d29b8f4acb]::ErrorGuaranteed>, rustc_driver[38891ed57d3cc9fe]::run_compiler::{closure#1}>::{closure#0}, core[44969af2fb509f55]::result::Result<(), rustc_errors[d0d198d29b8f4acb]::ErrorGuaranteed>>::{closure#0}, core[44969af2fb509f55]::result::Result<(), rustc_errors[d0d198d29b8f4acb]::ErrorGuaranteed>>::{closure#1} as core[44969af2fb509f55]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  39:     0x7f26076aafc3 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h0295cf0a5e627423
                               at /rustc/d53246fedde4c193eae8a003546a8f0f9f85d223/library/alloc/src/boxed.rs:1861:9
  40:     0x7f26076aafc3 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h4556623ef66ba50d
                               at /rustc/d53246fedde4c193eae8a003546a8f0f9f85d223/library/alloc/src/boxed.rs:1861:9
  41:     0x7f26076aafc3 - std::sys::unix::thread::Thread::new::thread_start::h9da695e381fb56e5
                               at /rustc/d53246fedde4c193eae8a003546a8f0f9f85d223/library/std/src/sys/unix/thread.rs:108:17
  42:     0x7f26074835c2 - start_thread
  43:     0x7f2607508584 - __clone
  44:                0x0 - <unknown>

error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.61.0-nightly (d53246fed 2022-03-25) running on x86_64-unknown-linux-gnu

query stack during panic:
end of query stack
error: aborting due to 12 previous errors

Some errors have detailed explanations: E0415, E0428, E0433.
For more information about an error, try `rustc --explain E0415`.

Metadata

Metadata

Assignees

Labels

C-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.glacierICE tracked in rust-lang/glacier.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions