Commit Graph

31 Commits

Author SHA1 Message Date
Matthias Krüger
0f271619e4
Rollup merge of #110255 - clubby789:proc-macro-test-help, r=jackh726
Suggest using integration tests for test crate using own proc-macro

cc #110247
2023-04-24 07:53:23 +02:00
clubby789
f7581d8d21 Suggest using integration tests for proc-macros 2023-04-17 13:01:03 +01:00
Eric Huss
a4e851cf62 Add some reasons why tests are ignored. 2023-04-15 16:11:42 -07:00
Esteban Küber
9fadcc143a Special-case item attributes in the suggestion output 2023-04-12 22:50:10 +00:00
Esteban Küber
5b40aa5eb4 Tweak output for 'add line' suggestion 2023-04-12 22:50:10 +00:00
Matthias Krüger
331e7c3659
Rollup merge of #110153 - DaniPopes:compiler-typos, r=Nilstrieb
Fix typos in compiler

I ran [`typos -w compiler`](https://github.com/crate-ci/typos) to fix typos in the `compiler` directory.

Refs #110150
2023-04-12 20:56:21 +02:00
bors
194a0bb5d6 Auto merge of #109638 - NotStirred:suggest/non-derive, r=davidtwco
Add suggestion to remove `derive()` if invoked macro is non-derive

Adds to the existing `expected derive macro, found {}` error message:
```
help: remove the surrounding "derive()":
  --> $DIR/macro-path-prelude-fail-4.rs:1:3
   |
LL | #[derive(inline)]
   |   ^^^^^^^      ^
```

This suggestion will either fix the issue, in the case that the macro was valid, or provide a better error message if not

Not ready for merge yet, as the highlighted span is only valid for trivial formatting. Is there a nice way to get the parent span of the macro path within `smart_resolve_macro_path`?

Closes #109589
2023-04-10 21:50:46 +00:00
DaniPopes
677357d32b
Fix typos in compiler 2023-04-10 22:02:52 +02:00
Tom Martin
18388c9f73
Rewrite added diagnostics as translatable
Start messages with lowercase
2023-04-07 08:33:56 +01:00
Pietro Albini
64af509377
remove invalid ignore-pretty 2023-04-03 09:24:11 +02:00
Tom Martin
86230dcde6
Bless 2023-04-01 03:52:58 +01:00
Tom Martin
10c36445ff
Update non-derive macro error message to match suggestion
It's now split between two errors, one to remove the invalid derive macro
and one suggesting adding a new non-derive macro
2023-03-30 21:43:32 +01:00
Tom Martin
42f2be8a8c
Add suggestion to remove derive() if invoked macro is non-derive 2023-03-26 16:01:25 +01:00
Michael Goulet
00dc3b24b7 Tighter spans 2023-03-14 19:12:42 +00:00
Michael Goulet
9eae77381e Simplify proc macro signature validity check 2023-03-14 19:05:21 +00:00
Joseph Ryan
fb38578082 Add proc-macro boilerplate to crt-static test 2023-02-01 13:35:36 -08:00
Esteban Küber
62ba3e70a1 Modify primary span label for E0308
The previous output was unintuitive to users.
2023-01-30 20:12:19 +00:00
Matthias Krüger
8ae5116fae
Rollup merge of #106407 - mejrs:attr_check, r=compiler-errors
Improve proc macro attribute diagnostics

Closes https://github.com/rust-lang/rust/issues/102923
2023-01-26 06:15:23 +01:00
bors
85da15c016 Auto merge of #107133 - pnkfelix:revert-pr-84022-for-issue-106337, r=Mark-Simulacrum
Revert "Make PROC_MACRO_DERIVE_RESOLUTION_FALLBACK a hard error"

This reverts commit 7d82cadd97 aka PR #84022

I am doing this to buy us some time with respect to issue #106337 w.r.t. the 1.67 release.
2023-01-22 03:58:52 +00:00
bors
52372f9c71 Auto merge of #105924 - TimNN:ui-remap, r=Mark-Simulacrum
Remap paths in UI tests by default

If you think this needs further discussions / something RFC-like, please let me know the best forum for that.

This PR runs UI tests with a remapped "src base" directory by default.

Why? Because some UI tests currently depend on the length of the absolute path to the `src/test/ui` directory. Remapping makes the tests independent of the absolute path.

The path to the source file (which is absolute on CI) is part of the type name of closures. `rustc` diagnostic output depends on the length of type names (long type names are truncated). So a long absolute path leads to long closure type names, which leads to truncation and changed diagnostics.

(I initially tried just disabling type name truncation, but that made some error messages stupid long (thousands of characters, IIRC)).

Additional changes:

* All boolean `compiletest` directives now support explicit `no-` versions to disable them.
* Adapt existing tests when necessary:
  * Disable remapping for individual tests that fail with it enabled (when there's no obvious alternative fix).
  * For tests that already check something remapping related switch to the new option unless we gain something significant by keeping the manual remap.

Passed Windows CI in https://github.com/rust-lang/rust/actions/runs/3933100590
2023-01-21 17:44:20 +00:00
Felix S. Klock II
5fa1347331 Revert "Make PROC_MACRO_DERIVE_RESOLUTION_FALLBACK a hard error"
This reverts commit 7d82cadd97.

I am doing this to buy us some time with respect to issue #106337 w.r.t. the
1.67 release.
2023-01-20 17:13:55 -05:00
mejrs
8e43414bce Fix proc macro tests 2023-01-19 16:31:50 +01:00
Michael Goulet
21725774a2 note -> help 2023-01-17 03:09:49 +00:00
Tim Neumann
cd1d0bc20c ui tests: Remap test base directory by default. 2023-01-16 18:33:25 +00:00
Yuki Okushi
7d02116832
Rollup merge of #106816 - TimNN:rental-remap, r=oli-obj
Update `rental` hack to work with remapped paths.

This PR simply switches to an already-existing helper instead of hard-coding a specific enum variant. The new revision of the test fails without the other changes in this PR.

Context: I'm exploring running UI tests with remapped paths by default in #105924 and the rental test was one of the ones that failed.

This may also be useful in the context of https://github.com/rust-lang/rfcs/pull/3127 ("New rustc and Cargo options to allow path sanitisation by default").
2023-01-14 12:04:37 +09:00
Tim Neumann
496edf97c5 Update rental hack to work with remapped paths. 2023-01-13 20:36:03 +00:00
Lukas Wirth
549ece7033 Warn when using panic-strategy abort for proc-macro crates 2023-01-13 10:13:49 +01:00
mejrs
a8e3abd04c Address feedback 2023-01-12 00:11:32 +01:00
mejrs
f92000816e Improve proc macro attribute diagnostics 2023-01-12 00:11:11 +01:00
Michael Goulet
9a39d7e441 Note predicate span on ImplDerivedObligation 2023-01-11 19:46:45 +00:00
Albert Larsan
cf2dff2b1e
Move /src/test to /tests 2023-01-11 09:32:08 +00:00