about summary refs log tree commit diff
path: root/tests
AgeCommit message (Collapse)AuthorLines
2023-01-16Auto merge of #106850 - cjgillot:issue-106141, r=oli-obkbors-7/+90
Make the inlining destination a Local. Fixes https://github.com/rust-lang/rust/issues/106141
2023-01-16Auto merge of #106872 - dtolnay:nbsp, r=fee1-deadbors-3/+3
Emit only one nbsp error per file Fixes #106101. See https://github.com/rust-lang/rust/issues/106098 for an explanation of how someone would end up with a large number of these nbsp characters in their source code, which is why I think rustc needs to handle this specific case in a friendlier way.
2023-01-15Auto merge of #106914 - matthiaskrgr:rollup-yh0x4gq, r=matthiaskrgrbors-19/+121
Rollup of 5 pull requests Successful merges: - #106888 (Add tidy check to ensure that rustdoc GUI tests start with a small description) - #106896 (suggest `is_empty` for collections when casting to `bool`) - #106900 (Fix regression in `unused_braces` with macros) - #106906 (remove redundant clones) - #106909 (Only suggest adding type param if path being resolved was a type) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2023-01-15Rollup merge of #106909 - compiler-errors:only-types-can-be, r=estebankMatthias Krüger-15/+1
Only suggest adding type param if path being resolved was a type
2023-01-15Rollup merge of #106900 - clubby789:unused-braces-regression, r=estebankMatthias Krüger-1/+21
Fix regression in `unused_braces` with macros Fixes #106899
2023-01-15Rollup merge of #106896 - Ezrashaw:str-cast-bool-emptyness, r=compiler-errorsMatthias Krüger-3/+97
suggest `is_empty` for collections when casting to `bool` Fixes #106883 Matches on slices, `String` and `str`. It would be nice to do this with something like `Deref<Target=str>` as well, but AFAIK it's not possible in this part of the compiler.
2023-01-15Rollup merge of #106888 - GuillaumeGomez:tidy-gui-test, r=notriddleMatthias Krüger-0/+2
Add tidy check to ensure that rustdoc GUI tests start with a small description The first commit comes from https://github.com/rust-lang/rust/pull/106865 to prevent CI to fail. This PR adds a tidy check to enforce having a small description at the top of the GUI test. Although the format is made to be as easy as possible to read, it's not always obvious what a test is actually checking. I think enforcing this will make it easier for us to come back on these tests if needed. r? `@notriddle`
2023-01-15Auto merge of #106393 - the8472:use-ptr-sub, r=scottmcmbors-0/+1
Simplify manual ptr arithmetic in slice::Iter with ptr_sub The old code was introduced in #61885, which predates the ptr_sub method and underlying intrinsic. The codegen test still passes. r? `@scottmcm`
2023-01-15replace manual ptr arithmetic with ptr_subThe 8472-0/+1
2023-01-15Only suggest adding type param if path being resolved was a typeMichael Goulet-15/+1
2023-01-15Auto merge of #106171 - compiler-errors:consolidate-extract_callable_info, ↵bors-0/+34
r=estebank,lcnr Consolidate two almost duplicated fn info extraction routines Moves `extract_callable_info` up to trait selection, because it was being (almost) duplicated fully there for similar diagnostic purposes. This also generalizes the diagnostics we can give slightly (see UI test).
2023-01-15Add small description to GUI testGuillaume Gomez-0/+2
2023-01-15suggest `is_empty` for collections when casting to `bool`Ezra Shaw-3/+97
2023-01-15Fix regression in `unused_braces` with macrosclubby789-1/+21
2023-01-15Rollup merge of #106879 - JohnTitor:issue-42114, r=compiler-errorsMatthias Krüger-0/+20
Add regression test for #42114 Closes #42114 r? compiler-errors Signed-off-by: Yuki Okushi <jtitor@2k36.org>
2023-01-15Rollup merge of #106878 - JohnTitor:issue-92157, r=compiler-errorsMatthias Krüger-0/+51
Add regression test for #92157 Closes #92157 r? compiler-errors Signed-off-by: Yuki Okushi <jtitor@2k36.org>
2023-01-15Rollup merge of #106865 - GuillaumeGomez:add-gui-test-explanation, r=notriddleMatthias Krüger-0/+2
Add explanation comment for GUI test r? `@notriddle`
2023-01-15Rollup merge of #106859 - tialaramex:master, r=NilstriebMatthias Krüger-0/+60
Suggestion for type mismatch when we need a u8 but the programmer wrote a char literal Today Rust just points out that we have a char and we need a u8, but if I wrote 'A' then I could fix this by just writing b'A' instead. This code should detect the case where we're about to report a type mismatch of this kind, and the programmer wrote a char literal, and the char they wrote is ASCII, so therefore just prefixing b to make a byte literal will do what they meant. I have definitely written this mistake more than once, it's not difficult to figure out what to do, but the compiler might as well tell us anyway. I provided a test with two simple examples where the suggestion is appropriate, and one where it is not because the char literal is not ASCII, showing that the suggestion is only triggered in the former cases. I have contributed only a small typo doc fix before, so this is my first substantive rustc change.
2023-01-15Rollup merge of #106072 - eopb:dyn-derive, r=estebankMatthias Krüger-0/+35
fix: misleading "add dyn keyword before derive macro" suggestion Fixes #106071
2023-01-14Improve E0308: suggest user meant to use byte literal, w/ tests and fixNick Lamb-0/+60
suggested by Nilstrieb Co-authored-by: nils <48135649+Nilstrieb@users.noreply.github.com>
2023-01-15Add regression test for #42114Yuki Okushi-0/+20
Signed-off-by: Yuki Okushi <jtitor@2k36.org>
2023-01-15Add regression test for #92157Yuki Okushi-0/+51
Signed-off-by: Yuki Okushi <jtitor@2k36.org>
2023-01-14Emit only one nbsp error per fileDavid Tolnay-40/+1
2023-01-14Add more nbsp to unicode-chars testDavid Tolnay-4/+43
2023-01-14Rollup merge of #106828 - notriddle:notriddle/notable-trait-docblock, ↵Matthias Krüger-5/+5
r=GuillaumeGomez rustdoc: remove `docblock` class from notable trait popover This commit builds on b72de9be74dd5ac1d8b23d5ece03a7690274a14c, which removes the `docblock` class from the All Items page, and 9457380ac902db3febf92077c5b645db55998ad4, which removes the `docblock` class from the item decl. Fixes #92974
2023-01-14Rollup merge of #106820 - m-ou-se:macro-type-error-thing, r=estebankMatthias Krüger-13/+18
Deprioritize fulfillment errors that come from expansions. Fixes (part of?) #69455
2023-01-14Rollup merge of #106563 - clubby789:gce-macro-braces, r=TaKO8KiMatthias Krüger-1/+15
Fix `unused_braces` on generic const expr macro call Fixes #106545 `@rustbot` label +A-const-generics +A-lint
2023-01-14Add explanation for GUI testGuillaume Gomez-0/+2
2023-01-14Fix `unused_braces` on generic const expr macro callclubby789-1/+15
2023-01-14Deprioritize fulfillment errors that come from expansions.Mara Bos-13/+18
2023-01-14fix: misleading add `dyn` to derive macro suggestionEthan Brierley-0/+35
2023-01-14Make the inlining destination a `Local`.Camille GILLOT-7/+68
2023-01-14Rollup merge of #106788 - estebank:elaborate_pred_E0599, r=compiler-errorsMatthias Krüger-2/+209
Tweak E0599 and elaborate_predicates CC https://github.com/rust-lang/rust/issues/86377.
2023-01-14Rollup merge of #106752 - sulami:master, r=estebankMatthias Krüger-0/+264
Emit a hint for bad call return types due to generic arguments When the return type of a function call depends on the type of an argument, e.g. ``` fn foo<T>(x: T) -> T { x } ``` and the expected type is set due to either an explicitly typed binding, or because the call to the function is in a tail position without semicolon, the current error implies that the argument in the call has the wrong type. This new hint highlights that the expected type doesn't match the returned type, which matches the argument type, and that that's why we're flagging the argument type. Fixes #43608.
2023-01-14Rollup merge of #106665 - JulianKnodt:better_fn_trait_note, r=cjgillotMatthias Krüger-1/+73
Add note when `FnPtr` vs. `FnDef` impl trait I encountered an instance where an `FnPtr` implemented a trait, but I was passing an `FnDef`. I was confused for an hour and to examine the source code of the trait's crate's tests in order to understand how to cast it properly (it didn't help that it was behind a reference). To the end user, it might not be immediately obvious that they are different and how to convert from an `FnDef` to an `FnPtr`, but it is necessary to cast to the generic function in order to compile. It is thus useful to suggest `as` in the help note, (even if the `Fn` output implements the trait).
2023-01-14Rollup merge of #106566 - clubby789:contiguous-weird-unicode, r=cjgillotMatthias Krüger-3/+17
Emit a single error for contiguous sequences of unknown tokens Closes #106101 On encountering a sequence of identical source characters which are unknown tokens, note the amount of subsequent characters and advance past them silently. The old behavior was to emit an error and 'help' note for every single one. `@rustbot` label +A-diagnostics +A-parser
2023-01-14Rollup merge of #106046 - uweigand:s390x-test-bigendian-mir, r=Mark-SimulacrumMatthias Krüger-8/+9
Fix mir-opt tests for big-endian platforms The test cases src/test/mir-opt/building/custom/consts.rs and src/test/mir-opt/const_prop/mutable_variable_no_prop.rs are currently failing on big-endian platforms as the binary encoding of some constants is hard-coded in the MIR test files. Fix this by choosing constant values that have the same encoding on big- and little-endian platforms. The test case src/test/mir-opt/issues/issue_75439.rs is failing as well, but since the purpose of the test is to validate handling of big-endian integer encodings on a little-endian platform, it does not make much sense to run it on big-endian platforms in the first place - we can just ignore it there. Fixed part of https://github.com/rust-lang/rust/issues/105383.
2023-01-14Add test.Camille GILLOT-0/+22
2023-01-14Add note when `FnPtr` vs. `FnDef` impl traitkadmin-1/+73
I encountered an instance where an `FnPtr` implemented a trait, but I was passing an `FnDef`. To the end user, there is really no way to differentiate each of them, but it is necessary to cast to the generic function in order to compile. It is thus useful to suggest `as` in the help note, (even if the Fn output implements the trait).
2023-01-14Rollup merge of #106819 - notriddle:notriddle/rm-h1-fqn, r=GuillaumeGomezYuki Okushi-25/+25
rustdoc: remove unnecessary DOM class `h1.fqn` It's misleading. The main heading sometimes isn't an fully qualified name at all. It's also redundant. It's always a child of `div.main-heading`, so just use that.
2023-01-14Rollup merge of #106816 - TimNN:rental-remap, r=oli-objYuki Okushi-0/+229
Update `rental` hack to work with remapped paths. This PR simply switches to an already-existing helper instead of hard-coding a specific enum variant. The new revision of the test fails without the other changes in this PR. Context: I'm exploring running UI tests with remapped paths by default in #105924 and the rental test was one of the ones that failed. This may also be useful in the context of https://github.com/rust-lang/rfcs/pull/3127 ("New rustc and Cargo options to allow path sanitisation by default").
2023-01-14Rollup merge of #106693 - notriddle:notriddle/toggle-trunc, r=GuillaumeGomezYuki Okushi-61/+61
rustdoc: rename CSS rustdoc-toggle -> toggle and toggle -> settings-toggle This swaps things around so that the class that gets used more often has the shorter name.
2023-01-13Consolidate two almost duplicated fn info extraction routinesMichael Goulet-0/+34
2023-01-13rustdoc: remove `docblock` class from notable trait popoverMichael Howell-5/+5
This commit builds on b72de9be74dd5ac1d8b23d5ece03a7690274a14c, which removes the `docblock` class from the All Items page, and 9457380ac902db3febf92077c5b645db55998ad4, which removes the `docblock` class from the item decl. Fixes #92974
2023-01-13Do not incorrectly suggest restricting implied boundsEsteban Küber-3/+3
When we have already suggested bounds that imply the about to be suggested bound, skip them.
2023-01-13Update `rental` hack to work with remapped paths.Tim Neumann-0/+229
2023-01-13rustdoc: rename CSS rustdoc-toggle -> toggle and toggle -> settings-toggleMichael Howell-61/+61
This swaps things around so that the class that gets used more often has the shorter name.
2023-01-13Add testsEsteban Küber-0/+164
2023-01-13Keep obligation chain when elaborating obligationsEsteban Küber-10/+30
2023-01-13Elaborate unmet obligations in E0599 for more contextEsteban Küber-7/+30