Skip to content

regression: ICE -- bad ConstKind after monomorphizing #94502

Description

@Mark-Simulacrum

Crater picked up this issue in a number of crates:

May be a duplicate of #93002, but filing this as a dedicated bug with a rough list of affected crates in Crater.

ty::ConstKind::Error constructed but no error reported (we should check, may be a distinct bug; maybe #94506):

[INFO] [stdout] error: internal compiler error: /rustc/0a4f984a87c7ba6c74ec3e78442fec955a419e32/compiler/rustc_codegen_ssa/src/mir/constant.rs:42:20: encountered bad ConstKind after monomorphizing: Error(DelaySpanBugEmitted(()))
[INFO] [stdout]   --> parse/src/day02.rs:21:73
[INFO] [stdout]    |
[INFO] [stdout] 21 |     let char_count = count_dict.get(&password_rule.character).unwrap_or(&0);
[INFO] [stdout]    |                                                                         ^^
[INFO] [stdout] 

Activity

  1. added
    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.
    on Mar 1, 2022
  2. added this to the 1.60.0 milestone on Mar 1, 2022
  3. added
    I-prioritizeIssue needs a team member to assess the impact. Will be replaced by P-{low,medium,high,critical}
    on Mar 1, 2022
  4. oli-obk commented on Mar 2, 2022

    @oli-obk
    Contributor

    cc @b-naber @lcnr does this ring a bell wrt recent const representation changes in MIR?

  5. b-naber commented on Mar 2, 2022

    @b-naber
    Contributor

    cc @b-naber @lcnr does this ring a bell wrt recent const representation changes in MIR?

    Does a crater run use nightly?

    None of the changes we made are in nightly right now. Only one PR was merged, but that was later reverted.

  6. matthiaskrgr commented on Mar 2, 2022

    @matthiaskrgr
    Member

    Reduced a bit from https://github.com/deaz/adventofcode-2018:

    use std::collections::HashMap;
    
    pub fn f(input: &str) {
        input
            .lines()
            .map(|s| -> (u32) { (1) })
            .fold(HashMap::new(), |mut map, (x)| {
                let prev = map.get(&(0, x)).unwrap_or(&0);
                map.insert((0, x), prev + 1);
                map
            });
    }
    
    pub fn main() {
        let _ = f("");
    }

    This crashes on beta but not on stable or nightly.

  7. lcnr commented on Mar 3, 2022

    @lcnr
    Contributor

    minimalized

    struct Repro;
    impl Repro {
        fn get(&self) -> &i32 {
            &3
        }
    
        fn insert(&mut self, _: i32) {}
    }
    
    fn main() {
        let x = &0;
        let mut conflict = Repro;
        let prev = conflict.get();
        conflict.insert(*prev + *x);
    }

    the issue is that body.tainted_by_errors is also set when only emitting a lint

  8. self-assigned this
    on Mar 3, 2022
  9. eddyb commented on Mar 3, 2022

    @eddyb
    Contributor

    Sounds like this comment might be relevant: #93368 (comment) - i.e. that PR ended up doing a drive-by fix because conflating errors and warnings became a type mismatch at the DiagnosticBuilder level.

    So you can probably confirm that nightly was broken between #93691 landing (nightly-2022-02-13?) and #93368 landing (nightly-2022-02-26?), and I guess beta branched between the two?

    EDIT: heh, @lcnr already opened the fix/backport PR as I was writing this.

  10. added a commit that references this issue on Mar 3, 2022
  11. added a commit that references this issue on Mar 3, 2022
  12. added a commit that references this issue on Mar 7, 2022
  13. added a commit that references this issue on Mar 7, 2022
  14. added a commit that references this issue on Mar 7, 2022
  15. emilyalbini commented on Apr 1, 2022

    @emilyalbini
    Member

    Should be fixed by #94552.

  16. removed
    I-prioritizeIssue needs a team member to assess the impact. Will be replaced by P-{low,medium,high,critical}
    on Apr 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

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.regression-from-stable-to-betaPerformance or correctness regression from stable to beta.

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions