Skip to content

rustc panics with: assertion failed: match *region { ty::ReLateBound(..) => false, _ => true, } #46446

Closed
@tuxmark5

Description

@tuxmark5

This code snippet causes rustc to panic:

fn trim_lines(text: &str) -> impl Iterator<Item=&str> {
    let mut prefix_length = 0;
    for c in text.chars() {
      match c {
        ' ' => prefix_length += 1,
        '\n' => continue,
        _ => break,
      }
    }

    text.lines().map(|line| {
      if line.len() >= prefix_length {
        &line[prefix_length..]
      } else {
        line
      }
    })
  }

fn main() {
  trim_lines("hello");
}

Meta

rustc 1.23.0-nightly (33374fa 2017-11-20)
binary: rustc
commit-hash: 33374fa
commit-date: 2017-11-20
host: x86_64-unknown-linux-gnu
release: 1.23.0-nightly
LLVM version: 4.0

The same thing happens with 1.24 nightly too on rust playground.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions