Skip to content

Rollup of 11 pull requests #96087

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 26 commits into from
Apr 15, 2022
Merged
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
8c2353b
remove find_use_placement
kckeiks Mar 18, 2022
6b75406
Create 2024 edition
jhpratt Feb 28, 2022
7bd22e2
only downgrade Error -> Ambiguous if type error is in predicate
compiler-errors Apr 7, 2022
abf2b4c
Stabilize `derive_default_enum`
jhpratt Feb 28, 2022
a3dd654
Add documentation
jhpratt Mar 8, 2022
7c2d57e
couple of clippy::complexity fixes
matthiaskrgr Apr 13, 2022
21d3f84
test: add is_superset test cases for BTreeSet
Gumichocopengin8 Apr 14, 2022
50c339e
test: add remove() test cases for BTreeSet
Gumichocopengin8 Apr 14, 2022
7a35c0f
Use u32 instead of i32 for futexes.
m-ou-se Apr 14, 2022
75287dd
remove function param that is only used in recursive of fn inner()
matthiaskrgr Apr 13, 2022
15abc81
remove reudndant function param in check_matcher_core()
matthiaskrgr Apr 13, 2022
6511976
remove redundant function param in check_for_self_assign_helper()
matthiaskrgr Apr 13, 2022
c20bb1d
Update issue-92893.stderr
ouz-a Apr 14, 2022
5459e66
docs: Update tests chapter for Termination stabilization
ehuss Apr 14, 2022
f9188cc
use `format-args-capture` and remove unnecessary nested block
TaKO8Ki Apr 15, 2022
27e2d81
Rollup merge of #94457 - jhpratt:stabilize-derive_default_enum, r=dav…
Dylan-DPC Apr 15, 2022
20bf34f
Rollup merge of #94461 - jhpratt:2024-edition, r=pnkfelix
Dylan-DPC Apr 15, 2022
a32e0f3
Rollup merge of #94849 - ouz-a:master4, r=oli-obk
Dylan-DPC Apr 15, 2022
bdbf099
Rollup merge of #95194 - kckeiks:update-algo-in-find-use-placement, r…
Dylan-DPC Apr 15, 2022
7478294
Rollup merge of #95749 - compiler-errors:ambig, r=oli-obk
Dylan-DPC Apr 15, 2022
ba9c3a1
Rollup merge of #96026 - matthiaskrgr:clippy_compl_1304, r=Dylan-DPC
Dylan-DPC Apr 15, 2022
937b0a0
Rollup merge of #96027 - matthiaskrgr:clippy_rec, r=fee1-dead
Dylan-DPC Apr 15, 2022
224afad
Rollup merge of #96034 - Gumichocopengin8:test/btree-set, r=Dylan-DPC
Dylan-DPC Apr 15, 2022
aa978ad
Rollup merge of #96040 - m-ou-se:futex-u32, r=Amanieu
Dylan-DPC Apr 15, 2022
18a7ce3
Rollup merge of #96062 - ehuss:test-termination, r=Dylan-DPC
Dylan-DPC Apr 15, 2022
fa281fd
Rollup merge of #96065 - TaKO8Ki:use-`format-args-capture`-and-remove…
Dylan-DPC Apr 15, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
remove reudndant function param in check_matcher_core()
  • Loading branch information
matthiaskrgr committed Apr 14, 2022
commit 15abc81967b1c8ed4cde8b0e3aa726aaa9323c0c
26 changes: 7 additions & 19 deletions compiler/rustc_expand/src/mbe/macro_rules.rs
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ pub fn compile_declarative_macro(
)
.pop()
.unwrap();
valid &= check_lhs_nt_follows(&sess.parse_sess, features, &def, &tt);
valid &= check_lhs_nt_follows(&sess.parse_sess, &def, &tt);
return tt;
}
sess.parse_sess.span_diagnostic.span_bug(def.span, "wrong-structured lhs")
Expand Down Expand Up @@ -563,16 +563,11 @@ pub fn compile_declarative_macro(
}))
}

fn check_lhs_nt_follows(
sess: &ParseSess,
features: &Features,
def: &ast::Item,
lhs: &mbe::TokenTree,
) -> bool {
fn check_lhs_nt_follows(sess: &ParseSess, def: &ast::Item, lhs: &mbe::TokenTree) -> bool {
// lhs is going to be like TokenTree::Delimited(...), where the
// entire lhs is those tts. Or, it can be a "bare sequence", not wrapped in parens.
if let mbe::TokenTree::Delimited(_, delimited) = lhs {
check_matcher(sess, features, def, &delimited.tts)
check_matcher(sess, def, &delimited.tts)
} else {
let msg = "invalid macro matcher; matchers must be contained in balanced delimiters";
sess.span_diagnostic.span_err(lhs.span(), msg);
Expand Down Expand Up @@ -632,16 +627,11 @@ fn check_rhs(sess: &ParseSess, rhs: &mbe::TokenTree) -> bool {
false
}

fn check_matcher(
sess: &ParseSess,
features: &Features,
def: &ast::Item,
matcher: &[mbe::TokenTree],
) -> bool {
fn check_matcher(sess: &ParseSess, def: &ast::Item, matcher: &[mbe::TokenTree]) -> bool {
let first_sets = FirstSets::new(matcher);
let empty_suffix = TokenSet::empty();
let err = sess.span_diagnostic.err_count();
check_matcher_core(sess, features, def, &first_sets, matcher, &empty_suffix);
check_matcher_core(sess, def, &first_sets, matcher, &empty_suffix);
err == sess.span_diagnostic.err_count()
}

Expand Down Expand Up @@ -955,7 +945,6 @@ impl<'tt> TokenSet<'tt> {
// see `FirstSets::new`.
fn check_matcher_core<'tt>(
sess: &ParseSess,
features: &Features,
def: &ast::Item,
first_sets: &FirstSets<'tt>,
matcher: &'tt [mbe::TokenTree],
Expand Down Expand Up @@ -1008,7 +997,7 @@ fn check_matcher_core<'tt>(
token::CloseDelim(d.delim),
span.close,
));
check_matcher_core(sess, features, def, first_sets, &d.tts, &my_suffix);
check_matcher_core(sess, def, first_sets, &d.tts, &my_suffix);
// don't track non NT tokens
last.replace_with_irrelevant();

Expand Down Expand Up @@ -1040,8 +1029,7 @@ fn check_matcher_core<'tt>(
// At this point, `suffix_first` is built, and
// `my_suffix` is some TokenSet that we can use
// for checking the interior of `seq_rep`.
let next =
check_matcher_core(sess, features, def, first_sets, &seq_rep.tts, my_suffix);
let next = check_matcher_core(sess, def, first_sets, &seq_rep.tts, my_suffix);
if next.maybe_empty {
last.add_all(&next);
} else {
Expand Down