Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
351d532
interpret: call caller_location logic the same way codegen does, and …
RalfJung Oct 28, 2023
04fa124
share the track_caller handling within a mir::Body
RalfJung Oct 28, 2023
552abdc
Rename a few remaining references to abort terminator
tmiasko Oct 29, 2023
82b447a
Add support for mipsel-unknown-netbsd, 32-bit LE mips.
he32 Oct 29, 2023
5e6c313
mipsel_unknown_netbsd.rs: fix indentation.
he32 Oct 29, 2023
28e60de
Remove `memoffset` dependency from `rustc_query_impl`.
nnethercote Oct 23, 2023
8ff624a
Clean up `rustc_*/Cargo.toml`.
nnethercote Oct 20, 2023
8c04999
On object safety error, mention new enum as alternative
estebank Oct 24, 2023
678e01a
Delay parsing of `--cfg` and `--check-cfg` options.
nnethercote Oct 30, 2023
bfcff79
Reduce exposure of cfg parsers.
nnethercote Oct 30, 2023
8e4ac98
Change cfg parsers to produce symbols instead of strings.
nnethercote Oct 30, 2023
5c6a12c
Make `Cfg` and `CheckCfg` non-generic.
nnethercote Oct 30, 2023
371f972
Improve readability of `parse_check_cfg`.
nnethercote Oct 30, 2023
85e56e8
Remove out-of-date comment.
nnethercote Oct 30, 2023
a60d643
Wrap some overlong comments.
nnethercote Oct 30, 2023
95b0088
Remove `check_output`.
nnethercote Oct 30, 2023
4b14048
improve and fix x install
onur-ozkan Oct 30, 2023
be8fd8b
Streamline `collect_crate_types`.
nnethercote Oct 30, 2023
90862f6
Remove an unnecessary `drop`.
nnethercote Oct 30, 2023
0c381ec
Streamline some `use` items.
nnethercote Oct 30, 2023
a2486db
Fix missing leading space in suggestion
gurry Oct 30, 2023
82f34fd
Fix #117284, Fix unused variables lint issue for args in macro
chenyukang Oct 30, 2023
8508e65
Fix bad-c-variadic error being emitted multiple times
nicholasbishop Oct 29, 2023
f91b5ce
Explicitly reject const C-variadic functions
nicholasbishop Oct 29, 2023
58a80c8
rustdoc: elide cross-crate default generic arguments
fmease Jun 9, 2023
b9dce53
Rollup merge of #112463 - fmease:rustdoc-elide-x-crate-def-gen-args, …
GuillaumeGomez Oct 30, 2023
824e367
Rollup merge of #117068 - nnethercote:clean-up-Cargo-toml, r=wesleywiser
GuillaumeGomez Oct 30, 2023
95de91b
Rollup merge of #117132 - estebank:issue-80194, r=petrochenkov
GuillaumeGomez Oct 30, 2023
73100d8
Rollup merge of #117317 - RalfJung:track-caller, r=oli-obk
GuillaumeGomez Oct 30, 2023
99b032f
Rollup merge of #117356 - he32:netbsd-mipsel, r=oli-obk
GuillaumeGomez Oct 30, 2023
5ac999f
Rollup merge of #117357 - tmiasko:terminate, r=wesleywiser
GuillaumeGomez Oct 30, 2023
784f04b
Rollup merge of #117370 - nicholasbishop:bishop-better-c-variadic-err…
GuillaumeGomez Oct 30, 2023
d96bdbe
Rollup merge of #117376 - nnethercote:rustc_interface-more, r=oli-obk
GuillaumeGomez Oct 30, 2023
c994bdb
Rollup merge of #117383 - onur-ozkan:fix-x-install, r=albertlarsan68
GuillaumeGomez Oct 30, 2023
02d32d2
Rollup merge of #117390 - chenyukang:yukang-fix-117284-unused-macro, …
GuillaumeGomez Oct 30, 2023
9e4ab9f
Rollup merge of #117395 - gurry:117380-wrong-parent-sugg, r=Nilstrieb
GuillaumeGomez Oct 30, 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
Improve readability of parse_check_cfg.
  • Loading branch information
nnethercote committed Oct 30, 2023
commit 371f97257147c88d102dd501992b48ca568cb79b
39 changes: 13 additions & 26 deletions compiler/rustc_interface/src/interface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,34 +164,31 @@ pub(crate) fn parse_check_cfg(handler: &EarlyErrorHandler, specs: Vec<String>) -
expected_error();
};

if meta_item.has_name(sym::names) {
let mut set_old_syntax = || {
// defaults are flipped for the old syntax
if old_syntax == None {
check_cfg.exhaustive_names = false;
check_cfg.exhaustive_values = false;
}
old_syntax = Some(true);
};

if meta_item.has_name(sym::names) {
set_old_syntax();

check_cfg.exhaustive_names = true;
for arg in args {
if arg.is_word() && arg.ident().is_some() {
let ident = arg.ident().expect("multi-segment cfg key");
if arg.is_word() && let Some(ident) = arg.ident() {
check_cfg.expecteds.entry(ident.name).or_insert(ExpectedValues::Any);
} else {
error!("`names()` arguments must be simple identifiers");
}
}
} else if meta_item.has_name(sym::values) {
// defaults are flipped for the old syntax
if old_syntax == None {
check_cfg.exhaustive_names = false;
check_cfg.exhaustive_values = false;
}
old_syntax = Some(true);
set_old_syntax();

if let Some((name, values)) = args.split_first() {
if name.is_word() && name.ident().is_some() {
let ident = name.ident().expect("multi-segment cfg key");
if name.is_word() && let Some(ident) = name.ident() {
let expected_values = check_cfg
.expecteds
.entry(ident.name)
Expand Down Expand Up @@ -244,19 +241,15 @@ pub(crate) fn parse_check_cfg(handler: &EarlyErrorHandler, specs: Vec<String>) -
error!("`cfg()` names cannot be after values");
}
names.push(ident);
} else if arg.has_name(sym::any)
&& let Some(args) = arg.meta_item_list()
{
} else if arg.has_name(sym::any) && let Some(args) = arg.meta_item_list() {
if any_specified {
error!("`any()` cannot be specified multiple times");
}
any_specified = true;
if !args.is_empty() {
error!("`any()` must be empty");
}
} else if arg.has_name(sym::values)
&& let Some(args) = arg.meta_item_list()
{
} else if arg.has_name(sym::values) && let Some(args) = arg.meta_item_list() {
if names.is_empty() {
error!("`values()` cannot be specified before the names");
} else if values_specified {
Expand All @@ -267,22 +260,16 @@ pub(crate) fn parse_check_cfg(handler: &EarlyErrorHandler, specs: Vec<String>) -
for arg in args {
if let Some(LitKind::Str(s, _)) = arg.lit().map(|lit| &lit.kind) {
values.insert(Some(*s));
} else if arg.has_name(sym::any)
&& let Some(args) = arg.meta_item_list()
{
} else if arg.has_name(sym::any) && let Some(args) = arg.meta_item_list() {
if values_any_specified {
error!(
"`any()` in `values()` cannot be specified multiple times"
);
error!("`any()` in `values()` cannot be specified multiple times");
}
values_any_specified = true;
if !args.is_empty() {
error!("`any()` must be empty");
}
} else {
error!(
"`values()` arguments must be string literals or `any()`"
);
error!("`values()` arguments must be string literals or `any()`");
}
}
} else {
Expand Down