summary refs log tree commit diff
path: root/src/test/ui/macros
AgeCommit message (Collapse)AuthorLines
2018-02-01Minimize weird spans involving macro contextEsteban Küber-0/+36
Sometimes the parser attempts to synthesize spans from within a macro context with the span for the captured argument, leading to non-sensical spans with very bad output. Given that an incorrect span is worse than a partially incomplete span, when detecting this situation return only one of the spans without mergin them.
2018-01-18Rollup merge of #47481 - estebank:unused-args, r=arielb1kennytm-39/+30
Point at unused arguments for format string Avoid overlapping spans by only pointing at the arguments that are not being used in the argument string. Enable libsyntax to have diagnostics with multiple primary spans by accepting `Into<MultiSpan>` instead of `Span`. Partially addresses #41850.
2018-01-16Add secondary span pointing at the statement (error span)Esteban Küber-15/+25
2018-01-15Point at unused arguments for format stringEsteban Küber-45/+26
Avoid overlapping spans by only pointing at the arguments that are not being used in the argument string. Enable libsyntax to have diagnostics with multiple primary spans by accepting `Into<MultiSpan>` instead of `Span`.
2018-01-15Don't include bang in macro replacement suggestionRyan Cumming-2/+2
When we suggest the replacement for a macro we include the "!" in the suggested replacement but the span only contains the name of the macro itself. Using that replacement would cause a duplicate "!" in the resulting code. I originally tried to extend the span to be replaced by 1 byte in rust-lang/rust#47424. However, @zackmdavis pointed out that there can be whitespace between the macro name and the bang. Instead, just remove the bang from the suggested replacement. Fixes #47418
2018-01-04Do not use casting for suggestion to add type to numeric literalEsteban Küber-4/+4
2018-01-03Provide suggestion when trying to use method on numeric literalEsteban Küber-7/+47
2017-12-10Update ui tests' line numbers.Tommy Ip-2/+2
2017-12-10Add must-compile-successfully comment to appropriate ui tests.Tommy Ip-0/+1
2017-11-26mention nightly in -Z external-macro-backtrace noteAlex Burka-4/+4
2017-11-24Merge cfail and ui tests into ui testsOliver Schneider-41/+42
2017-11-20address review commentsAlex Burka-4/+4
2017-11-19use -Z flag instead of env varAlex Burka-4/+4
2017-11-19update UI testsAlex Burka-4/+4
2017-11-11Auto merge of #45807 - tommyip:format_err, r=estebankbors-1/+1
Make positional argument error in format! clearer r? @estebank Fixes #44954
2017-11-09Allow a trailing comma in assert_eq/ne macroKonrad Borowski-42/+0
2017-11-06Update tests for new format! error messageTommy Ip-1/+1
2017-09-03Fix testbjorn3-1/+0
2017-09-02Fix tidy errorbjorn3-1/+1
2017-09-02Better trace-macro and less span_err_fatalbjorn3-39/+10
2017-09-02Dont abort on first macro errorbjorn3-0/+136
2017-07-26Rollup merge of #43447 - estebank:import-span, r=nikomatsakisMark Simulacrum-1/+1
Point at path segment on module not found Point at the correct path segment on a import statement where a module doesn't exist. New output: ```rust error[E0432]: unresolved import `std::bar` --> <anon>:1:10 | 1 | use std::bar::{foo1, foo2}; | ^^^ Could not find `bar` in `std` ``` instead of: ```rust error[E0432]: unresolved import `std::bar::foo1` --> <anon>:1:16 | 1 | use std::bar::{foo1, foo2}; | ^^^^ Could not find `bar` in `std` error[E0432]: unresolved import `std::bar::foo2` --> <anon>:1:22 | 1 | use std::bar::{foo1, foo2}; | ^^^^ Could not find `bar` in `std` ``` Fix #43040.
2017-07-25Point at path segment on module not foundEsteban Küber-1/+1
Point at the correct path segment on a import statement where a module doesn't exist. New output: ```rust error[E0432]: unresolved import `std::bar` --> <anon>:1:10 | 1 | use std::bar::{foo1, foo2}; | ^^^ Could not find `bar` in `std` ``` instead of: ```rust error[E0432]: unresolved import `std::bar::foo1` --> <anon>:1:16 | 1 | use std::bar::{foo1, foo2}; | ^^^^ Could not find `bar` in `std` error[E0432]: unresolved import `std::bar::foo2` --> <anon>:1:22 | 1 | use std::bar::{foo1, foo2}; | ^^^^ Could not find `bar` in `std` ```
2017-07-21More testsPerry Fraser-0/+80
2017-07-18Change the error message for multiple unused print paramsPerry Fraser-16/+5
2017-07-17Change some helps to suggestionsOliver Schneider-8/+4
2017-07-17Move some tests from compile-fail to uiOliver Schneider-0/+64
2017-07-07Fold E0613 into E0609boreeas-2/+2
Resolves #42945
2017-07-02Revert "Change error count messages"Ariel Ben-Yehuda-5/+5
This reverts commit 5558c64f33446225739c1153b43d2e309bb4f50e.
2017-06-15Add E0613Guillaume Gomez-2/+2
2017-06-15Add E0612Guillaume Gomez-2/+2
2017-06-12Add E0610Guillaume Gomez-2/+2
2017-06-11Add E0609Guillaume Gomez-2/+2
2017-05-29Auto merge of #42264 - GuillaumeGomez:new-error-codes, r=Susurrusbors-2/+2
New error codes Part of #42229.
2017-05-27Add new error codes and update testsGuillaume Gomez-2/+2
2017-05-27Auto merge of #42103 - jorendorff:master, r=estebankbors-2/+5
trace_macro: Show both the macro call and its expansion. #42072. See #42072 for the initial motivation behind this. The change is not the minimal fix, but I want this behavior almost every time I use `trace_macros`.
2017-05-24Change error count messagesMichael Kohl-5/+5
See #33525 for details.
2017-05-19trace_macro: Show both the macro call and its expansion. #42072.Jason Orendorff-2/+5
2017-05-06Group "macro expansion" notes per call spanEsteban Küber-10/+7
2017-05-05Use diagnostics for trace_macro instead of printlnEsteban Küber-0/+27
2017-03-29Refactor how spans are combined in the parser.Jeffrey Seyfried-4/+1
2017-02-06improve error message when two-arg assert_eq! receives a trailing commaZack M. Davis-0/+38
Previously, `assert_eq!(left, right,)` (respectively, `assert_ne!(left, right,)`; note the trailing comma) would result in a confusing "requires at least a format string argument" error. In reality, a format string is optional, but the trailing comma puts us into the "match a token tree of zero or more tokens" branch of the macro (in order to support the optional format string), and passing the empty token tree into `format_args!` results in the confusing error. If instead we match a token tree of one or more tokens, we get a much more sensible "unexpected end of macro invocation" error. While we're here, fix up a stray space before a comma in the match guards. Resolves #39369.
2017-01-12resolve: Do not use "resolve"/"resolution" in error messagesVadim Petrochenkov-4/+4
2016-12-26More systematic error reporting in path resolutionVadim Petrochenkov-4/+4
2016-12-16Allow path fragments to be parsed as type parameter bounds in macro expansionKalita Alexey-0/+30
2016-11-11Add foreign formatting directive detection.Daniel Keep-0/+72
This teaches `format_args!` how to interpret format printf- and shell-style format directives. This is used in cases where there are unused formatting arguments, and the reason for that *might* be because the programmer is trying to use the wrong kind of formatting string. This was prompted by an issue encountered by simulacrum on the #rust IRC channel. In short: although `println!` told them that they weren't using all of the conversion arguments, the problem was in using printf-syle directives rather than ones `println!` would undertand. Where possible, `format_args!` will tell the programmer what they should use instead. For example, it will suggest replacing `%05d` with `{:0>5}`, or `%2$.*3$s` with `{1:.3$}`. Even if it cannot suggest a replacement, it will explicitly note that Rust does not support that style of directive, and direct the user to the `std::fmt` documentation.
2016-10-02Improve error message and snippet for "did you mean `x`"Gavin Baker-6/+6
- Fixes #36164 - Part of #35233 - handles unknown fields - uses UI-style tests - update all related tests (cfail, ui, incremental)
2016-09-26Update E0425, E0446, E0449Jonathan Turner-2/+2
2016-08-17Replace local backtrace with def-use, repair std macro spansJonathan Turner-0/+223