Skip to content

Compiler panic: "Path not fully resolved" when passing reference to impl function #22933

Closed
@michaelbeaumont

Description

@michaelbeaumont

I'm getting a compiler error about a "path not fully resolved":

thread 'rustc' panicked at 'path not fully resolved: PathResolution { base_def: DefTy(DefId { krate: 0, node: 204 }, false), last_private: LastMod(AllPublic), depth: 1 }'

I tried this code:

fn is_whitespace(c: char) -> bool {
    c == ' ' || c == '\n'
}

fn consume_whitespace(&mut self) -> Parse<()> {
    //Ok(())
    self.consume_while(&(CNFParser::is_whitespace))
}

fn consume_while(&mut self, p: &Fn(char) -> bool) -> Parse<()> {
    while p(self.token) {
        let take = self.take();
        if take.is_err() { return take }
    }
    Ok(())
}    

I expected to see this happen:
the code should compile, it did somewhere after 1.0 alpha and stopped in the last week (I think)

Instead, this happened:
I got this unexpected panic. It has something to do with passing the reference to CNFParser::is_whitespace

Meta

rustc --version --verbose:

    rustc 1.0.0-nightly (890293655 2015-02-28) (built 2015-03-01)
    binary: rustc
    commit-hash: 890293655251c372ea99694c0c9f0795e2663286
    commit-date: 2015-02-28
    build-date: 2015-03-01
    host: x86_64-unknown-linux-gnu
    release: 1.0.0-nightly

Backtrace:

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/blob/master/CONTRIBUTING.md#bug-reports
note: run with `RUST_BACKTRACE=1` for a backtrace
thread 'rustc' panicked at 'path not fully resolved: PathResolution { base_def: DefTy(DefId { krate: 0, node: 204 }, false), last_private: LastMod(AllPublic), depth: 1 }', /home/rustbuild/src/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/librustc/middle/def.rs:79

stack backtrace:
   1:         0xde628c4f - sys::backtrace::write::hb08af03691eab78a5kA
   2:         0xde651782 - panicking::on_panic::h37164609ca1c02afBnJ
   3:         0xde59163a - rt::unwind::begin_unwind_inner::h24d5e7492198457b43I
   4:         0xde591d24 - rt::unwind::begin_unwind_fmt::hee1a09c48e390d87H2I
   5:         0xdc4856b1 - middle::ty::resolve_expr::h65338d27a12ebb460A6
   6:         0xdc5eac40 - middle::ty::expr_kind::hcac269a238fc506fAC6
   7:         0xdc5eaf7b - middle::ty::expr_kind::hcac269a238fc506fAC6
   8:         0xdc5ea94a - middle::ty::expr_is_lval::h485f36669a19d1a13B6
   9:         0xdd3bee84 - check::check_expr_with_unifier::h329803007416623423
  10:         0xdd3983a8 - check::check_argument_types::h6d28a2012d7e49afNsp
  11:         0xdd399d34 - check::check_method_argument_types::hf1decc93718710207pp
  12:         0xdd3cc071 - check::check_expr_with_unifier::check_method_call::hb126ebcd08adeb94z4p
  13:         0xdd3d6ae2 - check::check_expr_with_unifier::h8581770403589055324
  14:         0xdd3ad396 - check::check_block_with_expected::haa14a0695c08d2a6V0r
  15:         0xdd3908d5 - check::check_fn::ha741703a74959edd8kn
  16:         0xdd3aa0d2 - check::check_bare_fn::hdc3a9af5b372582fOan
  17:         0xdd3adbbb - check::check_method_body::h49a550c880bfd87dnIn
  18:         0xdd3a3864 - check::check_item::h203d9fc30afbd381stn
  19:         0xdd3a85c2 - visit::walk_item::h11360223606861997271
  20:         0xdd46df2e - check_crate::closure.35032
  21:         0xdd469207 - check_crate::h6ce4a57b1730f0fdDXB
  22:         0xdeca908e - driver::phase_3_run_analysis_passes::h55e7e7af941f4089xFa
  23:         0xdec8e411 - driver::compile_input::hee81c045ab46c74fIba
  24:         0xded58e6e - run_compiler::h875c1e123fe4ae2cF5b
  25:         0xded56a1c - thunk::F.Invoke<A, R>::invoke::h12424714292252424185
  26:         0xded55770 - rt::unwind::try::try_fn::h4021821266450575721
  27:         0xde6bcfe8 - rust_try_inner
  28:         0xde6bcfd5 - rust_try
  29:         0xded55e5c - thunk::F.Invoke<A, R>::invoke::h8199562432922027576
  30:         0xde63d2d5 - sys::thread::thread_start::h1b1bb1e7ac08d3a6yRE
  31:         0xd8378373 - start_thread
  32:         0xde21927c - __clone
  33:         0xffffffff - <unknown>

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-resolveArea: Name/path resolution done by `rustc_resolve` specificallyI-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions