Skip to content

Commit d2dd4f6

Browse files
committed
Split out syntax-bridge into a separate crate
1 parent 670a5ab commit d2dd4f6

File tree

30 files changed

+268
-140
lines changed

30 files changed

+268
-140
lines changed

Cargo.lock

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

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ salsa = { path = "./crates/salsa", version = "0.0.0" }
7777
span = { path = "./crates/span", version = "0.0.0" }
7878
stdx = { path = "./crates/stdx", version = "0.0.0" }
7979
syntax = { path = "./crates/syntax", version = "0.0.0" }
80+
syntax-bridge = { path = "./crates/syntax-bridge", version = "0.0.0" }
8081
text-edit = { path = "./crates/text-edit", version = "0.0.0" }
8182
toolchain = { path = "./crates/toolchain", version = "0.0.0" }
8283
tt = { path = "./crates/tt", version = "0.0.0" }

crates/cfg/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ arbitrary = "1.3.2"
2828
derive_arbitrary = "1.3.2"
2929

3030
# local deps
31-
mbe.workspace = true
31+
syntax-bridge.workspace = true
3232
syntax.workspace = true
3333

3434
[lints]

crates/cfg/src/tests.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
use arbitrary::{Arbitrary, Unstructured};
22
use expect_test::{expect, Expect};
33
use intern::Symbol;
4-
use mbe::{syntax_node_to_token_tree, DocCommentDesugarMode, DummyTestSpanMap, DUMMY};
54
use syntax::{ast, AstNode, Edition};
5+
use syntax_bridge::{
6+
dummy_test_span_utils::{DummyTestSpanMap, DUMMY},
7+
syntax_node_to_token_tree, DocCommentDesugarMode,
8+
};
69

710
use crate::{CfgAtom, CfgExpr, CfgOptions, DnfExpr};
811

crates/hir-def/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ expect-test.workspace = true
5252
# local deps
5353
test-utils.workspace = true
5454
test-fixture.workspace = true
55-
55+
syntax-bridge.workspace = true
5656
[features]
5757
in-rust-tree = ["hir-expand/in-rust-tree"]
5858

crates/hir-def/src/attr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -657,9 +657,9 @@ mod tests {
657657
use triomphe::Arc;
658658

659659
use hir_expand::span_map::{RealSpanMap, SpanMap};
660-
use mbe::{syntax_node_to_token_tree, DocCommentDesugarMode};
661660
use span::FileId;
662661
use syntax::{ast, AstNode, TextRange};
662+
use syntax_bridge::{syntax_node_to_token_tree, DocCommentDesugarMode};
663663

664664
use crate::attr::{DocAtom, DocExpr};
665665

crates/hir-def/src/macro_expansion_tests/mbe.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1201,7 +1201,6 @@ macro_rules! m {
12011201

12021202
#[test]
12031203
fn test_meta_doc_comments() {
1204-
cov_mark::check!(test_meta_doc_comments);
12051204
check(
12061205
r#"
12071206
macro_rules! m {

crates/hir-def/src/macro_expansion_tests/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -317,9 +317,9 @@ impl ProcMacroExpander for IdentityWhenValidProcMacroExpander {
317317
_: Span,
318318
_: Span,
319319
) -> Result<Subtree, ProcMacroExpansionError> {
320-
let (parse, _) = ::mbe::token_tree_to_syntax_node(
320+
let (parse, _) = syntax_bridge::token_tree_to_syntax_node(
321321
subtree,
322-
::mbe::TopEntryPoint::MacroItems,
322+
syntax_bridge::TopEntryPoint::MacroItems,
323323
span::Edition::CURRENT,
324324
);
325325
if parse.errors().is_empty() {

crates/hir-expand/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ mbe.workspace = true
3333
limit.workspace = true
3434
span.workspace = true
3535
parser.workspace = true
36+
syntax-bridge.workspace = true
3637

3738
[dev-dependencies]
3839
expect-test = "1.4.0"

crates/hir-expand/src/attrs.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,12 @@ use cfg::CfgExpr;
66
use either::Either;
77
use intern::{sym, Interned, Symbol};
88

9-
use mbe::{
10-
desugar_doc_comment_text, syntax_node_to_token_tree, DelimiterKind, DocCommentDesugarMode,
11-
Punct,
12-
};
9+
use mbe::{DelimiterKind, Punct};
1310
use smallvec::{smallvec, SmallVec};
1411
use span::{Span, SyntaxContextId};
1512
use syntax::unescape;
1613
use syntax::{ast, match_ast, AstNode, AstToken, SyntaxNode};
14+
use syntax_bridge::{desugar_doc_comment_text, syntax_node_to_token_tree, DocCommentDesugarMode};
1715
use triomphe::ThinArc;
1816

1917
use crate::name::Name;

0 commit comments

Comments
 (0)