compiletest: prevent directives from having multiple revisions#156237
compiletest: prevent directives from having multiple revisions#156237lqd wants to merge 2 commits intorust-lang:mainfrom
Conversation
also update the test to make sure there's an error
|
Some changes occurred in src/tools/compiletest cc @jieyouxu |
|
r? @wesleywiser rustbot has assigned @wesleywiser. Use Why was this reviewer chosen?The reviewer was selected based on:
|
|
cc issue #123765 |
|
ah I knew there was an issue about this but couldn't find it with a quick search, thank you @fmease! |
There was a problem hiding this comment.
This seems very reasonable to me but let's see what @jieyouxu thinks.
|
(Eventually I'd like to move these validations to not panic everywhere and produce proper errors but rejecting loudly still much better than silently borked) |
|
@bors r=wesleywiser,jieyouxu rollup |
…ywiser,jieyouxu compiletest: prevent directives from having multiple revisions Right now, a compiletest directive like `//@ [foo,bar] compile-flags: -Z hello` is accepted. While it looks similar to a `//[foo,bar]` error annotation matching multiple revisions, it will instead model a directive for a single revision named `foo,bar` and not for two revisions. Slightly inconsistent/confusing. I don't know that it's common enough to make bigger changes to support it fully (`miri`'s test harness seems to support that use-case), but since I hit that today, this PR prevents that case for now. Otherwise, I think we'd have to turn all uses of `line_directive` as possibly creating multiple line directives, one per revision, etc. Such a directive will now yield an error, with a best-effort suggestion to split it into multiple single-revision directives: ``` multiple revisions aren't supported yet in `//@ [foo,bar] compile-flags: -Z hello`, split them like //@ [foo]: compile-flags: -Z hello //@ [bar]: compile-flags: -Z hello ```
…ywiser,jieyouxu compiletest: prevent directives from having multiple revisions Right now, a compiletest directive like `//@ [foo,bar] compile-flags: -Z hello` is accepted. While it looks similar to a `//[foo,bar]` error annotation matching multiple revisions, it will instead model a directive for a single revision named `foo,bar` and not for two revisions. Slightly inconsistent/confusing. I don't know that it's common enough to make bigger changes to support it fully (`miri`'s test harness seems to support that use-case), but since I hit that today, this PR prevents that case for now. Otherwise, I think we'd have to turn all uses of `line_directive` as possibly creating multiple line directives, one per revision, etc. Such a directive will now yield an error, with a best-effort suggestion to split it into multiple single-revision directives: ``` multiple revisions aren't supported yet in `//@ [foo,bar] compile-flags: -Z hello`, split them like //@ [foo]: compile-flags: -Z hello //@ [bar]: compile-flags: -Z hello ```
…ywiser,jieyouxu compiletest: prevent directives from having multiple revisions Right now, a compiletest directive like `//@ [foo,bar] compile-flags: -Z hello` is accepted. While it looks similar to a `//[foo,bar]` error annotation matching multiple revisions, it will instead model a directive for a single revision named `foo,bar` and not for two revisions. Slightly inconsistent/confusing. I don't know that it's common enough to make bigger changes to support it fully (`miri`'s test harness seems to support that use-case), but since I hit that today, this PR prevents that case for now. Otherwise, I think we'd have to turn all uses of `line_directive` as possibly creating multiple line directives, one per revision, etc. Such a directive will now yield an error, with a best-effort suggestion to split it into multiple single-revision directives: ``` multiple revisions aren't supported yet in `//@ [foo,bar] compile-flags: -Z hello`, split them like //@ [foo]: compile-flags: -Z hello //@ [bar]: compile-flags: -Z hello ```
Rollup of 14 pull requests Successful merges: - #146273 (lint ImproperCTypes: refactor linting architecture (part 2)) - #149509 (Lint unused pub items in binary crates) - #156173 (Fewer global node_id_to_def_id lookups) - #156177 (windows/time: avoid being too close to 0) - #155961 (Deny warnings in the test for crates that are available on stable) - #155981 (Use special DefIds for aliases) - #156109 (Migrate libraries from ptr::slice_from_raw_parts to .cast_slice) - #156130 (Fold/visit tweaks) - #156131 (Metadata macro/query cleanups) - #156202 (llvm: Use correct type for splat mask) - #156227 (Add Trusty OS to the generic error implementation.) - #156237 (compiletest: prevent directives from having multiple revisions) - #156241 (Move tests coercion) - #156258 (Document wasi-sdk minimum versions for WASI targets)
…ywiser,jieyouxu compiletest: prevent directives from having multiple revisions Right now, a compiletest directive like `//@ [foo,bar] compile-flags: -Z hello` is accepted. While it looks similar to a `//[foo,bar]` error annotation matching multiple revisions, it will instead model a directive for a single revision named `foo,bar` and not for two revisions. Slightly inconsistent/confusing. I don't know that it's common enough to make bigger changes to support it fully (`miri`'s test harness seems to support that use-case), but since I hit that today, this PR prevents that case for now. Otherwise, I think we'd have to turn all uses of `line_directive` as possibly creating multiple line directives, one per revision, etc. Such a directive will now yield an error, with a best-effort suggestion to split it into multiple single-revision directives: ``` multiple revisions aren't supported yet in `//@ [foo,bar] compile-flags: -Z hello`, split them like //@ [foo]: compile-flags: -Z hello //@ [bar]: compile-flags: -Z hello ```
Right now, a compiletest directive like
//@ [foo,bar] compile-flags: -Z hellois accepted. While it looks similar to a//[foo,bar]error annotation matching multiple revisions, it will instead model a directive for a single revision namedfoo,barand not for two revisions. Slightly inconsistent/confusing.I don't know that it's common enough to make bigger changes to support it fully (
miri's test harness seems to support that use-case), but since I hit that today, this PR prevents that case for now. Otherwise, I think we'd have to turn all uses ofline_directiveas possibly creating multiple line directives, one per revision, etc.Such a directive will now yield an error, with a best-effort suggestion to split it into multiple single-revision directives: