Skip to content

Rollup of 8 pull requests #117309

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

Merged
merged 26 commits into from
Oct 28, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
e960d0e
Remove -Zdep-tasks.
cjgillot Oct 8, 2023
8531ebf
Remove useless debugging.
cjgillot Oct 8, 2023
3733316
Create `windows/api.rs` for safer FFI
ChrisDenton Oct 16, 2023
991bf75
make E0277 use short paths
Milo123459 Oct 14, 2023
828f069
Remove most indentation in check-cfg impl
Urgau Oct 20, 2023
1ef96a9
Fix residual (never merged) check-cfg syntax in doc
Urgau Oct 20, 2023
b7debe3
Parse rustc version at compile time
dtolnay Oct 27, 2023
84a1a68
Better guard against wrong input with check-cfg any()
Urgau Oct 21, 2023
2ef5897
fix failure to detect a too-big-type after adding padding
RalfJung Oct 27, 2023
6dbad23
When encountering sealed traits, point types that implement it
estebank Oct 19, 2023
a65d99d
Update type_err_ctxt_ext.rs
Milo123459 Oct 27, 2023
98c469c
Remove an unneeded dependency.
nnethercote Oct 26, 2023
3feec48
Fix a comment.
nnethercote Oct 26, 2023
2142d01
Streamline `rustc_interface` tests.
nnethercote Oct 27, 2023
32986d8
Change `CrateConfig` from `FxIndexSet` to `FxHashSet`.
nnethercote Oct 27, 2023
75e415b
Optimize `parse_cfgspecs`.
nnethercote Oct 27, 2023
5e54997
Clean up config mess.
nnethercote Oct 27, 2023
5438004
Change `Cfg<T>` to an `FxIndexSet`.
nnethercote Oct 27, 2023
975d042
Rollup merge of #116534 - cjgillot:no-dep-tasks, r=davidtwco
workingjubilee Oct 28, 2023
471e33f
Rollup merge of #116739 - Milo123459:milo/short-paths, r=estebank
workingjubilee Oct 28, 2023
d87b5e4
Rollup merge of #116816 - ChrisDenton:api.rs, r=workingjubilee
workingjubilee Oct 28, 2023
9f631d0
Rollup merge of #116945 - estebank:sealed-trait-impls, r=petrochenkov
workingjubilee Oct 28, 2023
87a564d
Rollup merge of #117025 - Urgau:cleanup-improve-check-cfg-impl, r=pet…
workingjubilee Oct 28, 2023
1db8c9d
Rollup merge of #117256 - dtolnay:currentversion, r=compiler-errors
workingjubilee Oct 28, 2023
48a3865
Rollup merge of #117268 - nnethercote:rustc_interface, r=oli-obk
workingjubilee Oct 28, 2023
09fd68d
Rollup merge of #117277 - RalfJung:too-big-with-padding, r=oli-obk
workingjubilee Oct 28, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Better guard against wrong input with check-cfg any()
  • Loading branch information
Urgau committed Oct 27, 2023
commit 84a1a689ccc8eb6b8be48f3385bc9b0aeb5c71a6
10 changes: 7 additions & 3 deletions compiler/rustc_interface/src/interface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -311,11 +311,15 @@ pub fn parse_check_cfg(handler: &EarlyErrorHandler, specs: Vec<String>) -> Check
}

if any_specified {
if !names.is_empty() || !values.is_empty() || values_any_specified {
if names.is_empty()
&& values.is_empty()
&& !values_specified
&& !values_any_specified
{
check_cfg.exhaustive_names = false;
} else {
error!("`cfg(any())` can only be provided in isolation");
}

check_cfg.exhaustive_names = false;
} else {
for name in names {
check_cfg
Expand Down
2 changes: 2 additions & 0 deletions tests/ui/check-cfg/invalid-arguments.any_values.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
error: invalid `--check-cfg` argument: `cfg(any(),values())` (`values()` cannot be specified before the names)

4 changes: 3 additions & 1 deletion tests/ui/check-cfg/invalid-arguments.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// revisions: multiple_values_any not_empty_any not_empty_values_any
// revisions: values_any_missing_values values_any_before_ident ident_in_values_1
// revisions: ident_in_values_2 unknown_meta_item_1 unknown_meta_item_2 unknown_meta_item_3
// revisions: mixed_values_any mixed_any giberich
// revisions: mixed_values_any mixed_any any_values giberich unterminated
//
// compile-flags: -Z unstable-options
// [anything_else]compile-flags: --check-cfg=anything_else(...)
Expand All @@ -29,6 +29,8 @@
// [unknown_meta_item_3]compile-flags: --check-cfg=cfg(foo,values(test()))
// [mixed_values_any]compile-flags: --check-cfg=cfg(foo,values("bar",any()))
// [mixed_any]compile-flags: --check-cfg=cfg(any(),values(any()))
// [any_values]compile-flags: --check-cfg=cfg(any(),values())
// [giberich]compile-flags: --check-cfg=cfg(...)
// [unterminated]compile-flags: --check-cfg=cfg(

fn main() {}
2 changes: 2 additions & 0 deletions tests/ui/check-cfg/invalid-arguments.unterminated.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
error: invalid `--check-cfg` argument: `cfg(` (expected `cfg(name, values("value1", "value2", ... "valueN"))`)