rust/src/test/ui/conditional-compilation
Matthias Krüger 0f81c7faf5
Rollup merge of #89468 - FabianWolff:issue-89358, r=jackh726
Report fatal lexer errors in `--cfg` command line arguments

Fixes #89358. The erroneous behavior was apparently introduced by `@Mark-Simulacrum` in a678e31911; the idea is to silence individual parser errors and instead emit one catch-all error message after parsing. However, for the example in #89358, a fatal lexer error is created here:
edebf77e00/compiler/rustc_parse/src/lexer/mod.rs (L340-L349)

This fatal error aborts the compilation, and so the call to `new_parser_from_source_str()` never returns and the catch-all error message is never emitted. I have therefore changed the `SilentEmitter` to silence only non-fatal errors; with my changes, for the rustc invocation described in #89358:
```sh
rustc --cfg "abc\""
```
I get the following output:
```
error[E0765]: unterminated double quote string
  |
  = note: this error occurred on the command line: `--cfg=abc"`
```
2021-10-23 05:28:22 +02:00
..
auxiliary Remove licenses 2018-12-25 21:08:33 -07:00
cfg-arg-invalid-1.rs
cfg-arg-invalid-1.stderr fix tests 2019-04-14 10:01:32 +02:00
cfg-arg-invalid-2.rs
cfg-arg-invalid-2.stderr fix tests 2019-04-14 10:01:32 +02:00
cfg-arg-invalid-3.rs
cfg-arg-invalid-3.stderr fix tests 2019-04-14 10:01:32 +02:00
cfg-arg-invalid-4.rs
cfg-arg-invalid-4.stderr fix tests 2019-04-14 10:01:32 +02:00
cfg-arg-invalid-5.rs
cfg-arg-invalid-5.stderr fix tests 2019-04-14 10:01:32 +02:00
cfg-arg-invalid-6.rs Hide diagnostics emitted during --cfg parsing 2019-09-15 17:39:38 -04:00
cfg-arg-invalid-6.stderr Hide diagnostics emitted during --cfg parsing 2019-09-15 17:39:38 -04:00
cfg-arg-invalid-7.rs Report fatal lexer errors in --cfg command line arguments 2021-10-02 19:15:55 +02:00
cfg-arg-invalid-7.stderr Report fatal lexer errors in --cfg command line arguments 2021-10-02 19:15:55 +02:00
cfg-attr-cfg-2.rs Remove licenses 2018-12-25 21:08:33 -07:00
cfg-attr-cfg-2.stderr Provide a span if main function is not present in crate 2019-09-14 11:27:45 -04:00
cfg-attr-crate-2.rs --bless some tests due to message format change. 2019-08-23 01:42:05 +02:00
cfg-attr-crate-2.stderr --bless --compare-mode=nll 2020-02-09 20:43:49 +01:00
cfg-attr-empty-is-unused.rs Remove Session.used_attrs and move logic to CheckAttrVisitor 2021-08-21 13:27:27 -05:00
cfg-attr-empty-is-unused.stderr Remove Session.used_attrs and move logic to CheckAttrVisitor 2021-08-21 13:27:27 -05:00
cfg-attr-invalid-predicate.rs Do not abort compilation if expansion produces errors 2018-12-27 15:51:36 +03:00
cfg-attr-invalid-predicate.stderr Update tests 2019-03-11 23:10:26 +03:00
cfg-attr-multi-false.rs Migrate compile-pass annotations to build-pass 2019-07-03 06:30:28 +09:00
cfg-attr-multi-invalid-1.rs --bless some tests due to message format change. 2019-08-23 01:42:05 +02:00
cfg-attr-multi-invalid-1.stderr --bless --compare-mode=nll 2020-02-09 20:43:49 +01:00
cfg-attr-multi-invalid-2.rs --bless some tests due to message format change. 2019-08-23 01:42:05 +02:00
cfg-attr-multi-invalid-2.stderr --bless --compare-mode=nll 2020-02-09 20:43:49 +01:00
cfg-attr-multi-true.rs report kind of deprecated item in message 2020-07-26 13:58:31 -04:00
cfg-attr-multi-true.stderr More precise spans for HIR paths 2021-03-15 22:13:45 +03:00
cfg-attr-parse.rs cfg_attr: avoid .outer_tokens 2019-12-06 20:37:59 +01:00
cfg-attr-parse.stderr Modify structured suggestion output 2021-08-11 09:46:24 +00:00
cfg-attr-syntax-validation.rs Expand NtExpr tokens only in key-value attributes 2020-11-03 00:53:43 +03:00
cfg-attr-syntax-validation.stderr Bless tests 2021-10-15 02:36:58 -05:00
cfg-attr-unknown-attribute-macro-expansion.rs resolve: Tweak "cannot find" wording for attributes 2019-09-15 13:10:12 +03:00
cfg-attr-unknown-attribute-macro-expansion.stderr Bless tests 2021-10-15 02:36:58 -05:00
cfg-empty-codemap.rs Remove licenses 2018-12-25 21:08:33 -07:00
cfg-empty-codemap.stderr fix tests 2019-04-14 10:01:32 +02:00
cfg-generic-params.rs resolve: Tweak "cannot find" wording for attributes 2019-09-15 13:10:12 +03:00
cfg-generic-params.stderr resolve: Do not put macros into module.unexpanded_invocations unless necessary 2020-11-22 14:42:29 +03:00
cfg-in-crate-1.rs Remove licenses 2018-12-25 21:08:33 -07:00
cfg-in-crate-1.stderr Provide a span if main function is not present in crate 2019-09-14 11:27:45 -04:00
cfg-non-opt-expr.rs Remove licenses 2018-12-25 21:08:33 -07:00
cfg-non-opt-expr.stderr Remove licenses 2018-12-25 21:08:33 -07:00
cfg_accessible-input-validation.rs builtin_macros: Add attribute macro #[cfg_accessible(path)] 2020-03-10 01:02:13 +03:00
cfg_accessible-input-validation.stderr builtin_macros: Add attribute macro #[cfg_accessible(path)] 2020-03-10 01:02:13 +03:00
cfg_accessible-stuck.rs expand: Tell built-in macros whether we are currently in forced expansion mode 2020-11-19 19:25:20 +03:00
cfg_accessible-stuck.stderr expand: Tell built-in macros whether we are currently in forced expansion mode 2020-11-19 19:25:20 +03:00
cfg_accessible-unstable.rs builtin_macros: Add attribute macro #[cfg_accessible(path)] 2020-03-10 01:02:13 +03:00
cfg_accessible-unstable.stderr builtin_macros: Add attribute macro #[cfg_accessible(path)] 2020-03-10 01:02:13 +03:00
cfg_accessible.rs builtin_macros: Add attribute macro #[cfg_accessible(path)] 2020-03-10 01:02:13 +03:00
cfg_accessible.stderr builtin_macros: Add attribute macro #[cfg_accessible(path)] 2020-03-10 01:02:13 +03:00
cfg_attr_path.rs compiletest: Remove skip-codegen 2019-06-16 12:23:22 +03:00
inner-cfg-non-inline-mod.rs expand: Resolve and expand inner attributes on out-of-line modules 2021-03-14 18:10:29 +03:00
module_with_cfg.rs expand: Resolve and expand inner attributes on out-of-line modules 2021-03-14 18:10:29 +03:00
test-cfg.rs Move some UI tests to more suitable subdirs 2021-06-30 06:41:10 +09:00
test-cfg.stderr Move some UI tests to more suitable subdirs 2021-06-30 06:41:10 +09:00