Skip to content
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

Add meta-variable checks in macro definitions #62008

Merged
merged 2 commits into from Jul 20, 2019

Conversation

@ia0
Copy link
Contributor

commented Jun 20, 2019

This is an implementation of #61053. It is not sound (some errors are not reported) and not complete (reports may not be actual errors). This is due to the possibility to define macros in macros in indirect ways. See module documentation of macro_check for more details.

What remains to be done:

  • Migrate from an error to an allow-by-default lint.
  • Add more comments in particular for the handling of nested macros.
  • Add more tests if needed.
  • Try to avoid cloning too much (one idea is to use lists on the stack).
  • Run crater with deny-by-default lint (measure rate of false positives).
    • Remove extra commit for deny-by-default lint
  • Create a PR to remove the old question_mark_macro_sep lint #62160
@rust-highfive

This comment has been minimized.

Copy link
Collaborator

commented Jun 20, 2019

r? @pnkfelix

(rust_highfive has picked a reviewer for you, use r? to override)

@ia0 ia0 referenced this pull request Jun 20, 2019

Open

MBE: more checks at definition time #61053

4 of 4 tasks complete
@ia0

This comment has been minimized.

Copy link
Contributor Author

commented Jun 20, 2019

r? @mark-i-m

(not sure it's ready for final review, but the functionality is there)

@rust-highfive

This comment has been minimized.

Copy link
Collaborator

commented Jun 20, 2019

The job x86_64-gnu-llvm-6.0 of your PR failed on Travis (raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
travis_time:end:156083f7:start=1561068109992105956,finish=1561068211102024522,duration=101109918566
$ git checkout -qf FETCH_HEAD
travis_fold:end:git.checkout

Encrypted environment variables have been removed for security reasons.
See https://docs.travis-ci.com/user/pull-requests/#pull-requests-and-security-restrictions
$ export SCCACHE_BUCKET=rust-lang-ci-sccache2
$ export SCCACHE_REGION=us-west-1
$ export GCP_CACHE_BUCKET=rust-lang-ci-cache
$ export AWS_ACCESS_KEY_ID=AKIA46X5W6CZEJZ6XT55
---
    100% |████████████████████████████████| 51kB 21.0MB/s 
Collecting colorama<=0.3.9,>=0.2.5 (from awscli)
  Downloading https://files.pythonhosted.org/packages/db/c8/7dcf9dbcb22429512708fe3a547f8b6101c0d02137acbd892505aee57adf/colorama-0.3.9-py2.py3-none-any.whl
Collecting botocore==1.12.173 (from awscli)
  Downloading https://files.pythonhosted.org/packages/af/bb/226c21c8ff37c620412280e71dd7b0135c50d380ac212e3cd0c34d4bc6ef/botocore-1.12.173-py2.py3-none-any.whl (5.6MB)
    0% |▏                               | 20kB 27.3MB/s eta 0:00:01
    0% |▏                               | 30kB 33.8MB/s eta 0:00:01
    0% |▎                               | 40kB 34.9MB/s eta 0:00:01
    0% |▎                               | 51kB 36.2MB/s eta 0:00:01
---
[00:01:28] 
###################################                                       49.9%
######################################################################## 100.0%
[00:01:28] extracting /checkout/obj/build/cache/2019-05-23/cargo-beta-x86_64-unknown-linux-gnu.tar.gz
[00:01:28]     Updating git repository `https://github.com/ia0/rust-itertools`
[00:01:29]     Updating git repository `https://github.com/ia0/memoffset`
[00:01:30]     Updating git repository `https://github.com/ia0/proc-macro2`
[00:01:31]     Updating git repository `https://github.com/ia0/quick-error`
[00:01:31]     Updating git repository `https://github.com/ia0/syn`
[00:01:54]  Downloading crates ...
[00:01:54]   Downloaded cc v1.0.35
[00:01:54]   Downloaded filetime v0.2.4
[00:01:54]   Downloaded num_cpus v1.8.0
---
[00:01:54]   Downloaded itoa v0.4.4
[00:01:54]   Downloaded ryu v0.2.7
[00:01:54]   Downloaded quote v0.6.12
[00:01:54]   Downloaded unicode-xid v0.1.0
[00:01:54]    Compiling proc-macro2 v0.4.30 (https://github.com/ia0/proc-macro2?branch=rust_issues_61053#a1654272)
[00:01:54]    Compiling unicode-xid v0.1.0
[00:01:54]    Compiling syn v0.15.35 (https://github.com/ia0/syn?branch=rust_issues_61053#19397d4d)
[00:01:55]    Compiling libc v0.2.54
[00:01:55]    Compiling serde v1.0.92
[00:01:55]    Compiling fixedbitset v0.1.9
[00:01:55]    Compiling unicode-width v0.1.5
---
[00:03:08] travis_fold:end:log-system-info
travis_fold:start:stage0-tidy
travis_time:start:stage0-tidy
Building stage0 tool tidy (x86_64-unknown-linux-gnu)
[00:03:08]    Compiling proc-macro2 v0.4.30 (https://github.com/ia0/proc-macro2?branch=rust_issues_61053#a1654272)
[00:03:08]    Compiling unicode-xid v0.1.0
[00:03:08]    Compiling syn v0.15.35 (https://github.com/ia0/syn?branch=rust_issues_61053#19397d4d)
[00:03:08]    Compiling serde v1.0.92
[00:03:09]    Compiling ryu v0.2.7
[00:03:09]    Compiling lazy_static v1.3.0
[00:03:09]    Compiling regex v1.1.6
---

[00:04:15] travis_fold:start:tidy
travis_time:start:tidy
tidy check
[00:04:15] tidy error: /checkout/src/libsyntax/ext/tt/macro_check.rs:79: TODO is deprecated; use FIXME
[00:04:15] tidy error: /checkout/src/libsyntax/ext/tt/macro_check.rs:295: TODO is deprecated; use FIXME
[00:04:15] tidy error: /checkout/src/libsyntax/ext/tt/macro_check.rs:323: TODO is deprecated; use FIXME
[00:04:15] tidy error: /checkout/src/libsyntax/ext/tt/macro_check.rs:332: TODO is deprecated; use FIXME
[00:04:20] invalid source: "git+https://github.com/ia0/rust-itertools?branch=rust_issues_61053#7551238d3957a4061b5b3f8dce3e724866d8789d"
[00:04:20] invalid source: "git+https://github.com/ia0/memoffset?branch=rust_issues_61053#de2e76aed04d0964088a40be0f3db593c168ce22"
[00:04:20] invalid source: "git+https://github.com/ia0/proc-macro2?branch=rust_issues_61053#a165427201fa163f9a1d453fa2724f1ac516fd1d"
[00:04:20] invalid source: "git+https://github.com/ia0/quick-error?branch=rust_issues_61053#9dba52d5ceaa66d5ae342aaf220ebd45f939d8ba"
[00:04:20] invalid source: "git+https://github.com/ia0/syn?branch=rust_issues_61053#19397d4d3374062e3d015f0bf26a6c41e448f1bb"
[00:04:20] some tidy checks failed
[00:04:20] 
[00:04:20] 
[00:04:20] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/tidy" "/checkout/src" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "--no-vendor" "--quiet"
[00:04:20] 
[00:04:20] 
[00:04:20] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test src/tools/tidy
[00:04:20] Build completed unsuccessfully in 0:01:13
---
travis_time:end:01640358:start=1561068481433649578,finish=1561068481439194435,duration=5544857
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:26b3a217
$ ln -s . checkout && for CORE in obj/cores/core.*; do EXE=$(echo $CORE | sed 's|obj/cores/core\.[0-9]*\.!checkout!\(.*\)|\1|;y|!|/|'); if [ -f "$EXE" ]; then printf travis_fold":start:crashlog\n\033[31;1m%s\033[0m\n" "$CORE"; gdb --batch -q -c "$CORE" "$EXE" -iex 'set auto-load off' -iex 'dir src/' -iex 'set sysroot .' -ex bt -ex q; echo travis_fold":"end:crashlog; fi; done || true
travis_fold:end:after_failure.4
travis_fold:start:after_failure.5
travis_time:start:0fae6cdc
travis_time:start:0fae6cdc
$ cat ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers || true
cat: ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers: No such file or directory
travis_fold:end:after_failure.5
travis_fold:start:after_failure.6
travis_time:start:04e564e4
$ dmesg | grep -i kill

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN. (Feature Requests)

@petrochenkov petrochenkov self-assigned this Jun 20, 2019

Show resolved Hide resolved Cargo.toml Outdated
@mark-i-m

This comment has been minimized.

Copy link
Contributor

commented Jun 21, 2019

Thanks @ia0! I will take a look soon.

For the sake of documentation:

Next steps:

  1. make this an allow-by-default lint
  2. do a crater run
@mark-i-m
Copy link
Contributor

left a comment

@ia0 This is excellent! Overall I think it looks good. I left a bunch of comments, but none of them is a major issue. My comments fall into 3 categories:

  1. Blocking bors try
    • TODO will cause tidy to fail. Use FIXME instead (more below).
    • Change to allow-by-default lint.
  2. Blocking r=me
    • Using SmallVec instead of Vec. This will avoid heap allocations in a few places in the most common case.
    • It would be good to have more comments in some places. The handling of nested macros is a bit subtle and non-obvious. I've left notes where I think the comments could be augmented. (Overall, though, your comments were very helpful ❤️).
    • Would be good to use an enum instead of an integer for the state machine in check_nested_occurrences
    • Using DUMMY_SP is more conventional than Span::default, I think. Perhaps @petrochenkov can correct me if I am wrong.
    • In the ui tests, //~ERROR should be followed by a prefix of the error message
  3. Could be done in a followup PR (perhaps just leave FIXMEs for them)
    • Warning where we believe we are in a nested macro (false positives)
    • Reducing the amount of clone and to_owned.
    • Move is_delimited and is_token to inherent methods on TokenTree.

@petrochenkov It might also be good to get a perf run after crater.

Show resolved Hide resolved src/test/ui/macros/issue-61033-1.rs Outdated
Show resolved Hide resolved Cargo.toml Outdated
Show resolved Hide resolved src/test/ui/macros/issue-61053-different-kleene.rs Outdated
Show resolved Hide resolved src/test/ui/macros/issue-61053-different-kleene.rs Outdated
Show resolved Hide resolved src/test/ui/macros/issue-61053-missing-repetition.rs Outdated
Show resolved Hide resolved src/libsyntax/ext/tt/macro_check.rs Outdated
Show resolved Hide resolved src/libsyntax/ext/tt/macro_check.rs
Show resolved Hide resolved src/libsyntax/ext/tt/macro_check.rs Outdated
Show resolved Hide resolved src/libsyntax/ext/tt/macro_check.rs
Show resolved Hide resolved src/libsyntax/ext/tt/macro_check.rs
Show resolved Hide resolved src/libsyntax/ext/tt/quoted.rs Outdated

@ia0 ia0 force-pushed the ia0:issues_61053 branch from b01c02f to 5eda402 Jun 22, 2019

@ia0

This comment has been minimized.

Copy link
Contributor Author

commented Jun 22, 2019

@mark-i-m Thanks a lot for your comments! I applied the simple ones and realized a bit more how approximative the current check is. This is due to the fact that meta-variables in nested macros can be hidden by using a meta-variable for the dollar token: $dollar x instead of $x.

I'll focus on making this a lint and adding more comments explaining nested macros.

@rust-highfive

This comment has been minimized.

Copy link
Collaborator

commented Jun 22, 2019

The job x86_64-gnu-llvm-6.0 of your PR failed on Travis (raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
travis_time:end:0051a0e0:start=1561215901337485858,finish=1561215904250664147,duration=2913178289
$ git checkout -qf FETCH_HEAD
travis_fold:end:git.checkout

Encrypted environment variables have been removed for security reasons.
See https://docs.travis-ci.com/user/pull-requests/#pull-requests-and-security-restrictions
$ export SCCACHE_BUCKET=rust-lang-ci-sccache2
$ export SCCACHE_REGION=us-west-1
$ export GCP_CACHE_BUCKET=rust-lang-ci-cache
$ export AWS_ACCESS_KEY_ID=AKIA46X5W6CZEJZ6XT55
---
##########################################                                59.2%
################################################################          89.7%
######################################################################## 100.0%
[00:01:51] extracting /checkout/obj/build/cache/2019-05-23/cargo-beta-x86_64-unknown-linux-gnu.tar.gz
[00:01:51]     Updating git repository `https://github.com/ia0/rust-itertools`
[00:01:52]     Updating git repository `https://github.com/ia0/memoffset`
[00:01:52]     Updating git repository `https://github.com/ia0/proc-macro2`
[00:01:53]     Updating git repository `https://github.com/ia0/quick-error`
[00:01:53]     Updating git repository `https://github.com/ia0/syn`
[00:02:14]  Downloading crates ...
[00:02:15]   Downloaded filetime v0.2.4
[00:02:15]   Downloaded cc v1.0.35
[00:02:15]   Downloaded num_cpus v1.8.0
---
[00:02:15]   Downloaded itoa v0.4.4
[00:02:15]   Downloaded ryu v0.2.7
[00:02:15]   Downloaded quote v0.6.12
[00:02:15]   Downloaded unicode-xid v0.1.0
[00:02:15]    Compiling proc-macro2 v0.4.30 (https://github.com/ia0/proc-macro2?branch=rust_issues_61053#a1654272)
[00:02:15]    Compiling unicode-xid v0.1.0
[00:02:15]    Compiling syn v0.15.35 (https://github.com/ia0/syn?branch=rust_issues_61053#19397d4d)
[00:02:15]    Compiling libc v0.2.54
[00:02:16]    Compiling serde v1.0.92
[00:02:16]    Compiling unicode-width v0.1.5
[00:02:16]    Compiling cc v1.0.35
---
[00:03:24] travis_fold:end:log-system-info
travis_fold:start:stage0-tidy
travis_time:start:stage0-tidy
Building stage0 tool tidy (x86_64-unknown-linux-gnu)
[00:03:25]    Compiling proc-macro2 v0.4.30 (https://github.com/ia0/proc-macro2?branch=rust_issues_61053#a1654272)
[00:03:25]    Compiling unicode-xid v0.1.0
[00:03:25]    Compiling syn v0.15.35 (https://github.com/ia0/syn?branch=rust_issues_61053#19397d4d)
[00:03:25]    Compiling serde v1.0.92
[00:03:26]    Compiling ryu v0.2.7
[00:03:26]    Compiling ucd-util v0.1.3
[00:03:26]    Compiling regex v1.1.6
---

[00:04:30] travis_fold:start:tidy
travis_time:start:tidy
tidy check
[00:04:30] tidy error: /checkout/src/libsyntax/ext/tt/macro_check.rs:90: TODO is deprecated; use FIXME
[00:04:35] invalid source: "git+https://github.com/ia0/rust-itertools?branch=rust_issues_61053#7551238d3957a4061b5b3f8dce3e724866d8789d"
[00:04:35] invalid source: "git+https://github.com/ia0/memoffset?branch=rust_issues_61053#de2e76aed04d0964088a40be0f3db593c168ce22"
[00:04:35] invalid source: "git+https://github.com/ia0/proc-macro2?branch=rust_issues_61053#a165427201fa163f9a1d453fa2724f1ac516fd1d"
[00:04:35] invalid source: "git+https://github.com/ia0/quick-error?branch=rust_issues_61053#9dba52d5ceaa66d5ae342aaf220ebd45f939d8ba"
[00:04:35] invalid source: "git+https://github.com/ia0/syn?branch=rust_issues_61053#19397d4d3374062e3d015f0bf26a6c41e448f1bb"
[00:04:35] some tidy checks failed
[00:04:35] 
[00:04:35] 
[00:04:35] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/tidy" "/checkout/src" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "--no-vendor" "--quiet"
[00:04:35] 
[00:04:35] 
[00:04:35] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test src/tools/tidy
[00:04:35] Build completed unsuccessfully in 0:01:12
---
travis_time:end:061a3e20:start=1561216191139887896,finish=1561216191144258868,duration=4370972
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:1630a775
$ ln -s . checkout && for CORE in obj/cores/core.*; do EXE=$(echo $CORE | sed 's|obj/cores/core\.[0-9]*\.!checkout!\(.*\)|\1|;y|!|/|'); if [ -f "$EXE" ]; then printf travis_fold":start:crashlog\n\033[31;1m%s\033[0m\n" "$CORE"; gdb --batch -q -c "$CORE" "$EXE" -iex 'set auto-load off' -iex 'dir src/' -iex 'set sysroot .' -ex bt -ex q; echo travis_fold":"end:crashlog; fi; done || true
travis_fold:end:after_failure.4
travis_fold:start:after_failure.5
travis_time:start:301561ec
travis_time:start:301561ec
$ cat ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers || true
cat: ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers: No such file or directory
travis_fold:end:after_failure.5
travis_fold:start:after_failure.6
travis_time:start:03060b74
$ dmesg | grep -i kill

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN. (Feature Requests)

@mark-i-m

This comment has been minimized.

Copy link
Contributor

commented Jun 22, 2019

@ia0 Thanks :) I think the check in its current form probably covers the vast majority of use cases. If somebody is doing $dollar x perhaps they deserve to have bug :p

Regarding the macros.len() > 0 check, I leave up to you, but I think they could be useful. Generally, I think people tend to respond to the presence of a warning, but not its absence (e.g. this is why EV Certificates are less effective than they could be). But I agree that we can leave it off for now.

@petrochenkov

This comment has been minimized.

Copy link
Contributor

commented Jun 22, 2019

Meta: to make reviewing less painful, could you

  • remove the rustfmt commit 24304db from the PR
  • submit the fixes from 36e45be as a separate PR, it can be approved and rolled up immediately
  • turn the error into a lint and remove the dependency patching 0a905d5 from this PR
@ia0

This comment has been minimized.

Copy link
Contributor Author

commented Jun 22, 2019

I turned the errors into a lint (and removed the overridden dependencies).
I submitted the fixes separately in #62068 (they are not needed anymore because the lint is allow-by-default).
But I don't understand what you mean by "remove the rustfmt commit". Do you mean squash it with the code change? Then we would mix non-semantic change with semantic change in the same commit which is harder to read, right?

@ia0 ia0 force-pushed the ia0:issues_61053 branch from 034fe1d to ba71257 Jun 22, 2019

@mark-i-m

This comment has been minimized.

Copy link
Contributor

commented Jun 22, 2019

But I don't understand what you mean by "remove the rustfmt commit". Do you mean squash it with the code change? Then we would mix non-semantic change with semantic change in the same commit which is harder to read, right?

Might be easiest if you just submit that commit as another PR too.

Centril added a commit to Centril/rust that referenced this pull request Jun 22, 2019

Rollup merge of rust-lang#62068 - ia0:fix_meta_var, r=petrochenkov
Fix meta-variable binding errors in macros

The errors are either:
- The meta-variable used in the right-hand side is not bound (or defined) in the
  left-hand side.
- The meta-variable used in the right-hand side does not repeat with the same
  kleene operator as its binder in the left-hand side. Either it does not repeat
  enough, or it uses a different operator somewhere.

This change should have no semantic impact.

Found by rust-lang#62008
@ia0

This comment has been minimized.

Copy link
Contributor Author

commented Jun 23, 2019

Might be easiest if you just submit that commit as another PR too.

Indeed, created #62070. And actually even the second commit (storing kleene operator span) can be submitted in a separate PR. All commits in this PR are orthogonal.

@ia0 ia0 force-pushed the ia0:issues_61053 branch 2 times, most recently from a148f69 to 7d06bd0 Jun 23, 2019

@craterbot

This comment has been minimized.

Copy link
Collaborator

commented Jul 17, 2019

🛠 Experiment pr-62008 queued again.

ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@craterbot

This comment has been minimized.

Copy link
Collaborator

commented Jul 17, 2019

🚧 Experiment pr-62008 is now running on agent aws-2.

ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@craterbot

This comment has been minimized.

Copy link
Collaborator

commented Jul 17, 2019

🎉 Experiment pr-62008 is completed!
📊 2820 regressed and 0 fixed (66894 total)
📰 Open the full report.

⚠️ If you notice any spurious failure please add them to the blacklist!
ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@petrochenkov

This comment has been minimized.

Copy link
Contributor

commented Jul 17, 2019

@ia0
FYI, crater logs can be downloaded for grepping or other processing here - https://crater-reports.s3.amazonaws.com/pr-62008/downloads.html.

@ia0 ia0 referenced this pull request Jul 17, 2019

Merged

Fix meta variable misuse #998

@ia0

This comment has been minimized.

Copy link
Contributor Author

commented Jul 17, 2019

The content of this post has been moved to the issue: #61053 (comment).

@pietroalbini

This comment has been minimized.

Copy link
Member

commented Jul 17, 2019

Yeah, you should only look at the regressed section.

@mark-i-m

This comment has been minimized.

Copy link
Contributor

commented Jul 19, 2019

@ia0 Is there a way to filter out the transitive failures? I would hate for you to have to look through thousands of error message.

@ia0

This comment has been minimized.

Copy link
Contributor Author

commented Jul 19, 2019

What I'm doing is grep -v -e ::nom:: -e ::quick_error:: -e ::error_chain:: to only see the crates that have new errors. This solution has false negatives since I may skip a crate that has interesting errors in addition to uninteresting ones. But for now, I'll try to do a first pass like that, and if I don't find any interesting errors (false positives for the meta-variable-misuse lint), then I'll try to do something at the error message level instead.

Also, note that the issue of transitive failures is probably because I use ast::CRATE_NODE_ID instead of def.id when calling macro_check::check_meta_variables. But I had errors if I used the second. I'm not sure how to address that.

@petrochenkov

This comment has been minimized.

Copy link
Contributor

commented Jul 19, 2019

@ia0
Could you remove the last commit?
We can land this as is with the lint being allow-by-default, and figure out how to improve on ast::CRATE_NODE_ID later.

The node ID determines the scope in which the lint can be allowed or denyed, with ast::CRATE_NODE_ID lints in particular being allow-able only with a crate-level attribute, it should have no effect on crater results.

@petrochenkov

This comment has been minimized.

Copy link
Contributor

commented Jul 19, 2019

"Non-root" regressions are probably from macros generating macro definitions.
The root crate defines such macro, then dependencies expand it into the new macro definitions, which are reported as errors.

Issues like this are usually fixed by disabling lints for items (macro items in this case) produced by macros from other crates.

ia0 added some commits May 29, 2019

Remember the span of the Kleene operator in macros
This is needed for having complete error messages where reporting macro variable
errors. Here is what they would look like:

error: meta-variable repeats with different kleene operator
  --> $DIR/issue-61053-different-kleene.rs:3:57
   |
LL |     ( $( $i:ident = $($j:ident),+ );* ) => { $( $( $i = $j; )* )* };
   |                                 - expected repetition   ^^   - conflicting repetition

@ia0 ia0 force-pushed the ia0:issues_61053 branch from 8e6fca2 to 6ec4584 Jul 19, 2019

@petrochenkov

This comment has been minimized.

Copy link
Contributor

commented Jul 20, 2019

@bors r+

@bors

This comment has been minimized.

Copy link
Contributor

commented Jul 20, 2019

📌 Commit 6ec4584 has been approved by petrochenkov

@bors

This comment has been minimized.

Copy link
Contributor

commented Jul 20, 2019

⌛️ Testing commit 6ec4584 with merge e9d2227...

bors added a commit that referenced this pull request Jul 20, 2019

Auto merge of #62008 - ia0:issues_61053, r=petrochenkov
Add meta-variable checks in macro definitions

This is an implementation of #61053. It is not sound (some errors are not reported) and not complete (reports may not be actual errors). This is due to the possibility to define macros in macros in indirect ways. See module documentation of `macro_check` for more details.

What remains to be done:
- [x] Migrate from an error to an allow-by-default lint.
- [x] Add more comments in particular for the handling of nested macros.
- [x] Add more tests if needed.
- [x] Try to avoid cloning too much (one idea is to use lists on the stack).
- [ ] Run crater with deny-by-default lint (measure rate of false positives).
    - [ ] Remove extra commit for deny-by-default lint
- [x] Create a PR to remove the old `question_mark_macro_sep` lint #62160
@bors

This comment has been minimized.

Copy link
Contributor

commented Jul 20, 2019

☀️ Test successful - checks-azure
Approved by: petrochenkov
Pushing e9d2227 to master...

@bors bors added the merged-by-bors label Jul 20, 2019

@bors bors merged commit 6ec4584 into rust-lang:master Jul 20, 2019

5 checks passed

homu Test successful
Details
pr Build #20190719.30 succeeded
Details
pr (Linux mingw-check) Linux mingw-check succeeded
Details
pr (Linux x86_64-gnu-llvm-6.0) Linux x86_64-gnu-llvm-6.0 succeeded
Details
pr (LinuxTools) LinuxTools succeeded
Details

@ia0 ia0 deleted the ia0:issues_61053 branch Jul 20, 2019

@ia0 ia0 referenced this pull request Jul 21, 2019

Merged

Fix meta variable misuse #269

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.