Skip to content

compiletest: we should not allow revision names that collide with builtin cfg names #128964

Closed
@jieyouxu

Description

@jieyouxu

Example: https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/error.3A.20unexpected.20.60--cfg.20windows.60.20flag/near/459869068

--- stderr -------------------------------
error: unexpected `--cfg windows` flag
  |
  = note: config `windows` is only supposed to be controlled by `--target`
  = note: manually setting a built-in cfg can and does create incoherent behaviors
  = note: `#[deny(explicit_builtin_cfgs_in_flags)]` on by default

error: aborting due to 1 previous error

compiletest will try to set a --cfg <revision_name> that matches the revision name, but this goes poorly if the <revision_name> collides with a builtin cfg. Builtin cfgs can be found at

pub(crate) fn disallow_cfgs(sess: &Session, user_cfgs: &Cfg) {
, but we should also deny test revision name because it has special meaning cfg(test).

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-compiletestArea: The compiletest test runnerC-bugCategory: This is a bug.E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.E-mentorCall for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.T-bootstrapRelevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions