Code generation for str::contains



I usually poke at generate disassembly code now and then because I like to be aware of what kind of assembly the code I write generates (even if it may not be super performance critical I like to have a good idea about it)

When using something like this

let t0 = "foo";
let t1 = "bar";

if t0.contains(t1) {

Example over here (make sure to switch to Release and hit “Asm” to see disassembly)

I the disassembly listing becomes quite big. I wonder if this is expected when calling the contain function on str?



The Rust standard library uses the “inline” attribute in some places to inline small pieces of code from the standard library into user code, to improve performance. That said, it looks like someone got overly aggressive with “inline” markings; please file a bug (


Yeah it seems that the inlining is quite aggressive here indeed. I will file a bug on this. Thanks!

(filled here