Skip to content

Commit 80470d5

Browse files
committed
Merge commit '4ef6a49b44e8aa380da7522442234bfd7a52c55e' into sync-from-ra
1 parent f206d8b commit 80470d5

File tree

121 files changed

+3264
-1267
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

121 files changed

+3264
-1267
lines changed

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,11 @@ Otherwise please try to provide information which will help us to fix the issue
2323
**rustc version**: (eg. output of `rustc -V`)
2424

2525
**relevant settings**: (eg. client settings, or environment variables like `CARGO`, `RUSTC`, `RUSTUP_HOME` or `CARGO_HOME`)
26+
27+
**repository link (if public, optional)**: (eg. [rust-analyzer](https://github.com/rust-lang/rust-analyzer))
28+
29+
**code snippet to reproduce**:
30+
```rust
31+
// add your code here
32+
33+
```

.typos.toml

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,31 @@
1-
[default.extend-identifiers]
2-
AnserStyle = "AnserStyle"
3-
datas = "datas"
4-
impl_froms = "impl_froms"
5-
selfs = "selfs"
1+
[files]
2+
extend-exclude = [
3+
"*.rast",
4+
"bench_data/",
5+
"crates/parser/test_data/lexer/err/",
6+
"crates/project-model/test_data/",
7+
]
8+
ignore-hidden = false
9+
10+
[default]
11+
extend-ignore-re = [
12+
# ignore string which contains $0, which is used widely in tests
13+
".*\\$0.*",
14+
# ignore generated content like `boxed....nner()`, `Defaul...efault`
15+
"\\w*\\.{3,4}\\w*",
16+
'"flate2"',
17+
"raison d'être",
18+
]
619

720
[default.extend-words]
821
anser = "anser"
922
ba = "ba"
1023
fo = "fo"
1124
ket = "ket"
1225
makro = "makro"
13-
raison = "raison"
1426
trivias = "trivias"
15-
TOOD = "TOOD"
1627

17-
[default]
18-
extend-ignore-re = [
19-
# ignore string which contains $x (x is a num), which use widely in test
20-
".*\\$\\d.*",
21-
# ignore generated content like `boxed....nner()`, `Defaul...efault`
22-
"\\w*\\.{3,4}\\w*",
23-
]
24-
25-
[files]
26-
extend-exclude = [
27-
"*.json",
28-
"*.rast",
29-
"crates/parser/test_data/lexer/err/*",
30-
"bench_data/*",
31-
]
28+
[default.extend-identifiers]
29+
datas = "datas"
30+
impl_froms = "impl_froms"
31+
selfs = "selfs"

Cargo.lock

Lines changed: 3 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ exclude = ["crates/proc-macro-srv/proc-macro-test/imp"]
44
resolver = "2"
55

66
[workspace.package]
7-
rust-version = "1.74"
7+
rust-version = "1.76"
88
edition = "2021"
99
license = "MIT OR Apache-2.0"
1010
authors = ["rust-analyzer team"]
@@ -28,6 +28,10 @@ incremental = true
2828
# Set this to 1 or 2 to get more useful backtraces in debugger.
2929
debug = 0
3030

31+
[profile.dev-rel]
32+
inherits = "release"
33+
debug = 2
34+
3135
[patch.'crates-io']
3236
# rowan = { path = "../rowan" }
3337

crates/base-db/src/input.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -570,7 +570,7 @@ impl CrateGraph {
570570
.arena
571571
.iter_mut()
572572
.take(m)
573-
.find_map(|(id, data)| merge((id, data), (topo, &crate_data)).then_some(id));
573+
.find_map(|(id, data)| merge((id, data), (topo, crate_data)).then_some(id));
574574

575575
let new_id =
576576
if let Some(res) = res { res } else { self.arena.alloc(crate_data.clone()) };

crates/flycheck/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -494,7 +494,7 @@ impl CommandHandle {
494494
let (sender, receiver) = unbounded();
495495
let actor = CargoActor::new(sender, stdout, stderr);
496496
let thread = stdx::thread::Builder::new(stdx::thread::ThreadIntent::Worker)
497-
.name("CargoHandle".to_owned())
497+
.name("CommandHandle".to_owned())
498498
.spawn(move || actor.run())
499499
.expect("failed to spawn thread");
500500
Ok(CommandHandle { program, arguments, current_dir, child, thread, receiver })

crates/hir-def/src/body/lower.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ use std::mem;
66
use base_db::CrateId;
77
use either::Either;
88
use hir_expand::{
9-
ast_id_map::AstIdMap,
109
name::{name, AsName, Name},
1110
ExpandError, InFile,
1211
};
1312
use intern::Interned;
1413
use profile::Count;
1514
use rustc_hash::FxHashMap;
1615
use smallvec::SmallVec;
16+
use span::AstIdMap;
1717
use syntax::{
1818
ast::{
1919
self, ArrayExprKind, AstChildren, BlockExpr, HasArgList, HasAttrs, HasLoopBody, HasName,

crates/hir-def/src/body/tests/block.rs

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,40 @@ pub mod cov_mark {
298298
);
299299
}
300300

301+
#[test]
302+
fn macro_exported_in_block_mod() {
303+
check_at(
304+
r#"
305+
#[macro_export]
306+
macro_rules! foo {
307+
() => { pub struct FooWorks; };
308+
}
309+
macro_rules! bar {
310+
() => { pub struct BarWorks; };
311+
}
312+
fn main() {
313+
mod module {
314+
foo!();
315+
bar!();
316+
$0
317+
}
318+
}
319+
"#,
320+
expect![[r#"
321+
block scope
322+
module: t
323+
324+
block scope::module
325+
BarWorks: t v
326+
FooWorks: t v
327+
328+
crate
329+
foo: m
330+
main: v
331+
"#]],
332+
);
333+
}
334+
301335
#[test]
302336
fn macro_resolve_legacy() {
303337
check_at(

crates/hir-def/src/child_by_source.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,10 +189,11 @@ impl ChildBySource for DefWithBodyId {
189189
VariantId::EnumVariantId(v).child_by_source_to(db, res, file_id)
190190
}
191191

192-
for (_, def_map) in body.blocks(db) {
192+
for (block, def_map) in body.blocks(db) {
193193
// All block expressions are merged into the same map, because they logically all add
194194
// inner items to the containing `DefWithBodyId`.
195195
def_map[DefMap::ROOT].scope.child_by_source_to(db, res, file_id);
196+
res[keys::BLOCK].insert(block.lookup(db).ast_id.to_node(db.upcast()), block);
196197
}
197198
}
198199
}

crates/hir-def/src/dyn_map/keys.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,14 @@ use syntax::{ast, AstNode, AstPtr};
88

99
use crate::{
1010
dyn_map::{DynMap, Policy},
11-
ConstId, EnumId, EnumVariantId, ExternCrateId, FieldId, FunctionId, ImplId, LifetimeParamId,
12-
Macro2Id, MacroRulesId, ProcMacroId, StaticId, StructId, TraitAliasId, TraitId, TypeAliasId,
13-
TypeOrConstParamId, UnionId, UseId,
11+
BlockId, ConstId, EnumId, EnumVariantId, ExternCrateId, FieldId, FunctionId, ImplId,
12+
LifetimeParamId, Macro2Id, MacroRulesId, ProcMacroId, StaticId, StructId, TraitAliasId,
13+
TraitId, TypeAliasId, TypeOrConstParamId, UnionId, UseId,
1414
};
1515

1616
pub type Key<K, V> = crate::dyn_map::Key<K, V, AstPtrPolicy<K, V>>;
1717

18+
pub const BLOCK: Key<ast::BlockExpr, BlockId> = Key::new();
1819
pub const FUNCTION: Key<ast::Fn, FunctionId> = Key::new();
1920
pub const CONST: Key<ast::Const, ConstId> = Key::new();
2021
pub const STATIC: Key<ast::Static, StaticId> = Key::new();

0 commit comments

Comments
 (0)