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

[1.38] Regression: proc macro panicked #63894

Closed
petrochenkov opened this issue Aug 25, 2019 · 1 comment
Closed

[1.38] Regression: proc macro panicked #63894

petrochenkov opened this issue Aug 25, 2019 · 1 comment
Labels
regression-from-stable-to-beta Performance or correctness regression from stable to beta. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@petrochenkov
Copy link
Contributor

#63628 (comment)

proc macro panicked

[INFO] [stderr]    Compiling custom-slice-macros v0.1.1 (/opt/crater/workdir)
[INFO] [stderr] error: proc macro panicked
[INFO] [stderr]    --> tests/derives.rs:48:13
[INFO] [stderr]     |
[INFO] [stderr] 48  | /             custom_slice_macros::define_slice_types_pair! {
[INFO] [stderr] 49  | |                 #[custom_slice(owned)]
[INFO] [stderr] 50  | |                 $(#[$meta_owned])*
[INFO] [stderr] 51  | |                 struct Owned($owned_inner);
[INFO] [stderr] ...   |
[INFO] [stderr] 59  | |                 fn validate(_: &$slice_inner) -> Result<(), $ty_error> $body
[INFO] [stderr] 60  | |             }
[INFO] [stderr]     | |_____________^
[INFO] [stderr] ...
[INFO] [stderr] 227 | /     gen_test! {
[INFO] [stderr] 228 | |         name: try_from_inner,
[INFO] [stderr] 229 | |         #[custom_slice(derive(TryFromInner))]
[INFO] [stderr] 230 | |         #[custom_slice(error(r#type = "()"))]
[INFO] [stderr] ...   |
[INFO] [stderr] 236 | |         validator: () { Ok(()) },
[INFO] [stderr] 237 | |     }
[INFO] [stderr]     | |_____- in this macro invocation
[INFO] [stderr]     |
[INFO] [stderr]     = help: message: `#[custom_slice(error(type = "..."))]` should be specified

This is a regression from these series of pretty-printing improvements - #62393, #62574, #62667.

Tokens are printed more precisely now, so #[custom_slice(error(r#type = "()"))] is now printed as is, while previously it lost the "rawness" qualifier from type and was printed like this - #[custom_slice(error(type = "()"))].
(Pretty-printing matters because proc macros often have to work with pretty-printed version of their input due to #43081.)

Procedural macro define_slice_types_pair however doesn't recognize r#type as type and complains.

@petrochenkov petrochenkov added regression-from-stable-to-beta Performance or correctness regression from stable to beta. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Aug 25, 2019
@Mark-Simulacrum Mark-Simulacrum added this to the 1.38 milestone Aug 30, 2019
@nikomatsakis
Copy link
Contributor

check-in from compiler team:

Closing as expected breakage. Precise output from token pretty printing is not considered stable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
regression-from-stable-to-beta Performance or correctness regression from stable to beta. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

4 participants