about summary refs log tree commit diff
path: root/src/test/ui/str
AgeCommit message (Collapse)AuthorLines
2023-01-11Move /src/test to /testsAlbert Larsan-356/+0
2022-12-13Avoid rendering empty annotationsOli Scherer-3/+0
2022-12-13Make some diagnostics not depend on the source of what they reference being ↵Oli Scherer-12/+3
available
2022-08-18Reword "Required because of the requirements on the impl of ..."Andy Wang-4/+4
2022-07-24suggest dereferencing index when trying to use a reference of usize as indexTakayuki Maeda-8/+8
2022-06-16diagnostics: fix trailing spaceklensy-1/+1
2022-04-04Mention implementers of unsatisfied traitEsteban Kuber-0/+6
When encountering an unsatisfied trait bound, if there are no other suggestions, mention all the types that *do* implement that trait: ``` error[E0277]: the trait bound `f32: Foo` is not satisfied --> $DIR/impl_wf.rs:22:6 | LL | impl Baz<f32> for f32 { } | ^^^^^^^^ the trait `Foo` is not implemented for `f32` | = help: the following other types implement trait `Foo`: Option<T> i32 str note: required by a bound in `Baz` --> $DIR/impl_wf.rs:18:31 | LL | trait Baz<U: ?Sized> where U: Foo { } | ^^^ required by this bound in `Baz` ``` Mention implementers of traits in `ImplObligation`s. Do not mention other `impl`s for closures, ranges and `?`.
2022-03-06Constify slice index for stringsDeadbeef-8/+8
2022-01-18Make suggestions verboseNoah Lev-4/+7
2022-01-18Shorten and improve messagesNoah Lev-10/+5
2022-01-12Add line breaks to make message easier to readNoah Lev-1/+3
2022-01-12Split up very long messageNoah Lev-1/+2
This should make it easier to read.
2022-01-12Improve suggestions for type errors with string concatenationNoah Lev-1/+1
Now, multipart suggestions are used instead of `span_to_snippet`, which improves code quality, makes the suggestion work even without access to source code, and, most importantly, improves the rendering of the suggestion.
2021-11-20Point at source of trait bound obligations in more placesEsteban Kuber-0/+20
Be more thorough in using `ItemObligation` and `BindingObligation` when evaluating obligations so that we can point at trait bounds that introduced unfulfilled obligations. We no longer incorrectly point at unrelated trait bounds (`substs-ppaux.verbose.stderr`). In particular, we now point at trait bounds on method calls. We no longer point at "obvious" obligation sources (we no longer have a note pointing at `Trait` saying "required by a bound in `Trait`", like in `associated-types-no-suitable-supertrait*`). Address part of #89418.
2021-09-16Point at call span that introduced obligation for the argEsteban Kuber-4/+12
2021-08-16Use note to point at bound introducing requirementEsteban Küber-3/+5
2021-08-12Rollup merge of #87671 - jesyspa:issue-87319-multiple-newlines, r=estebankYuki Okushi-0/+32
Warn when an escaped newline skips multiple lines Resolves #87319
2021-08-11Add UI tests for string escape warnings.Anton Golov-0/+32
2021-08-11Modify structured suggestion outputEsteban Küber-8/+9
* On suggestions that include deletions, use a diff inspired output format * When suggesting addition, use `+` as underline * Color highlight modified span
2021-07-30Use multispan suggestions more oftenEsteban Küber-12/+18
* Use more accurate span for `async move` suggestion * Use more accurate span for deref suggestion * Use `multipart_suggestion` more often
2020-09-05Indent a note to make folding work nicerLzu Tao-5/+5
Co-authored-by: Joshua Nelson <joshua@yottadb.com>
2020-09-02pretty: trim paths of unique symbolsDan Aloni-18/+18
If a symbol name can only be imported from one place for a type, and as long as it was not glob-imported anywhere in the current crate, we can trim its printed path and print only the name. This has wide implications on error messages with types, for example, shortening `std::vec::Vec` to just `Vec`, as long as there is no other `Vec` importable anywhere. This adds a new '-Z trim-diagnostic-paths=false' option to control this feature. On the good path, with no diagnosis printed, we should try to avoid issuing this query, so we need to prevent trimmed_def_paths query on several cases. This change also relies on a previous commit that differentiates between `Debug` and `Display` on various rustc types, where the latter is trimmed and presented to the user and the former is not.
2020-07-14Suggest borrowing in more unsized fn param casesEsteban Küber-3/+5
2020-07-14Remove `Sized` `on_unimplemented` noteEsteban Küber-3/+0
2020-05-08Skip tests on emscriptenYuki Okushi-0/+1
2020-05-06Move tests from `test/run-fail` to UIYuki Okushi-0/+9
2020-04-08Small tweaks to required bound spanEsteban Küber-1/+1
2020-03-22Increase verbosity when suggesting subtle code changesEsteban Küber-3/+5
2020-02-02Suggest `?Sized` on type parametersEsteban Küber-1/+3
2020-01-05Add backticks to various diagnosticsvarkor-2/+2
2019-12-12Update testsLeSeulArtichaut-1/+1
2019-12-12Update UI test expectationsLeSeulArtichaut-1/+1
2019-11-21Point at type in `let` assignment on type errorsEsteban Küber-16/+20
2019-11-18Surround types with backticks in type errorsEsteban Küber-6/+6
2019-11-18Remove E0308 note when primary label has all infoEsteban Küber-12/+3
2019-11-18Specific labels when referring to "expected" and "found" typesEsteban Küber-12/+12
2019-10-24Increase spacing for suggestions in diagnosticsEsteban Küber-0/+2
Make the spacing between the code snippet and verbose structured suggestions consistent with note and help messages.
2019-09-22On obligation errors point at the unfulfilled binding when possibleEsteban Küber-1/+1
2019-09-19When possible point at argument causing item obligation failureEsteban Küber-8/+8
2019-08-31Use span label instead of note for cause in E0631Esteban Küber-5/+3
2019-05-16review commentsEsteban Küber-1/+1
2019-05-16Handle more string addition cases with appropriate suggestionsEsteban Küber-2/+5
2019-05-02don't amplify errors in format! with bad literalsAleksey Kladov-14/+2
2019-04-18hide `--explain` hint if error has no extended infoAndy Russell-1/+1
2019-03-27Better diagnostic for binary operation on BoxedValueshgallagher1993-2/+4
2019-03-11Update testsVadim Petrochenkov-11/+11
2019-01-22Rollup merge of #57604 - alercah:str-index, r=sfacklerMazdak Farrokhzad-10/+77
Make `str` indexing generic on `SliceIndex`. Fixes #55603
2019-01-20Auto merge of #57651 - JohnTitor:give-char-type, r=estebankbors-7/+17
Implement new literal type `Err` Fixes #57384 I removed `return Ok`, otherwise, two errors occur. Any solutions? r? @estebank
2019-01-19Make `str` indexing generic on `SliceIndex`.Alexis Hunt-10/+77
2019-01-18Rollup merge of #57350 - folex:master, r=estebankMazdak Farrokhzad-0/+4
Better error note on unimplemented Index trait for string fixes #56740 I've tried to compile suggestion from comments in the issue #56740, but unsure of it. So I'm open to advice :) Current output will be like this: ```rust error[E0277]: the type `str` cannot be indexed by `{integer}` --> $DIR/str-idx.rs:3:17 | LL | let c: u8 = s[4]; //~ ERROR the type `str` cannot be indexed by `{integer}` | ^^^^ `str` cannot be indexed by `{integer}` | = help: the trait `std::ops::Index<{integer}>` is not implemented for `str` = note: you can use `.chars().nth()` or `.bytes().nth()` see chapter in The Book <https://doc.rust-lang.org/book/ch08-02-strings.html#indexing-into-strings> error: aborting due to previous error For more information about this error, try `rustc --explain E0277`. ``` `x.py test src/test/ui` succeeded and I've also tested output manually by compiling the following code: ```rust fn _f() { let s = std::string::String::from("hello"); let _c = s[0]; let s = std::string::String::from("hello"); let mut _c = s[0]; let s = "hello"; let _c = s[0]; let s = "hello"; let mut _c = &s[0]; } ``` Not sure if some docs should be changed too. I will also fix error message in the [Book :: Indexing into Strings](https://github.com/rust-lang/book/blob/db53e2e3cdf77beac853df6f29db4b3b86ea598c/src/ch08-02-strings.md#indexing-into-strings) if that PR will get approved :)