about summary refs log tree commit diff
path: root/tests/ui/rust-2018
AgeCommit message (Collapse)AuthorLines
2025-09-26Ignore more failing ui tests for GCC backendGuillaume Gomez-0/+2
2025-08-19Rollup merge of #145166 - makai410:teach-pub-crate, r=lcnr许杰友 Jieyou Xu (Joe)-0/+4
suggest using `pub(crate)` for E0364 - This introduces `vis_span` into `ImportData` for diagnostic purposes. Closes: rust-lang/rust#145140
2025-08-13resolve: Split extern prelude into two scopesVadim Petrochenkov-8/+2
One for `--extern` options and another for `extern crate` items.
2025-08-13suggest using `pub(crate)` for E0364Makai-0/+4
2025-07-21Don't use another main test file as auxiliaryJieyou Xu-10/+10
In this case, the exact extern crate isn't very important. This is part of the changes needed to address the spurious failures from a main test `../removing-extern-crate.rs` being both an auxiliary and a main test file, causing fs races due to multiple `rustc` processes in multiple test threads trying to build the main test file both as a main test and also as an auxiliary at around the same time.
2025-07-10chore: Improve how the other suggestions message gets renderedScott Schafer-1/+1
2025-06-05Add more missing 2015 edition directivesLukas Wirth-34/+50
2025-05-29Use `cfg_attr` AST placeholder AST `cfg_attr_trace` for diagnosticsEsteban Küber-12/+154
PR 138515, we insert a placeholder attribute so that checks for attributes can still know about the placement of `cfg` attributes. When we suggest removing items with `cfg_attr`s (fix Issue 56328) and make them verbose. We tweak the wording of the existing "unused `extern crate`" lint. ``` warning: unused extern crate --> $DIR/removing-extern-crate.rs:9:1 | LL | extern crate removing_extern_crate as foo; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unused | note: the lint level is defined here --> $DIR/removing-extern-crate.rs:6:9 | LL | #![warn(rust_2018_idioms)] | ^^^^^^^^^^^^^^^^ = note: `#[warn(unused_extern_crates)]` implied by `#[warn(rust_2018_idioms)]` help: remove the unused `extern crate` | LL - #[cfg_attr(test, macro_use)] LL - extern crate removing_extern_crate as foo; LL + | ```
2025-04-29Move tests from /ui directorymejrs-0/+67
2025-04-08UI tests: add missing diagnostic kinds where possibleVadim Petrochenkov-8/+8
2025-02-14Trim suggestion parts to the subset that is purely additiveMichael Goulet-1/+1
2025-02-14Consider add-prefix replacements tooMichael Goulet-3/+2
2025-02-10Show diff suggestion format on verbose replacementEsteban Küber-12/+18
``` error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields --> $DIR/attempted-access-non-fatal.rs:7:15 | LL | let _ = 2.l; | ^ | help: if intended to be a floating point literal, consider adding a `0` after the period and a `f64` suffix | LL - let _ = 2.l; LL + let _ = 2.0f64; | ```
2025-01-24Reword "crate not found" resolve messageEsteban Küber-1/+3
``` error[E0432]: unresolved import `some_novel_crate` --> file.rs:1:5 | 1 | use some_novel_crate::Type; | ^^^^^^^^^^^^^^^^ use of unresolved module or unlinked crate `some_novel_crate` ``` On resolve errors where there might be a missing crate, mention `cargo add foo`: ``` error[E0433]: failed to resolve: use of unresolved module or unlinked crate `nope` --> $DIR/conflicting-impl-with-err.rs:4:11 | LL | impl From<nope::Thing> for Error { | ^^^^ use of unresolved module or unlinked crate `nope` | = help: if you wanted to use a crate named `nope`, use `cargo add nope` to add it to your `Cargo.toml` ```
2024-11-27Update tests to use new proc-macro headerEric Huss-7/+2
2024-08-09diagnostics: do not warn when a lifetime bound infers itselfMichael Howell-0/+82
2024-06-13Tweak output of import suggestionsEsteban Küber-1/+1
When both `std::` and `core::` items are available, only suggest the `std::` ones. We ensure that in `no_std` crates we suggest `core::` items. Ensure that the list of items suggested to be imported are always in the order of local crate items, `std`/`core` items and finally foreign crate items. Tweak wording of import suggestion: if there are multiple items but they are all of the same kind, we use the kind name and not the generic "items". Fix #83564.
2024-06-03Spruce up the diagnostics of some early lintsLeón Orell Valerian Liehr-2/+3
2024-05-07Make sure we don't deny macro vars w keyword namesMichael Goulet-31/+18
2024-05-04compiletest: add enable-by-default check-cfgUrgau-2/+2
2024-04-22Deny gen keyword in edition_2024_compat lintsMichael Goulet-3/+5
2024-04-09Further cleanup cfgs in the UI test suiteUrgau-4/+4
This commit does three things: 1. replaces (the last remaining) never true cfgs by the FALSE cfg 2. fix derive-helper-configured.rs (typo in directive) 3. and comment some current unused #[cfg_attr] (missing revisions)
2024-03-25Add needs-unwind for proc macro testsbjorn3-0/+1
Rustc gives a warning when compiling proc macros with panic=abort.
2024-03-10Detect unused struct impls pub traitr0cky-1/+1
2024-03-01If suggestion would leave an empty line, delete itclubby789-2/+0
2024-02-25Auto merge of #120393 - Urgau:rfc3373-non-local-defs, r=WaffleLapkinbors-0/+2
Implement RFC 3373: Avoid non-local definitions in functions This PR implements [RFC 3373: Avoid non-local definitions in functions](https://github.com/rust-lang/rust/issues/120363).
2024-02-22Deduplicate some logic and reword outputEsteban Küber-4/+4
2024-02-22Tweak wording of "implemented trait isn't imported" suggestionEsteban Küber-4/+4
2024-02-22Make confusable suggestions `verbose`Esteban Küber-1/+6
2024-02-22Consider methods from traits when suggesting typosEsteban Küber-5/+13
Do not provide a structured suggestion when the arguments don't match. ``` error[E0599]: no method named `test_mut` found for struct `Vec<{integer}>` in the current scope --> $DIR/auto-ref-slice-plus-ref.rs:7:7 | LL | a.test_mut(); | ^^^^^^^^ | = help: items from traits can only be used if the trait is implemented and in scope note: `MyIter` defines an item `test_mut`, perhaps you need to implement it --> $DIR/auto-ref-slice-plus-ref.rs:14:1 | LL | trait MyIter { | ^^^^^^^^^^^^ help: there is a method `get_mut` with a similar name, but with different arguments --> $SRC_DIR/core/src/slice/mod.rs:LL:COL ``` Consider methods beyond inherent ones when suggesting typos. ``` error[E0599]: no method named `owned` found for reference `&dyn Foo` in the current scope --> $DIR/object-pointer-types.rs:11:7 | LL | fn owned(self: Box<Self>); | --------- the method might not be found because of this arbitrary self type ... LL | x.owned(); | ^^^^^ help: there is a method with a similar name: `to_owned` ``` Fix #101013.
2024-02-18Auto merge of #119673 - petrochenkov:dialoc5, r=compiler-errors,cjgillotbors-19/+42
macro_rules: Preserve all metavariable spans in a global side table This PR preserves spans of `tt` metavariables used to pass tokens to declarative macros. Such metavariable spans can then be used in span combination operations like `Span::to` to improve all kinds of diagnostics. Spans of non-`tt` metavariables are currently kept in nonterminal tokens, but the long term plan is remove all nonterminal tokens from rustc parser and rely on the proc macro model with invisible delimiters (#114647, #67062). In particular, `NtIdent` nonterminal (corresponding to `ident` metavariables) becomes easy to remove when this PR lands (#119412 does it). The metavariable spans are kept in a global side table keyed by `Span`s of original tokens. The alternative to the side table is keeping them in `SpanData` instead, but the performance regressions would be large because any spans from tokens passed to declarative macros would stop being inline and would work through span interner instead, and the penalty would be paid even if we never use the metavar span for the given original span. (But also see the comment on `fn maybe_use_metavar_location` describing the map collision issues with the side table approach.) There are also other alternatives - keeping the metavar span in `Token` or `TokenTree`, but associating it with `Span` itsel is the most natural choice because metavar spans are used in span combining operations, and those operations are not necessarily tied to tokens.
2024-02-18By tracking import use types to check whether it is scope uses or the other ↵surechen-3/+5
situations like module-relative uses, we can do more accurate redundant import checking. fixes #117448 For example unnecessary imports in std::prelude that can be eliminated: ```rust use std::option::Option::Some;//~ WARNING the item `Some` is imported redundantly use std::option::Option::None; //~ WARNING the item `None` is imported redundantly ```
2024-02-18macro_rules: Preserve all metavariable spans in a global side tableVadim Petrochenkov-19/+42
2024-02-17Allow newly added non_local_definitions lint in testsUrgau-0/+2
2024-02-16[AUTO-GENERATED] Migrate ui tests from `//` to `//@` directives许杰友 Jieyou Xu (Joe)-161/+161
2024-02-07Update testsr0cky-2/+2
2024-01-29Supress unhelpful diagnostics for unresolved top level attributesyukang-10/+1
2023-12-10Remove edition umbrella features.Eric Huss-52/+29
2023-11-24Show number in error message even for one errorNilstrieb-16/+16
Co-authored-by: Adrian <adrian.iosdev@gmail.com>
2023-10-19Fix duplicate labels emitted in `render_multispan_macro_backtrace()`Gurinder Singh-6/+1
Using hash set instead of vec to weed out duplicates
2023-10-05Add a note to duplicate diagnosticsAlex Macleod-0/+10
2023-09-20Validate crate name in CLI option --externLeón Orell Valerian Liehr-1/+1
2023-06-29resolve: Remove artificial import ambiguity errorsVadim Petrochenkov-164/+17
2023-06-13Fix explicit-outlives-requirements lint spanSam Ginnett-1/+24
2023-05-21Rename `drop_copy` lint to `dropping_copy_types`Urgau-2/+2
2023-05-10Adjust tests for new drop and forget lintsUrgau-3/+5
2023-04-12Special-case item attributes in the suggestion outputEsteban Küber-8/+0
2023-04-12Tweak output for 'add line' suggestionEsteban Küber-8/+16
2023-04-07Use smart-resolve when checking for trait in RHS of UFCSMichael Goulet-6/+19
2023-02-22Move the unused extern crate check back to the resolver.Camille GILLOT-3/+39