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

Stringification of pub(in crate) visibility removes in #99981

Closed
KamilaBorowska opened this issue Jul 31, 2022 · 7 comments · Fixed by #100350
Closed

Stringification of pub(in crate) visibility removes in #99981

KamilaBorowska opened this issue Jul 31, 2022 · 7 comments · Fixed by #100350
Labels
C-bug Category: This is a bug. 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.
Milestone

Comments

@KamilaBorowska
Copy link
Contributor

KamilaBorowska commented Jul 31, 2022

Code

I tried this code:

macro_rules! stringify_vis {
    ($v:vis) => { stringify!($v) }
}
fn main() {
    println!("{}", stringify_vis!(pub(in crate)));
}

I expected to see this happen: it to print pub(in crate).

Instead, this happened: it prints pub(crate).

Version it worked on

It most recently worked on: 1.62.1

Version with regression

rustc --version --verbose:

rustc 1.63.0-beta.7 (12c5b1ef3 2022-07-22)
binary: rustc
commit-hash: 12c5b1ef3882fa824a7dc6054f9f15732b44c863
commit-date: 2022-07-22
host: x86_64-unknown-linux-gnu
release: 1.63.0-beta.7
LLVM version: 14.0.5

Backtrace

Backtrace

<backtrace>

@rustbot modify labels: +regression-from-stable-to-beta -regression-untriaged

@KamilaBorowska KamilaBorowska added C-bug Category: This is a bug. regression-untriaged Untriaged performance or correctness regression. labels Jul 31, 2022
@rustbot rustbot added regression-from-stable-to-beta Performance or correctness regression from stable to beta. I-prioritize Issue: Indicates that prioritization has been requested for this issue. and removed regression-untriaged Untriaged performance or correctness regression. labels Jul 31, 2022
@crlf0710
Copy link
Member

crlf0710 commented Aug 1, 2022

Similar effect can already be observed on stable too

macro_rules! stringify_vis {
    ($v:vis) => { stringify!($v) }
}
fn main() {
    println!("{}", stringify_vis!(pub(in self)));
}

prints pub(self) already. But it is indeed a (small?) behavior change in this beta for the in crate case.

@petrochenkov
Copy link
Contributor

I would expect to see this issue in 2020, but not now when we are collecting tokens in (almost) all cases instead of converting them from AST.
Apparently for visibilities they are collected incorrectly for some reason.
cc @Aaron1011 (in case you have time for this)

@KamilaBorowska KamilaBorowska changed the title Stringication of pub(in crate) visibility removes in Stringification of pub(in crate) visibility removes in Aug 1, 2022
@apiraino
Copy link
Contributor

apiraino commented Aug 3, 2022

bisection points to 9e2f655

searched nightlies: from nightly-2022-01-01 to nightly-2022-08-03
regressed nightly: nightly-2022-05-24
searched commit range: b2eed72...ee160f2
regressed commit: 9e2f655

bisected with cargo-bisect-rustc v0.6.3

Host triple: x86_64-unknown-linux-gnu
Reproduce with:

cargo bisect-rustc --start=2022-01-01 --script=./script.sh 

The commit is a rollup so I think it's in #97254 cc @jhpratt ?

@jhpratt
Copy link
Member

jhpratt commented Aug 3, 2022

Without even looking at the rest of the rollup, it's definitely my PR. Short of storing whether in was used, I'm not sure what could be done.

@apiraino apiraino added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Aug 3, 2022
@Mark-Simulacrum Mark-Simulacrum added this to the 1.63.0 milestone Aug 9, 2022
@Mark-Simulacrum
Copy link
Member

This will slip into 1.63.

@jhpratt
Copy link
Member

jhpratt commented Aug 9, 2022

I'll work on this this evening to get it resolved quickly, even if it is too late to patch the beta. I don't think it'll be too difficult.

@jhpratt
Copy link
Member

jhpratt commented Aug 10, 2022

PR is up: #100350. This also fixes stringify!(pub(in super)) to be pub(in super), which is certainly better than the status quo of pub(super).

@bors bors closed this as completed in 6ae0414 Aug 12, 2022
@apiraino apiraino removed the I-prioritize Issue: Indicates that prioritization has been requested for this issue. label Nov 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. 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

Successfully merging a pull request may close this issue.

7 participants