Stream: t-compiler/help

Topic: reserved keyword is not a symbol?

Ferdia McKeogh (Jul 10 2020 at 12:48, on Zulip):

I'm working on this issue:, also discussed here:

I started with the expected_ident_found function in src/librustc_parse/parser/ as that is where the hint for escaping keywords is generated, then arriving at src/librustc_span/ where it appears keywords and symbols are defined. I removed meta from the Symbols {} identifiers and added it as a keyword:

        // Edition-specific keywords that are used in stable Rust.
        Async:              "async", // >= 2018 Edition only
        Await:              "await", // >= 2018 Edition only
        Dyn:                "dyn", // >= 2018 Edition only

        // Edition-specific keywords that are used in unstable Rust or reserved for future use.
        Try:                "try", // >= 2018 Edition only
        Meta:               "meta", // >= 2018 Edition only

However, this then generates errors in src/librustc_expand/mbe/ because the meta symbol can no longer be found in rustc_span::sym::*, as explained by the comment. However I am now confused as this "meta" seems to be referring to meta items for Attributes (, which is not the "meta" I wanted to change the behaviour of. Does anyone know where I'm going wrong or maybe some pointers as to what fixing this issue would involve?

oli (Jul 10 2020 at 12:56, on Zulip):

keywords are in the rustc_span::kw::* namespace, not in sym::, I recently tripped over this, too

Ferdia McKeogh (Jul 10 2020 at 13:05, on Zulip):

Thank you!

eddyb (Jul 11 2020 at 01:54, on Zulip):

wait, we didn't actually discuss that issue

eddyb (Jul 11 2020 at 01:54, on Zulip):

I doubt any solution will involve keywords, that's a pretty big hammer

eddyb (Jul 11 2020 at 01:58, on Zulip):

@Ferdia McKeogh left a comment

eddyb (Jul 11 2020 at 01:59, on Zulip):

the thread is from March 2019?

eddyb (Jul 11 2020 at 02:02, on Zulip):

@yodal ^^ how did you stumble over that?

yodal (Jul 11 2020 at 04:26, on Zulip):

Someone posted a link on r/reddit, and no one had made an issue

eddyb (Jul 11 2020 at 04:29, on Zulip):


eddyb (Jul 11 2020 at 04:29, on Zulip):

(that would be useful to know :P)

eddyb (Jul 11 2020 at 04:31, on Zulip):

@yodal this?

eddyb (Jul 11 2020 at 04:31, on Zulip):

looks like there's not much to add

eddyb (Jul 11 2020 at 04:32, on Zulip):

everyone seems aware mod meta isn't the problem, just the import

eddyb (Jul 11 2020 at 04:33, on Zulip):

@yodal ah I see what you edited, thanks!

eddyb (Jul 11 2020 at 04:34, on Zulip):

@yodal btw, "root of the crate" is misleading, it's actually mod meta {...} use meta::*; anywhere in the code, since that path feature is relative to the current module, not the root of the crate like in Rust 2015

yodal (Jul 11 2020 at 04:59, on Zulip):

Very true, I'll update that in a bit

Last update: Sep 27 2020 at 14:45UTC