about summary refs log tree commit diff
path: root/src/test/ui/conditional-compilation
AgeCommit message (Collapse)AuthorLines
2023-01-11Move /src/test to /testsAlbert Larsan-1311/+0
2022-12-10Migrate parts of `rustc_expand` to session diagnosticsnils-1/+1
This migrates everything but the `mbe` and `proc_macro` modules. It also contains a few cleanups and drive-by/accidental diagnostic improvements which can be seen in the diff for the UI tests.
2022-11-10Tweak span for `#[must_use]`Esteban Küber-1/+1
Do not point at whole statement, only at the expression (skip pointing at `;`)
2022-11-07Modify comment syntax errorwanghaha-dev-1/+1
2022-08-27use smaller span for suggestionsTakayuki Maeda-1/+3
2022-06-03Conservatively report "not sure" in cfg_accessibleUrgau-32/+56
2022-05-30Add test for known-bugs of cfg_accessibleUrgau-6/+46
2022-05-30Add tests for private items of cfg_accessibleUrgau-0/+21
2022-05-30Add tests for "not sure" case of cfg_accessibleUrgau-0/+303
2022-05-30Handle more cases in cfg_accessibleUrgau-41/+42
2022-03-05Do not point at whole file missing `fn main`Esteban Kuber-6/+5
Only point at the end of the crate. We could try making it point at the beginning of the crate, but that is confused with `DUMMY_SP`, causing the output to be *worse*. This change will make it so that VSCode will *not* underline the whole file when `main` is missing, so other errors will be visible.
2022-01-16Update unit tests to match more limited hint about escaping.Ivor Wanders-10/+11
2022-01-16Add unit test for cfg-arg without quotes.Ivor Wanders-0/+5
2022-01-12Update unit tests to accomodate for improved error.Ivor Wanders-12/+12
2022-01-01Emit an error for `--cfg=)`Jakub Kądziołka-0/+5
Fixes #73026 See also: #64467, #89468 The issue stems from a `FatalError` being silently raised in `panictry_buffer`. Normally this is not a problem, because `panictry_buffer` emits the causes of the error, but they are not themselves fatal, so they get filtered out by the silent emitter. To fix this, we use a parser entrypoint which doesn't use `panictry_buffer`, and we handle the error ourselves.
2021-11-06Move some tests to more reasonable directoriesCaio-0/+10
2021-10-23Rollup merge of #89468 - FabianWolff:issue-89358, r=jackh726Matthias Krüger-0/+9
Report fatal lexer errors in `--cfg` command line arguments Fixes #89358. The erroneous behavior was apparently introduced by `@Mark-Simulacrum` in https://github.com/rust-lang/rust/commit/a678e3191197f145451c97c6cc884e15cae38186; 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: https://github.com/rust-lang/rust/blob/edebf77e0090195bf80c0d8cda821e1bf9d03053/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-15Bless testsCameron Steffen-3/+3
2021-10-02Report fatal lexer errors in `--cfg` command line argumentsFabian Wolff-0/+9
2021-08-21Remove `Session.used_attrs` and move logic to `CheckAttrVisitor`Aaron Hill-4/+4
Instead of updating global state to mark attributes as used, we now explicitly emit a warning when an attribute is used in an unsupported position. As a side effect, we are to emit more detailed warning messages (instead of just a generic "unused" message). `Session.check_name` is removed, since its only purpose was to mark the attribute as used. All of the callers are modified to use `Attribute.has_name` Additionally, `AttributeType::AssumedUsed` is removed - an 'assumed used' attribute is implemented by simply not performing any checks in `CheckAttrVisitor` for a particular attribute. We no longer emit unused attribute warnings for the `#[rustc_dummy]` attribute - it's an internal attribute used for tests, so it doesn't mark sense to treat it as 'unused'. With this commit, a large source of global untracked state is removed.
2021-08-11Modify structured suggestion outputEsteban Küber-2/+2
* On suggestions that include deletions, use a diff inspired output format * When suggesting addition, use `+` as underline * Color highlight modified span
2021-06-30Move some UI tests to more suitable subdirsYuki Okushi-0/+17
2021-05-12Show macro name in 'this error originates in macro' messageAaron Hill-3/+3
When there are multiple macros in use, it can be difficult to tell which one was responsible for producing an error.
2021-03-15More precise spans for HIR pathsVadim Petrochenkov-1/+1
2021-03-14expand: Resolve and expand inner attributes on out-of-line modulesVadim Petrochenkov-0/+10
2020-11-22resolve: Do not put macros into `module.unexpanded_invocations` unless necessaryVadim Petrochenkov-12/+12
2020-11-19expand: Tell built-in macros whether we are currently in forced expansion modeVadim Petrochenkov-8/+2
2020-11-03Expand `NtExpr` tokens only in key-value attributesVadim Petrochenkov-1/+13
2020-07-26report kind of deprecated item in messageAndy Russell-8/+8
This is important for fields, which are incorrectly referred to as "items".
2020-04-11rustc: Add a warning count upon completionRoccoDev-0/+2
2020-03-10builtin_macros: Add attribute macro `#[cfg_accessible(path)]`Vadim Petrochenkov-0/+186
2020-02-09--bless --compare-mode=nllMatthias Prechtl-3/+3
2020-02-06rustc_macros: don't limit the -Zmacro-backtrace suggestion to extern macros.Eduard-Mihai Burtescu-0/+4
2020-01-24Normalise notes with the/isvarkor-2/+2
2019-12-06cfg_attr: avoid .outer_tokensMazdak Farrokhzad-7/+73
2019-11-02Update error annotations in tests that successfully compileTomasz Miąsko-1/+1
Those annotation are silently ignored rather than begin validated against compiler output. Update them before validation is enabled, to avoid test failures.
2019-09-16Rollup merge of #64467 - Mark-Simulacrum:hide-cfg-failures, r=estebankMazdak Farrokhzad-0/+5
Hide diagnostics emitted during --cfg parsing The early error is more than sufficient for fixing the problem. Fixes https://github.com/rust-lang/rust/issues/31496.
2019-09-15Hide diagnostics emitted during --cfg parsingMark Rousskov-0/+5
The early error is more than sufficient for fixing the problem.
2019-09-15resolve: Tweak "cannot find" wording for attributesVadim Petrochenkov-12/+12
2019-09-14Provide a span if main function is not present in crateMark Rousskov-2/+7
Unfortunately, the diagnotic machinery does not cope well with an empty span which can happen if the crate is empty, in which case we merely set a spanless note.
2019-09-09Resolve attributes in several placesCaio-39/+25
Arm, Field, FieldPat, GenericParam, Param, StructField and Variant
2019-08-23`--bless` some tests due to message format change.Mazdak Farrokhzad-6/+8
2019-07-19Auto merge of #62684 - petrochenkov:scopevisit, r=davidtwcobors-6/+3
resolve: Improve candidate search for unresolved macro suggestions Use same scope visiting machinery for both collecting suggestion candidates and actually resolving the names. The PR is better read in per-commit fashion with whitespace changes ignored (the first commit in particular moves some code around). This should be the last pre-requisite for https://github.com/rust-lang/rust/pull/62086. r? @davidtwco
2019-07-18resolve: Use `feature(custom_attribute)` fallback only if the feature is enabledVadim Petrochenkov-6/+3
Normally `#![feature(...)]` shouldn't change behavior, but custom attributes in particular are in the process of retirement, and we should not produce a message telling to enable them. It also helps with unifying diagnostics for unresolved macros.
2019-07-17normalize use of backticks in compiler messages for librustc/lintSamy Kacimi-2/+2
https://github.com/rust-lang/rust/issues/60532
2019-07-13review commentsEsteban Küber-1/+1
2019-07-13Tweak wording in feature gate errorsEsteban Küber-6/+6
2019-07-09normalize use of backticks in compiler messages for libsyntax/feature_gateSamy Kacimi-9/+9
https://github.com/rust-lang/rust/issues/60532
2019-07-03Migrate compile-pass annotations to build-passYuki Okushi-2/+2
2019-06-23Auto merge of #61778 - petrochenkov:pass, r=Mark-Simulacrumbors-4/+3
compiletest: Introduce `// {check,build,run}-pass` pass modes Pass UI tests now have three modes ``` // check-pass // build-pass // run-pass ``` mirroring equivalent well-known `cargo` commands. `// check-pass` will compile the test skipping codegen (which is expensive and isn't supposed to fail in most cases). `// build-pass` will compile and link the test without running it. `// run-pass` will compile, link and run the test. Tests without a "pass" annotation are still considered "fail" tests. Most UI tests would probably want to switch to `check-pass`. Tests validating codegen would probably want to run the generated code as well and use `run-pass`. `build-pass` should probably be rare (linking tests?). https://github.com/rust-lang/rust/pull/61755 will provide a way to run the tests with any mode, e.g. bump `check-pass` tests to `run-pass` to satisfy especially suspicious people, and be able to make sure that codegen doesn't breaks in some entirely unexpected way. Tests marked with any mode are expected to pass with any other mode, if that's not the case for some legitimate reason, then the test should be made a "fail" test rather than a "pass" test. Perhaps some secondary CI can verify this invariant, but that's not super urgent. `// compile-pass` still works and is equivalent to `build-pass`. Why is `// compile-pass` bad - 1) it gives an impression that the test is only compiled, but not linked, 2) it doesn't mirror a cargo command. It can be removed some time in the future in a separate PR. cc https://github.com/rust-lang/rust/issues/61712