Skip to content

Internal error "left behind trailing whitespace" for assignment with RHS comment #4515

@scottmcm

Description

@scottmcm

Describe the bug

error[internal]: left behind trailing whitespace
 --> /playground/src/main.rs:4:4:17
  |
4 |     let new_len = 
  |                  ^
  |

To Reproduce

Repros on the playground, https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=8d26c934db762f2165ab9b0cc4d2ef61

    pub unsafe fn as_chunks_mut_unchecked<const N: usize>(&mut self) -> &mut [[T; N]] {
        debug_assert_ne!(N, 0);
        debug_assert_eq!(self.len() % N, 0);
        let new_len = 
            // SAFETY: Our precondition is exactly what's needed to call this
            unsafe { crate::intrinsics::exact_div(self.len(), N) };
        // SAFETY: We cast a slice of `new_len * N` elements into
        // a slice of `new_len` many `N` elements chunks.
        unsafe { from_raw_parts_mut(self.as_mut_ptr().cast(), new_len) }
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    1x-backport:pendingFixed/resolved in source but not yet backported to a 1x branch and releaseA-commentsArea: commentsC-bugCategory: this is a bug; use also I-* labels for specific bug kinds, e.g. I-non-idempotency or I-ICEI-trailing-whitespaceIssue: internal error; left behind trailing whitespace

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions