Skip to content

Commit e91e038

Browse files
authored
fix negative range for short str
1 parent 900590a commit e91e038

File tree

1 file changed

+1
-1
lines changed
  • compiler/rustc_target/src/spec

1 file changed

+1
-1
lines changed

compiler/rustc_target/src/spec/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3716,7 +3716,7 @@ impl TargetTriple {
37163716
const EXT: &'static str = ".json";
37173717
triple.as_ref().ends_with(EXT) || {
37183718
let s = triple.as_ref();
3719-
s.get((s.len() - 5)..).map(|ext| ext.eq_ignore_ascii_case(EXT)).unwrap_or_default()
3719+
s.get(s.len().wrapping_sub(EXT.len())..).map(|ext| ext.eq_ignore_ascii_case(EXT)).unwrap_or_default()
37203720
}
37213721
}
37223722
}

0 commit comments

Comments
 (0)