about summary refs log tree commit diff
path: root/src/test/ui/proc-macro
AgeCommit message (Collapse)AuthorLines
2023-01-11Move /src/test to /testsAlbert Larsan-18972/+0
2022-12-22Mark `proc_macro_decls_static` as always usedJoshua Nelson-0/+1
This would have avoided a bug in https://github.com/rust-lang/rust/pull/104860. In practice this shouldn't matter since nothing uses the query other than the `dead_code` lint, but this isn't documented as an internal-only query so it seems nice for it to be accurate. I think for `dead_code` it doesn't matter because the relevant code is generated by `rustc_builtin_macros` and isn't linted.
2022-12-13Avoid rendering empty annotationsOli Scherer-4/+0
2022-12-13Make some diagnostics not depend on the source of what they reference being ↵Oli Scherer-32/+15
available
2022-12-10Migrate parts of `rustc_expand` to session diagnosticsnils-20/+28
This migrates everything but the `mbe` and `proc_macro` modules. It also contains a few cleanups and drive-by/accidental diagnostic improvements which can be seen in the diff for the UI tests.
2022-11-29fix #104884, Avoid Invalid code suggested when encountering unsatisfied ↵yukang-0/+91
trait bounds in derive macro code
2022-11-14Update src/test/ui/proc-macro/expand-expr.rsclubby789-2/+2
Co-authored-by: Daniel Henry-Mantilla <daniel.henry.mantilla@gmail.com>
2022-11-14Fix using `include_bytes` in pattern positionclubby789-1/+7
2022-11-11Introduce `ExprKind::IncludedBytes`clubby789-8/+13
2022-11-01Rollup merge of #84022 - Aaron1011:remove-derive-res-fallback, r=petrochenkovDylan DPC-100/+36
Make PROC_MACRO_DERIVE_RESOLUTION_FALLBACK a hard error r? `@ghost`
2022-10-27Correct inconsistent error messages in testsByron Zhong-2/+2
2022-10-24Make PROC_MACRO_DERIVE_RESOLUTION_FALLBACK a hard errorAaron Hill-100/+36
2022-10-21Only apply `ProceduralMasquerade` hack to older versions of `rental`Aaron Hill-105/+321
The latest version of `rental` (v0.5.6) contains a fix that allows it to compile without relying on the pretty-print back-compat hack. Hopefully, there are no longer any crates relying on the affected versions of the (much less popular) `procedural-masquerade` crate. This should allow us to target the pretty-print back-compat hack specifically to older versions of `rental`, and specifically mention upgrading to `rental` v0.5.6 in the lint message.
2022-10-16Account for hygiene when suggesting typos.Camille GILLOT-4/+4
2022-10-14more dupe word typosRageking8-1/+1
2022-10-13fix small word dupe typosRageking8-4/+4
2022-10-05Delay function resolution error until typeckMichael Goulet-6/+6
2022-10-04Improve spans when splitting multi-char operator tokens for proc macros.Nicholas Nethercote-64/+64
2022-10-03Add some more operator cases to `dump-debug-span-debug.rs`.Nicholas Nethercote-32/+102
2022-10-01bless ui testsMaybe Waffle-20/+20
2022-09-27add a label to struct/enum/union ident nameTakayuki Maeda-1/+4
2022-09-23Restore ignore tagFlorian Bartels-1/+0
This test case actually requires std::process.
2022-09-16Rollup merge of #101741 - andrewpollack:add-needs-unwind-ui-tests, r=tmandryMichael Howell-11/+19
Adding needs-unwind arg to applicable compiler ui tests Adding `needs-unwind` arg to applicable compiler ui tests
2022-09-16Adding needs-unwind arg to applicable compiler ui testsAndrew Pollack-11/+19
2022-09-11Add test for #101211winxpqq955-0/+29
2022-09-04proc_macro/bridge: use the cross-thread executor for nested proc-macrosNika Layzell-3/+20
While working on some other changes in the bridge, I noticed that when running a nested proc-macro (which is currently only possible using the unstable `TokenStream::expand_expr`), any symbols held by the proc-macro client would be invalidated, as the same thread would be used for the nested macro by default, and the interner doesn't handle nested use. After discussing with @eddyb, we decided the best approach might be to force the use of the cross-thread executor for nested invocations, as it will never re-use thread-local storage, avoiding the issue. This shouldn't impact performance, as expand_expr is still unstable, and infrequently used. This was chosen rather than making the client symbol interner handle nested invocations, as that would require replacing the internal interner `Vec` with a `BTreeMap` (as valid symbol id ranges could now be disjoint), and the symbol interner is known to be fairly perf-sensitive. This patch adds checks to the execution strategy to use the cross-thread executor when doing nested invocations. An alternative implementation strategy could be to track this information in the `ExtCtxt`, however a thread-local in the `proc_macro` crate was chosen to add an assertion so that `rust-analyzer` is aware of the issue if it implements `expand_expr` in the future. r? @eddyb
2022-09-04Rollup merge of #100647 - obeis:issue-99875, r=nagisaMatthias Krüger-1/+1
Make trait bound not satisfied specify kind Closes #99875
2022-08-31Fix a bunch of typoDezhi Wu-1/+1
This PR will fix some typos detected by [typos]. I only picked the ones I was sure were spelling errors to fix, mostly in the comments. [typos]: https://github.com/crate-ci/typos
2022-08-29Make the trait bound is not satisfied specify kindObei Sideg-1/+1
2022-08-28Remove `register_attr`-related testsYuki Okushi-247/+183
Signed-off-by: Yuki Okushi <jtitor@2k36.org>
2022-08-21Account for relative pathsMichael Goulet-1/+4
2022-08-08add regression test for #79148Takayuki Maeda-0/+45
2022-07-31Remove workarounds for issue 59998bjorn3-29/+39
2022-07-19Auto merge of #99451 - Dylan-DPC:rollup-ceghu18, r=Dylan-DPCbors-7/+7
Rollup of 8 pull requests Successful merges: - #97183 (wf-check generators) - #98320 (Mention first and last macro in backtrace) - #99335 (Use split_once in FromStr docs) - #99347 (Use `LocalDefId` in `OpaqueTypeKey`) - #99392 (Fix debuginfo tests.) - #99404 (Use span_bug for unexpected field projection type) - #99410 (Update invalid atomic ordering lint) - #99434 (Fix `Skip::next` for non-fused inner iterators) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-07-19Mention first and last macro in backtraceMichael Goulet-7/+7
2022-07-18proc_macro: stop using a remote object handle for IdentNika Layzell-28/+12
Doing this for all unicode identifiers would require a dependency on `unicode-normalization` and `rustc_lexer`, which is currently not possible for `proc_macro` due to it being built concurrently with `std` and `core`. Instead, ASCII identifiers are validated locally, and an RPC message is used to validate unicode identifiers when needed. String values are interned on the both the server and client when deserializing, to avoid unnecessary copies and keep Ident cheap to copy and move. This appears to be important for performance. The client-side interner is based roughly on the one from rustc_span, and uses an arena inspired by rustc_arena. RPC messages passing symbols always include the full value. This could potentially be optimized in the future if it is revealed to be a performance bottleneck. Despite now having a relevant implementaion of Display for Ident, ToString is still specialized, as it is a hot-path for this object. The symbol infrastructure will also be used for literals in the next part.
2022-07-15Auto merge of #98203 - kckeiks:gather-body-owners-in-hir-item-queries, ↵bors-8/+8
r=cjgillot gather body owners Issue #96341
2022-07-13use gathered body_owners in par_body_ownersMiguel Guarniz-8/+8
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2022-07-10Auto merge of #98463 - mystor:expand_expr_bool, r=eddybbors-1/+70
proc_macro: Fix expand_expr expansion of bool literals Previously, the expand_expr method would expand bool literals as a `Literal` token containing a `LitKind::Bool`, rather than as an `Ident`. This is not a valid token, and the `LitKind::Bool` case needs to be handled seperately. Tests were added to more deeply compare the streams in the expand-expr test suite to catch mistakes like this in the future.
2022-07-06use `named_span` in case of tuple variantTakayuki Maeda-3/+3
2022-07-01Shorten def_span for more items.Camille GILLOT-2/+2
2022-06-29Rollup merge of #98660 - eddyb:invalid-punct-stage1, r=lqdMatthias Krüger-14/+6
Unbreak stage1 tests via ignore-stage1 in `proc-macro/invalid-punct-ident-1.rs`. #98188 broke `./x.py test --stage 1` (which I thought we ran in PR CI, cc `@rust-lang/infra)` i.e. the default `./x.py test` in dev checkouts, as the panic in `src/test/ui/proc-macro/invalid-punct-ident-1.rs` moved from the server (`rustc`) to the client (proc macro), and that means it's now affected by #59998. I made the test look like `src/test/ui-fulldeps/issue-76270-panic-in-libproc-macro.rs` tho I'm a bit confused why that one is in `src/test/ui-fulldeps`, it should still work in `src/test/ui`, no? (cc `@Aaron1011)`
2022-06-29Rollup merge of #98607 - compiler-errors:tuple-wrap-suggestion, r=oli-obkDylan DPC-4/+1
Clean up arg mismatch diagnostic, generalize tuple wrap suggestion This is based on top of #97542, so just look at the last commit which contains the relevant changes. 1. Remove `final_arg_types` which was one of the last places we were using raw (`usize`) indices instead of typed indices in the arg mismatch suggestion code. 2. Improve the tuple wrap suggestion, now we suggest things like `call(a, b, c, d)` -> `call(a, (b, c), d)` :smiley_cat: 3. Folded in fix #98645
2022-06-29Unbreak stage1 tests via ignore-stage1 in `proc-macro/invalid-punct-ident-1.rs`.Eduard-Mihai Burtescu-14/+6
2022-06-28Don't point at another arg if we're already pointing at oneMichael Goulet-4/+1
2022-06-26proc_macro: stop using a remote object handle for PunctNika Layzell-1/+1
This greatly reduces round-trips to fetch relevant extra information about the token in proc macro code, and avoids RPC messages to create Punct tokens.
2022-06-24proc_macro: Fix expand_expr expansion of bool literalsNika Layzell-1/+70
Previously, the expand_expr method would expand bool literals as a `Literal` token containing a `LitKind::Bool`, rather than as an `Ident`. This is not a valid token, and the `LitKind::Bool` case needs to be handled seperately. Tests were added to more deeply compare the streams in the expand-expr test suite to catch mistakes like this in the future.
2022-06-17Rollup merge of #97377 - ChayimFriedman2:issue-91800, r=estebankYuki Okushi-0/+98
Do not suggest adding semicolon/changing delimiters for macros in item position that originates in macros Fixes #91800.
2022-06-16Do not suggest adding semicolon/changing delimiters for macros in item ↵Chayim Refael Friedman-0/+98
position that originates in macros
2022-06-15Refactor path segment parameter errorEdwinRy-4/+6