]> git.lizzy.rs Git - rust.git/commitdiff
Rollup merge of #22385 - dotdash:slice_by_val_copy, r=nikomatsakis
authorManish Goregaokar <manishsmail@gmail.com>
Tue, 17 Feb 2015 10:11:33 +0000 (15:41 +0530)
committerManish Goregaokar <manishsmail@gmail.com>
Tue, 17 Feb 2015 12:03:17 +0000 (17:33 +0530)
When matching against strings/slices, we call the comparison function
for strings, which takes two string slices by value. The slices are
passed in memory, and currently we just pass in a pointer to the
original slice. That can cause misoptimizations because we emit a call
to llvm.lifetime.end for all by-value arguments at the end of a
function, which in this case marks the original slice as dead.

So we need to properly create copies of the slices to pass them to the
comparison function.

Fixes #22008

1  2 
src/librustc_trans/trans/_match.rs

Simple merge