about summary refs log tree commit diff
path: root/tests/ui/errors
AgeCommit message (Collapse)AuthorLines
2025-10-01tests: remove `no-remap-src-base`Jieyou Xu-5/+4
Previously in the `//`-compiletest-directive times, this was implemented as a special `no-*` directive parsing. In the migration from `//` -> `//@`, the `// no-remap-src-base` directive was lost, most likely because it had no effect -- the default is not remapping `src-base`. So remove occurrences of `no-remap-src-base`, as these are not valid directives.
2025-09-30Fix unuseful span in type error in some format_args!() invocationsTomoaki Kobayashi-25/+20
2025-09-30Add test for unuseful span in type error in some format_args!() invocationsTomoaki Kobayashi-0/+80
2025-08-22On E0277, point at type that doesn't implement boundEsteban Küber-7/+42
When encountering an unmet trait bound, point at local type that doesn't implement the trait: ``` error[E0277]: the trait bound `Bar<T>: Foo` is not satisfied --> $DIR/issue-64855.rs:9:19 | LL | pub struct Bar<T>(<Self as Foo>::Type) where Self: ; | ^^^^^^^^^^^^^^^^^^^ unsatisfied trait bound | help: the trait `Foo` is not implemented for `Bar<T>` --> $DIR/issue-64855.rs:9:1 | LL | pub struct Bar<T>(<Self as Foo>::Type) where Self: ; | ^^^^^^^^^^^^^^^^^ ```
2025-08-19bless tests with new lint messagesKarol Zwolak-2/+2
2025-07-29Verify llvm-needs-components are not empty and match the --target valueDaniel Paoliello-1/+2
2025-07-16future-incompat lints: don't link to the nightly edition-guide versiondianne-1/+1
2025-06-22Implement DesugaringKind::FormatLiteralmejrs-21/+7
2025-06-02Add missing 2015 edition directivesLukas Wirth-2/+3
These tests specifically test 2015 edition behavior, so ensure that they can only be run with this edition
2025-05-08Rework `-Zremap-path-scope` macro test with dependency checkUrgau-9/+103
2025-05-08Add tests for `-Zremap-path-scope` and paths in diagnostics with depsUrgau-0/+189
2025-04-16ignore aix for tests/ui/erros/pic-linker.rsCurtis D'Alves-0/+1
2025-04-05Rollup merge of #139285 - tshepang:uniform-case, r=jieyouxuStuart Cook-2/+4
use lower case to match other error messages
2025-04-03compiletest: Require `//~` annotations even if `error-pattern` is specifiedVadim Petrochenkov-12/+14
2025-04-03structure the messageTshepang Mbambo-1/+3
2025-04-03use lower case to match other error messagesTshepang Mbambo-2/+2
2025-03-25compiletest: Support matching on diagnostics without a spanVadim Petrochenkov-0/+2
2025-02-21Trim suggestion part before generating highlightsMichael Goulet-5/+2
2024-12-27Remove the `-test` suffix from normalize directivesZalathar-2/+2
2024-12-16Fix logical error with what text is considered whitespace.Harrison Kaiser-0/+24
There is a logical issue around what counts as leading white-space. There is code which does a subtraction assuming that no errors will be reported inside the leading whitespace. However we compute the length of that whitespace with std::char::is_whitespace and not rustc_lexer::is_whitespace. The former will include a no-break space while later will excluded it. We can only safely make the assumption that no errors will be reported in whitespace if it is all "Rust Standard" whitespace. Indeed an error does occur in unicode whitespace if it contains a no-break space.
2024-12-12Tweak multispan renderingEsteban Küber-2/+1
Consider comments and bare delimiters the same as an "empty line" for purposes of hiding rendered code output of long multispans. This results in more aggressive shortening of rendered output without losing too much context, specially in `*.stderr` tests that have "hidden" comments.
2024-12-07Use trait name instead of full constraint in suggestion messageEsteban Küber-2/+2
``` help: consider restricting type parameter `T` with traits `Copy` and `Trait` | LL | fn duplicate_custom<T: Copy + Trait>(t: S<T>) -> (S<T>, S<T>) { | ++++++++++++++ ``` ``` help: consider restricting type parameter `V` with trait `Copy` | LL | fn index<'a, K, V: std::marker::Copy>(map: &'a HashMap<K, V>, k: K) -> &'a V { | +++++++++++++++++++ ```
2024-12-07reword trait bound suggestion message to include the boundsEsteban Küber-29/+29
2024-10-29Remove detail from label/note that is already available in other noteEsteban Küber-28/+28
Remove the "which is required by `{root_obligation}`" post-script in "the trait `X` is not implemented for `Y`" explanation in E0277. This information is already conveyed in the notes explaining requirements, making it redundant while making the text (particularly in labels) harder to read. ``` error[E0277]: the trait bound `NotCopy: Copy` is not satisfied --> $DIR/wf-static-type.rs:10:13 | LL | static FOO: IsCopy<Option<NotCopy>> = IsCopy { t: None }; | ^^^^^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `NotCopy` | = note: required for `Option<NotCopy>` to implement `Copy` note: required by a bound in `IsCopy` --> $DIR/wf-static-type.rs:7:17 | LL | struct IsCopy<T:Copy> { t: T } | ^^^^ required by this bound in `IsCopy` ``` vs the prior ``` error[E0277]: the trait bound `NotCopy: Copy` is not satisfied --> $DIR/wf-static-type.rs:10:13 | LL | static FOO: IsCopy<Option<NotCopy>> = IsCopy { t: None }; | ^^^^^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `NotCopy`, which is required by `Option<NotCopy>: Copy` | = note: required for `Option<NotCopy>` to implement `Copy` note: required by a bound in `IsCopy` --> $DIR/wf-static-type.rs:7:17 | LL | struct IsCopy<T:Copy> { t: T } | ^^^^ required by this bound in `IsCopy` ```
2024-10-17Rollup merge of #128391 - cafce25:issue-128390, r=lcnrMatthias Krüger-16/+20
Change orphan hint from "only" to "any uncovered type inside..." Fix #128390
2024-09-29Auto merge of #129687 - Urgau:rfc3127-sysroot-2, r=jieyouxubors-0/+58
Implement RFC3137 trim-paths sysroot changes - take 2 This PR is a continuation of https://github.com/rust-lang/rust/pull/118149. Nothing really changed, except for https://github.com/rust-lang/rust/pull/129408 which I was able to trigger locally. Original description: > Implement parts of #111540 > > Right now, backtraces into sysroot always shows /rustc/$hash in diagnostics, e.g. > > ``` > thread 'main' panicked at 'hello world', map-panic.rs:2:50 > stack backtrace: > 0: std::panicking::begin_panic > at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/std/src/panicking.rs:616:12 > 1: map_panic::main::{{closure}} > at ./map-panic.rs:2:50 > 2: core::option::Option<T>::map > at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/core/src/option.rs:929:29 > 3: map_panic::main > at ./map-panic.rs:2:30 > 4: core::ops::function::FnOnce::call_once > at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/core/src/ops/function.rs:248:5 > note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. > ``` > > [RFC 3127 said](https://rust-lang.github.io/rfcs/3127-trim-paths.html#changing-handling-of-sysroot-path-in-rustc) > > > We want to change this behaviour such that, when rust-src source files can be discovered, the virtual path is discarded and therefore the local path will be embedded, unless there is a --remap-path-prefix that causes this local path to be remapped in the usual way. > > This PR implements this behaviour. When `rust-src` is present at compile time, rustc replaces /rustc/$hash with a real path into local rust-src with best effort. To sanitise this, users must explicitly supply `--remap-path-prefix=<path to rust-src>=foo`. cc `@cbeuw` Fix #105907 Fix #85463 try-job: dist-x86_64-linux try-job: x86_64-msvc try-job: dist-x86_64-msvc try-job: armhf-gnu
2024-09-28remap-path-prefix-sysroot: remap {{src-base}} as wellUrgau-1/+2
This is done to cover the path of the test it-self as it may not live on the same root directory as {{rust-src-base}}, which can be the case if {{rust-src-base}} is coming from a extracted dist build (cc opt-dist)
2024-09-27Implement RFC3137 trim-paths sysroot changesUrgau-0/+57
2024-09-26Make new information notes instead of labelsJonathan Birk-8/+8
2024-09-25Compiler: Rename "object safe" to "dyn compatible"León Orell Valerian Liehr-1/+1
2024-08-11Add more information link to orphan implsJonathan Birk-5/+9
2024-07-30Adjust orphan note in testsJonathan Birk-11/+11
2024-07-22rewrite and rename issue-107094 to rmakeOneirical-0/+5
2024-07-22rewrite and rename issue-33329 to ui testOneirical-0/+5
2024-07-09E0191 suggestion correction, inserts turbofish without dyn (#91997)Ashton Hunt-0/+31
2024-05-29rewrite and rename issue-37893 to rmakeOneirical-1/+1
2024-05-29convert fpic to ui testOneirical-0/+12
2024-02-16[AUTO-GENERATED] Migrate ui tests from `//` to `//@` directives许杰友 Jieyou Xu (Joe)-22/+22
2024-01-30Provide more context on derived obligation error primary labelEsteban Küber-28/+28
Expand the primary span of E0277 when the immediate unmet bound is not what the user wrote: ``` error[E0277]: the trait bound `i32: Bar` is not satisfied --> f100.rs:6:6 | 6 | <i32 as Foo>::foo(); | ^^^ the trait `Bar` is not implemented for `i32`, which is required by `i32: Foo` | help: this trait has no implementations, consider adding one --> f100.rs:2:1 | 2 | trait Bar {} | ^^^^^^^^^ note: required for `i32` to implement `Foo` --> f100.rs:3:14 | 3 | impl<T: Bar> Foo for T {} | --- ^^^ ^ | | | unsatisfied trait bound introduced here ``` Fix #40120.
2023-11-24Show number in error message even for one errorNilstrieb-6/+6
Co-authored-by: Adrian <adrian.iosdev@gmail.com>
2023-10-17[RFC 3127 - Trim Paths]: Add test for -Zremap-path-scope=diagnosticsUrgau-1/+22
2023-10-17[RFC 3127 - Trim Paths]: Add test for -Zremap-path-scope=macroUrgau-0/+15
2023-02-28Fix error spans for arguments to tuple enum constructorsNathan Fenner-5/+358
2023-02-27Point error span at Some constructor argument when trait resolution failsNathan Fenner-5/+93
2023-02-19Refine error span for trait error into borrowed expressionNathan Fenner-14/+52
2023-01-23Point at specific field in struct literal when trait fulfillment failsNathan Fenner-0/+574
2023-01-16ui tests: Remap test base directory by default.Tim Neumann-16/+12
2023-01-14Heuristically undo path prefix mappings.Tim Neumann-0/+79
Because the compiler produces better diagnostics if it can find the source of (potentially remapped) dependencies.
2023-01-11Move /src/test to /testsAlbert Larsan-0/+130