Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crashed with simple example #77378

Closed
BruceBrown opened this issue Sep 30, 2020 · 1 comment
Closed

Crashed with simple example #77378

BruceBrown opened this issue Sep 30, 2020 · 1 comment
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@BruceBrown
Copy link

Code

use std::collections::HashMap;
use std::sync::Mutex;

#[derive(Debug, Default)]
struct SomeMutableData {
    names: HashMap<u128, Vec<u8>>,
}


#[derive(Debug, Default)]
struct SomeStruct {
    mutable: Mutex<SomeMutableData>,
}
impl SomeStruct {
    fn received_bytes(&self, conn_id: u128, bytes: Vec<u8>) {
        let mutable = self.mutable.lock().unwrap();
        let mut name: Vec<u8> = Vec::with_capacity(64);
        if Some(name) = mutable.names.get(&conn_id) {
            let mut msg = name.clone();
        }
    }
}

fn main() {}

Meta

note: rustc 1.48.0-nightly (623fb90 2020-09-26) running on x86_64-apple-darwin

note: compiler flags: -C embed-bitcode=no -C debuginfo=2 -C incremental --crate-type bin

note: some of the compiler flags provided by cargo are hidden

error: aborting due to previous error

error: could not compile test-hashmap
rustc --version --verbose:

<version>

Error output

<output>
Backtrace This is pretty simple to reproduce. I admit the use of name is a bit odd and maybe illegal. However, it just crashed without an error or warning

<backtrace>
   Compiling test-hashmap v0.1.0 (/Users/bruce/Projects/rust/examples/test-hashmap)
error: internal compiler error: compiler/rustc_typeck/src/check/fn_ctxt.rs:459:25: while adjusting Expr { hir_id: HirId { owner: DefId(0:6 ~ test_hashmap[6477]::{impl#0}::received_bytes), local_id: 50 }, kind: Path(Resolved(None, Path { span: src/main.rs:19:25: 19:32 (#0), res: Local(HirId { owner: DefId(0:6 ~ test_hashmap[6477]::{impl#0}::received_bytes), local_id: 4 }), segments: [PathSegment { ident: mutable#0, hir_id: Some(HirId { owner: DefId(0:6 ~ test_hashmap[6477]::{impl#0}::received_bytes), local_id: 49 }), res: Some(Local(HirId { owner: DefId(0:6 ~ test_hashmap[6477]::{impl#0}::received_bytes), local_id: 4 })), args: None, infer_args: true }] })), attrs: ThinVec(None), span: src/main.rs:19:25: 19:32 (#0) }, can't compose [Deref(Some(OverloadedDeref { region: '_#6r, mutbl: Not, span: src/main.rs:19:25: 19:38 (#0) })) -> SomeMutableData] and [Deref(Some(OverloadedDeref { region: '_#13r, mutbl: Not, span: src/main.rs:19:25: 19:38 (#0) })) -> SomeMutableData]

thread 'rustc' panicked at 'Box<Any>', compiler/rustc_errors/src/lib.rs:945:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

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

@BruceBrown BruceBrown added C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Sep 30, 2020
@jonas-schievink
Copy link
Contributor

Thanks for the report! This looks like a duplicate of #77218, however, so closing in favor of that.

Please leave a comment on that issue if you have more information to contribute.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

2 participants