You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Borrowck regression: allows segfault in 1.27.1 #52213
Here is an example of being able to segfault in safe rust on beta
enumInner{Stack{data:[u8;23]},Heap{data:Box<[u8]>}}structSmallString{len:usize,inner:Inner}implSmallString{fnpush_str(&mutself,item:&str){match(&mutself.inner,self.len + item.len()){(Inner::Heap{ data }, x) => {println!("{}", data.len());if x > data.len(){self.grow();// data is now garbage pointer}println!("{:?}", data);},
_ => ()}}fngrow(&mutself){// Invalidate borrowed Heap.dataself.inner = Inner::Stack{data:[1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1]};}}fnmain(){let slice = "this is gonna go bad".to_owned().into_bytes().into_boxed_slice();letmut ss = SmallString{len: slice.len(),inner:Inner::Heap{data: slice }};
ss.push_str(" right now");}
Activity
[-]Borrowck regression: multiple mut borrows[/-][+]Borrowck regression: allows segfault in safe rust on beta[/+]NilSet commentedon Jul 10, 2018
Here is an example of being able to segfault in safe rust on beta
http://play.rust-lang.org/?gist=e9ebe1460df7a817467ee017de9655dc&version=beta&mode=debug&edition=2015
[-]Borrowck regression: allows segfault in safe rust on beta[/-][+]Borrowck regression: allows segfault in 1.27.1[/+]NilSet commentedon Jul 10, 2018
Turns out this regression is now also in the new patch release on stable!
est31 commentedon Jul 10, 2018
If this can be reproduced on 1.27.1 but can't be reproduced on 1.27.0 (@NilSet said that on IRC), I guess that this regression is caused by #51686 .
kennytm commentedon Jul 10, 2018
cc @nikomatsakis #51686.
nagisa commentedon Jul 10, 2018
@rust-lang/compiler the obligatory ping to all of you.
arielb1 commentedon Jul 10, 2018
Minified:
arielb1 commentedon Jul 10, 2018
Did anyone verify that this reproduces on 1.27.1? I am not sure
arielb1 commentedon Jul 10, 2018
And now I'm in the state of "how does this ever work", given that
cat_patternis returningErr"correctly".stephaneyfx commentedon Jul 10, 2018
@arielb1: Your minified example compiles with 1.27.1, and so does the second example in this thread.
arielb1 commentedon Jul 10, 2018
I have a fix up, will push it soon.
use the adjusted type for cat_pattern in tuple patterns
add test for #52213
Auto merge of #52232 - arielb1:ill-adjusted-tuples, r=pnkfelix
use the adjusted type for cat_pattern in tuple patterns
add test for rust-lang#52213
use the adjusted type for cat_pattern in tuple patterns
add test for rust-lang#52213