Skip to content

Commit 46bdefc

Browse files
committed
⬆️ rust-analyzer to 2022-11-28
The prior update included checkOnSave multiple targets: rust-lang/rust-analyzer#13290 but missed the fix for the regression it caused: rust-lang/rust-analyzer#13661 Merge commit '6d61be8e65ac0fd45eaf178e1f7a1ec6b582de1f'
2 parents aef17b7 + 6d61be8 commit 46bdefc

File tree

27 files changed

+1306
-446
lines changed

27 files changed

+1306
-446
lines changed

src/tools/rust-analyzer/crates/flycheck/src/lib.rs

+10-3
Original file line numberDiff line numberDiff line change
@@ -360,21 +360,28 @@ impl FlycheckActor {
360360
}
361361
}
362362

363-
struct JodChild(GroupChild);
363+
struct JodGroupChild(GroupChild);
364+
365+
impl Drop for JodGroupChild {
366+
fn drop(&mut self) {
367+
_ = self.0.kill();
368+
_ = self.0.wait();
369+
}
370+
}
364371

365372
/// A handle to a cargo process used for fly-checking.
366373
struct CargoHandle {
367374
/// The handle to the actual cargo process. As we cannot cancel directly from with
368375
/// a read syscall dropping and therefore terminating the process is our best option.
369-
child: JodChild,
376+
child: JodGroupChild,
370377
thread: jod_thread::JoinHandle<io::Result<(bool, String)>>,
371378
receiver: Receiver<CargoMessage>,
372379
}
373380

374381
impl CargoHandle {
375382
fn spawn(mut command: Command) -> std::io::Result<CargoHandle> {
376383
command.stdout(Stdio::piped()).stderr(Stdio::piped()).stdin(Stdio::null());
377-
let mut child = command.group_spawn().map(JodChild)?;
384+
let mut child = command.group_spawn().map(JodGroupChild)?;
378385

379386
let stdout = child.0.inner().stdout.take().unwrap();
380387
let stderr = child.0.inner().stderr.take().unwrap();

src/tools/rust-analyzer/crates/hir-def/src/macro_expansion_tests/builtin_fn_macro.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,8 @@ macro_rules! compile_error {
163163
}
164164
165165
// This expands to nothing (since it's in item position), but emits an error.
166-
compile_error!("error!");
166+
compile_error!("error, with an escaped quote: \"");
167+
compile_error!(r"this is a raw string");
167168
"#,
168169
expect![[r##"
169170
#[rustc_builtin_macro]
@@ -172,7 +173,8 @@ macro_rules! compile_error {
172173
($msg:expr,) => ({ /* compiler built-in */ })
173174
}
174175
175-
/* error: error! */
176+
/* error: error, with an escaped quote: " */
177+
/* error: this is a raw string */
176178
"##]],
177179
);
178180
}

src/tools/rust-analyzer/crates/hir-expand/src/builtin_fn_macro.rs

+4-9
Original file line numberDiff line numberDiff line change
@@ -379,15 +379,10 @@ fn compile_error_expand(
379379
tt: &tt::Subtree,
380380
) -> ExpandResult<ExpandedEager> {
381381
let err = match &*tt.token_trees {
382-
[tt::TokenTree::Leaf(tt::Leaf::Literal(it))] => {
383-
let text = it.text.as_str();
384-
if text.starts_with('"') && text.ends_with('"') {
385-
// FIXME: does not handle raw strings
386-
ExpandError::Other(text[1..text.len() - 1].into())
387-
} else {
388-
ExpandError::Other("`compile_error!` argument must be a string".into())
389-
}
390-
}
382+
[tt::TokenTree::Leaf(tt::Leaf::Literal(it))] => match unquote_str(it) {
383+
Some(unquoted) => ExpandError::Other(unquoted.into()),
384+
None => ExpandError::Other("`compile_error!` argument must be a string".into()),
385+
},
391386
_ => ExpandError::Other("`compile_error!` argument must be a string".into()),
392387
};
393388

src/tools/rust-analyzer/crates/hir-expand/src/db.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ fn ast_id_map(db: &dyn AstDatabase, file_id: HirFileId) -> Arc<AstIdMap> {
240240
}
241241

242242
fn parse_or_expand(db: &dyn AstDatabase, file_id: HirFileId) -> Option<SyntaxNode> {
243-
match file_id.0 {
243+
match file_id.repr() {
244244
HirFileIdRepr::FileId(file_id) => Some(db.parse(file_id).tree().syntax().clone()),
245245
HirFileIdRepr::MacroFile(macro_file) => {
246246
// FIXME: Note how we convert from `Parse` to `SyntaxNode` here,

src/tools/rust-analyzer/crates/hir-expand/src/hygiene.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use crate::{
1717
db::{self, AstDatabase},
1818
fixup,
1919
name::{AsName, Name},
20-
HirFileId, HirFileIdRepr, InFile, MacroCallKind, MacroCallLoc, MacroDefKind, MacroFile,
20+
HirFileId, InFile, MacroCallKind, MacroCallLoc, MacroDefKind, MacroFile,
2121
};
2222

2323
#[derive(Clone, Debug)]
@@ -216,9 +216,9 @@ fn make_hygiene_info(
216216

217217
impl HygieneFrame {
218218
pub(crate) fn new(db: &dyn AstDatabase, file_id: HirFileId) -> HygieneFrame {
219-
let (info, krate, local_inner) = match file_id.0 {
220-
HirFileIdRepr::FileId(_) => (None, None, false),
221-
HirFileIdRepr::MacroFile(macro_file) => {
219+
let (info, krate, local_inner) = match file_id.macro_file() {
220+
None => (None, None, false),
221+
Some(macro_file) => {
222222
let loc = db.lookup_intern_macro_call(macro_file.macro_call_id);
223223
let info =
224224
make_hygiene_info(db, macro_file, &loc).map(|info| (loc.kind.file_id(), info));

0 commit comments

Comments
 (0)