Skip to content

compiletest directives docs for "ignore-" are incorrect or confusing #139516

@RalfJung

Description

@RalfJung
Member

https://rustc-dev-guide.rust-lang.org/tests/directives.html states that I can write ignore-x wherex is "A full target triple: aarch64-apple-ios". However, that's not correct -- some target triples work, but not all of them. I realized this when my PR failed because ignore-i686-pc-windows-gnullvm dies not work, and neither does //@ ignore-i686-unknown-uefi.

CC @jieyouxu

Activity

added
needs-triageThis issue may need triage. Remove it if it has been sufficiently triaged.
on Apr 8, 2025
jieyouxu

jieyouxu commented on Apr 8, 2025

@jieyouxu
Member

It's technically correct in that I believe those would work if they're included in the directives allow list (lol).

RalfJung

RalfJung commented on Apr 8, 2025

@RalfJung
MemberAuthor

If every new target has to be added to some allow list, that will never be up-to-date. compiletest should accept all targets supported by rustc then.

jieyouxu

jieyouxu commented on Apr 8, 2025

@jieyouxu
Member

The intention in the long term is to not have to rely on any allow list, it obviously doesn't scale

RalfJung

RalfJung commented on Apr 8, 2025

@RalfJung
MemberAuthor

Also, I assume then this is similar for architectures etc? Would be good to document that so that one knows what to do when an architecture is not recognized.

RalfJung

RalfJung commented on Apr 8, 2025

@RalfJung
MemberAuthor

The intention in the long term is to not have to rely on any allow list, it obviously doesn't scale

compiletest already queries rustc for various things, right? Can't it query the target list?

jieyouxu

jieyouxu commented on Apr 8, 2025

@jieyouxu
Member

There's two parts to this:

  1. compiletest already does the target list query. Those targets are already valid ignore-$targets cf
    condition! {
    name: &config.target,
    allowed_names: &target_cfgs.all_targets,
    message: "when the target is {name}"
    }
    .
  2. But they just get denied by the allow-list (which is a short-term bandaid to detect unknown directives) that I want to get rid of soon
jieyouxu

jieyouxu commented on Apr 8, 2025

@jieyouxu
Member

Also, I assume then this is similar for architectures etc? Would be good to document that so that one knows what to do when an architecture is not recognized.

Yes, it's the same for archs. The valid archs are already computed based on all the builtion-targets combined + some extra archs

condition! {
name: &target_cfg.arch,
allowed_names: ContainsEither { a: &target_cfgs.all_archs, b: &EXTRA_ARCHS },
message: "when the architecture is {name}"
}

added
A-docsArea: Documentation for any part of the project, including the compiler, standard library, and tools
A-compiletestArea: The compiletest test runner
and removed
needs-triageThis issue may need triage. Remove it if it has been sufficiently triaged.
on Apr 8, 2025
jieyouxu

jieyouxu commented on Apr 8, 2025

@jieyouxu
Member

I'll send a PR to document the current impl limitation in rustc-dev-guide.

If you still need those //@ ignore-$target_tuple for your PR, then you should only need to add them to

const KNOWN_DIRECTIVE_NAMES: &[&str] = &[
.

jieyouxu

jieyouxu commented on Apr 8, 2025

@jieyouxu
Member
RalfJung

RalfJung commented on Apr 8, 2025

@RalfJung
MemberAuthor
jieyouxu

jieyouxu commented on Apr 8, 2025

@jieyouxu
Member

Why can't they be added to the allowlist automatically? We should be rejecting unknown directives, that is not a bandaid. But targets on the builtin target list are not "unknown".

Because I haven't gotten around to fixing that bit yet :)

Really, if none of the directive parsers matched a directive-like line then it should just fail (but it doesn't do that yet).

RalfJung

RalfJung commented on Apr 8, 2025

@RalfJung
MemberAuthor
jieyouxu

jieyouxu commented on Apr 8, 2025

@jieyouxu
Member

Exactly. The separate allowlist is an artifact leftover from when I was migrating compiletest directives from // to //@ (because the plain comment form had too much false-positive potential that made it too noisy to do proper unknown directive detection) to make sure I don't silently drop/miss directives, which has persisted longer than I wanted to, because I keep getting distracted by various things :D

added
C-discussionCategory: Discussion or questions that doesn't represent real issues.
on Jun 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-compiletestArea: The compiletest test runnerA-docsArea: Documentation for any part of the project, including the compiler, standard library, and toolsC-discussionCategory: Discussion or questions that doesn't represent real issues.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Participants

    @RalfJung@jieyouxu@rustbot

    Issue actions

      compiletest directives docs for "ignore-" are incorrect or confusing · Issue #139516 · rust-lang/rust