@@ -1154,8 +1154,15 @@ fn search_next_impl(cx: &mut Context, extend: bool) {
11541154 if let Some(query) = registers.read('/') {
11551155 let query = query.last().unwrap();
11561156 let contents = doc.text().slice(..).to_string();
1157− let regex = Regex::new(query).unwrap();
1158− search_impl(doc, view, &contents, ®ex, extend);
1157+ if let Ok(regex) = Regex::new(query) {
1158+ search_impl(doc, view, &contents, ®ex, extend);
1159+ } else {
1160+ // get around warning `mutable_borrow_reservation_conflict`
1161+ // which will be a hard error in the future
1162+ // see: https://github.com/rust-lang/rust/issues/59159
1163+ let query = query.clone();
1164+ cx.editor.set_error(format!("Invalid regex: {}", query));
1165+ }
11591166 }
11601167}
11611168