diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-11-02 13:08:53 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2020-11-02 13:08:53 +0000 |
commit | 731b38fa3c1694648e6c8e60f61820f9783343eb (patch) | |
tree | b3f4e94e8eac9bb24296aacafacb100930bee59e /crates/mbe | |
parent | 6507877e7039d4517682a4fc232356662f509d81 (diff) | |
parent | b6101184537b1165cfdd5fc473e04ad4c5b7bffa (diff) |
Merge #6438
6438: Deny unreachable-pub r=matklad a=matklad
It's very useful when `pub` is equivalent to "this is crate's public
API", let's enforce this!
Ideally, we should enforce it for local `cargo test`, and only during
CI, but that needs https://github.com/rust-lang/cargo/issues/5034.
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/mbe')
-rw-r--r-- | crates/mbe/src/mbe_expander/matcher.rs | 10 | ||||
-rw-r--r-- | crates/mbe/src/subtree_source.rs | 8 |
2 files changed, 9 insertions, 9 deletions
diff --git a/crates/mbe/src/mbe_expander/matcher.rs b/crates/mbe/src/mbe_expander/matcher.rs index b698b9832..39a8eefbd 100644 --- a/crates/mbe/src/mbe_expander/matcher.rs +++ b/crates/mbe/src/mbe_expander/matcher.rs | |||
@@ -61,16 +61,16 @@ macro_rules! err { | |||
61 | 61 | ||
62 | #[derive(Debug, Default)] | 62 | #[derive(Debug, Default)] |
63 | pub(super) struct Match { | 63 | pub(super) struct Match { |
64 | pub bindings: Bindings, | 64 | pub(super) bindings: Bindings, |
65 | /// We currently just keep the first error and count the rest to compare matches. | 65 | /// We currently just keep the first error and count the rest to compare matches. |
66 | pub err: Option<ExpandError>, | 66 | pub(super) err: Option<ExpandError>, |
67 | pub err_count: usize, | 67 | pub(super) err_count: usize, |
68 | /// How many top-level token trees were left to match. | 68 | /// How many top-level token trees were left to match. |
69 | pub unmatched_tts: usize, | 69 | pub(super) unmatched_tts: usize, |
70 | } | 70 | } |
71 | 71 | ||
72 | impl Match { | 72 | impl Match { |
73 | pub fn add_err(&mut self, err: ExpandError) { | 73 | pub(super) fn add_err(&mut self, err: ExpandError) { |
74 | let prev_err = self.err.take(); | 74 | let prev_err = self.err.take(); |
75 | self.err = prev_err.or(Some(err)); | 75 | self.err = prev_err.or(Some(err)); |
76 | self.err_count += 1; | 76 | self.err_count += 1; |
diff --git a/crates/mbe/src/subtree_source.rs b/crates/mbe/src/subtree_source.rs index 396ce8b16..38237cdcf 100644 --- a/crates/mbe/src/subtree_source.rs +++ b/crates/mbe/src/subtree_source.rs | |||
@@ -7,9 +7,9 @@ use tt::buffer::{Cursor, TokenBuffer}; | |||
7 | 7 | ||
8 | #[derive(Debug, Clone, Eq, PartialEq)] | 8 | #[derive(Debug, Clone, Eq, PartialEq)] |
9 | struct TtToken { | 9 | struct TtToken { |
10 | pub kind: SyntaxKind, | 10 | kind: SyntaxKind, |
11 | pub is_joint_to_next: bool, | 11 | is_joint_to_next: bool, |
12 | pub text: SmolStr, | 12 | text: SmolStr, |
13 | } | 13 | } |
14 | 14 | ||
15 | pub(crate) struct SubtreeTokenSource<'a> { | 15 | pub(crate) struct SubtreeTokenSource<'a> { |
@@ -30,7 +30,7 @@ impl<'a> SubtreeTokenSource<'a> { | |||
30 | } | 30 | } |
31 | 31 | ||
32 | impl<'a> SubtreeTokenSource<'a> { | 32 | impl<'a> SubtreeTokenSource<'a> { |
33 | pub fn new(buffer: &'a TokenBuffer) -> SubtreeTokenSource<'a> { | 33 | pub(crate) fn new(buffer: &'a TokenBuffer) -> SubtreeTokenSource<'a> { |
34 | let cursor = buffer.begin(); | 34 | let cursor = buffer.begin(); |
35 | 35 | ||
36 | let mut res = SubtreeTokenSource { | 36 | let mut res = SubtreeTokenSource { |