Code view:

A painting is a person's account of this edit as text, recorded independently of the node mapping - a rendering often has several equally defensible answers where the mapping has one. Deletions and insertions carry no position on the opposite side in a painting, so that panel draws no caret for them.

Before

1// Test that calculating an index with saturating subtraction from an in-bounds
2// index doesn't generate another bounds check.
3
4//@ compile-flags: -Copt-level=3
5//@ min-llvm-version: 21
6
7#![crate_type = "lib"]
8
9// CHECK-LABEL: @bounds_check_is_elided
10#[no_mangle]
11pub fn bounds_check_is_elided(s: &[i32], index: usize) -> i32 {
…lines 12–20 unchanged (9 lines)

After

1// Test that calculating an index with saturating subtraction from an in-bounds
2// index doesn't generate another bounds check.
3
4//@ compile-flags: -Copt-level=3
5
6#![crate_type = "lib"]
7
8// CHECK-LABEL: @bounds_check_is_elided
9#[no_mangle]
10pub fn bounds_check_is_elided(s: &[i32], index: usize) -> i32 {
11 // CHECK-NOT: panic_bounds_check
…lines 12–19 unchanged (8 lines)

Before

source_file
line_comment
// "//"
line_comment
// "//"
line_comment
// "//"
line_comment
// "//"
inner_attribute_item
# "#"
! "!"
[ "["
attribute
identifier "crate_type"
= "="
string_literal
" "\""
string_content "lib"
" "\""
] "]"
line_comment
// "//"
attribute_item
# "#"
[ "["
attribute
identifier "no_mangle"
] "]"
function_item (+73 nodes collapsed)

After

source_file
line_comment
// "//"
line_comment
// "//"
line_comment
// "//"
inner_attribute_item
# "#"
! "!"
[ "["
attribute
identifier "crate_type"
= "="
string_literal
" "\""
string_content "lib"
" "\""
] "]"
line_comment
// "//"
attribute_item
# "#"
[ "["
attribute
identifier "no_mangle"
] "]"
function_item (+73 nodes collapsed)