about summary refs log tree commit diff
path: root/src/test
AgeCommit message (Collapse)AuthorLines
2022-06-21Address review comments from #98259Joshua Nelson-8/+8
It got merged so fast I didn't have time to make changes xD
2022-06-19Greatly improve error reporting for futures and generators in ↵Joshua Nelson-60/+296
`note_obligation_cause_code` Most futures don't go through this code path, because they're caught by `maybe_note_obligation_cause_for_async_await`. But all generators do, and `maybe_note` is imperfect and doesn't catch all futures. Improve the error message for those it misses. At some point, we may want to consider unifying this with the code for `maybe_note_async_await`, so that `async_await` notes all parent constraints, and `note_obligation` can point to yield points. But both functions are quite complicated, and it's not clear to me how to combine them; this seems like a good incremental improvement.
2022-06-18Auto merge of #98216 - JohnTitor:rollup-jlcmu5d, r=JohnTitorbors-6/+20
Rollup of 5 pull requests Successful merges: - #97803 (Impl Termination for Infallible and then make the Result impls of Termination more generic) - #97828 (Allow configuring where artifacts are downloaded from) - #98150 (Emscripten target: replace -g4 with -g, and -g3 with --profiling-funcs) - #98195 (Fix rustdoc json primitive handling) - #98205 (Remove a possible unnecessary assignment) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-06-18Rollup merge of #98195 - GuillaumeGomez:rustdoc-json-primitive, r=notriddleYuki Okushi-0/+17
Fix rustdoc json primitive handling Fixes https://github.com/rust-lang/rust/issues/98006. cc `@matthiaskrgr`
2022-06-18Rollup merge of #97803 - Gankra:term, r=dtolnayYuki Okushi-6/+3
Impl Termination for Infallible and then make the Result impls of Termination more generic This allows things like `Result<ExitCode, E>` to 'just work'
2022-06-18Auto merge of #97652 - RalfJung:cenum_impl_drop_cast, r=nagisabors-1/+16
make cenum_impl_drop_cast deny-by-default Also make it show up as future breakage diagnostic. In https://github.com/rust-lang/rust/pull/96862 we are proposing to change behavior of those drops *again*, so this looks like a good opportunity to increase our pressure on getting them out of the ecosystem. Looking at the [tracking issue](https://github.com/rust-lang/rust/issues/73333), so far nobody spoke up in favor of this (accidental) feature. Cc https://github.com/rust-lang/rust/issues/73333 `@oli-obk`
2022-06-17bless new test result, it's a regression but seemingly a compiler bugAria Beingessner-6/+3
2022-06-17Auto merge of #97892 - klensy:fix-spaces, r=oli-obkbors-659/+659
diagnostics: remove trailing spaces Remove few occurrences of trailing spaces and drive by fix of needless alloc of const string.
2022-06-17Add regression test for #98006Guillaume Gomez-0/+17
2022-06-17Rollup merge of #98013 - compiler-errors:guide-inference-2, r=lcnrDylan DPC-17/+35
Subtype FRU fields first in `type_changing_struct_update` So this fixes a subtle bug that `type_changing_struct_update` introduced, where it'll no longer coerce the base expr correctly. I actually think this code is easier to understand now, too. r? `@lcnr` since you reviewed the last one
2022-06-17Rollup merge of #97798 - ↵Dylan DPC-34/+24
WaffleLapkin:allow_for_suggestions_that_are_quite_far_away_from_each_other, r=estebank Hide irrelevant lines in suggestions to allow for suggestions that are far from each other to be shown This is an attempt to fix suggestions one part of which is 6 lines or more far from the first. I've noticed "the problem" (of not showing some parts of the suggestion) here: https://github.com/rust-lang/rust/pull/97759#discussion_r889689230. I'm not sure about the implementation (this big closure is just bad and makes already complicated code even more so), but I want to at least discuss the result. Here is an example of how this changes the output: Before: ```text help: consider enclosing expression in a block | 3 ~ 'l: { match () { () => break 'l, 4 | 5 | 6 | 7 | 8 | ... ``` After: ```text help: consider enclosing expression in a block | 3 ~ 'l: { match () { () => break 'l, 4 | ... 31| 32~ } }; | ``` r? `@estebank` `@rustbot` label +A-diagnostics +A-suggestion-diagnostics
2022-06-17Auto merge of #98160 - nnethercote:mv-finish-out-of-Encoder, r=bjorn3bors-3/+3
Move `finish` out of the `Encoder` trait. This simplifies things, but requires making `CacheEncoder` non-generic. (This was previously merged as commit 4 in #94732 and then was reverted in #97905 because it caused a perf regression.) r? `@ghost`
2022-06-17Subtype FRU fields first in type_changing_struct_updateMichael Goulet-17/+35
2022-06-17Rollup merge of #98166 - GuillaumeGomez:regression-test-98009, r=matthiaskrgrYuki Okushi-0/+38
Add rustdoc-json regression test for #98009 Fixes #98009. There was apparently nothing to be done... cc `@matthiaskrgr` r? `@notriddle`
2022-06-17Rollup merge of #97377 - ChayimFriedman2:issue-91800, r=estebankYuki Okushi-0/+98
Do not suggest adding semicolon/changing delimiters for macros in item position that originates in macros Fixes #91800.
2022-06-16--bless uiMaybe Waffle-34/+24
2022-06-16bless clippy testsklensy-26/+26
2022-06-16Add rustdonc-json regression test for #98009Guillaume Gomez-0/+38
2022-06-16bless rustdoc-ui testsklensy-11/+11
2022-06-16 fix one more case of trailing spaceklensy-139/+139
2022-06-16diagnostics: fix trailing spaceklensy-483/+483
2022-06-16Auto merge of #97842 - notriddle:notriddle/tuple-docs, r=jsha,GuillaumeGomezbors-1/+92
Improve the tuple and unit trait docs * Reduce duplicate impls; show only the `(T,)` and include a sentence saying that there exists ones up to twelve of them. * Show `Copy` and `Clone`. * Show auto traits like `Send` and `Sync`, and blanket impls like `Any`. Here's the new version: * <https://notriddle.com/notriddle-rustdoc-test/std/primitive.tuple.html> * <https://notriddle.com/notriddle-rustdoc-test/std/primitive.unit.html>
2022-06-16Auto merge of #98161 - matthiaskrgr:rollup-8csenk9, r=matthiaskrgrbors-40/+279
Rollup of 4 pull requests Successful merges: - #97757 (Support lint expectations for `--force-warn` lints (RFC 2383)) - #98125 (Entry and_modify doc) - #98137 (debuginfo: Fix NatVis for Rc and Arc with unsized pointees.) - #98147 (Make #[cfg(bootstrap)] not error in proc macros on later stages ) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-06-16Rollup merge of #98137 - michaelwoerister:fix-unsized-rc-arc-natvis, ↵Matthias Krüger-40/+104
r=wesleywiser debuginfo: Fix NatVis for Rc and Arc with unsized pointees. Currently, the NatVis for `Rc<T>` and `Arc<T>` does not support unsized `T`. For both `Rc<T>` and `Rc<dyn SomeTrait>` the visualizers fail: ```txt [Reference count] : -> must be used on pointers and . on structures [Weak reference count] : -> must be used on pointers and . on structures ``` This PR fixes the visualizers. For slices we can even give show the elements, so one now gets something like: ```txt slice_rc : { len=3 } [Length] : 3 [Reference count] : 41 [Weak reference count] : 2 [0] : 1 [1] : 2 [2] : 3 ``` r? `@wesleywiser`
2022-06-16Rollup merge of #97757 - xFrednet:rfc-2383-expect-with-force-warn, ↵Matthias Krüger-0/+175
r=wesleywiser,flip1995 Support lint expectations for `--force-warn` lints (RFC 2383) Rustc has a `--force-warn` flag, which overrides lint level attributes and forces the diagnostics to always be warn. This means, that for lint expectations, the diagnostic can't be suppressed as usual. This also means that the expectation would not be fulfilled, even if a lint had been triggered in the expected scope. This PR now also tracks the expectation ID in the `ForceWarn` level. I've also made some minor adjustments, to possibly catch more bugs and make the whole implementation more robust. This will probably conflict with https://github.com/rust-lang/rust/pull/97718. That PR should ideally be reviewed and merged first. The conflict itself will be trivial to fix. --- r? `@wesleywiser` cc: `@flip1995` since you've helped with the initial review and also discussed this topic with me. :upside_down_face: Follow-up of: https://github.com/rust-lang/rust/pull/87835 Issue: https://github.com/rust-lang/rust/issues/85549 Yeah, and that's it.
2022-06-16Move `finish` out of the `Encoder` trait.Nicholas Nethercote-3/+3
This simplifies things, but requires making `CacheEncoder` non-generic. (This was previously merged as commit 4 in #94732 and then was reverted in #97905 because it caused a perf regression.)
2022-06-16Support lint expectations for `--force-warn` lints (RFC 2383)xFrednet-0/+175
2022-06-16Auto merge of #98108 - SpriteOvO:doc_auto_cfg-feature-rmv-fix, ↵bors-5/+26
r=notriddle,GuillaumeGomez Rustdoc: Fix stab disappearing and exclude cfg "doc" and "doctest" Fixes #98065 Context: https://github.com/rust-lang/rust/issues/43781#issuecomment-1154226733 r? `@GuillaumeGomez`
2022-06-16Do not suggest adding semicolon/changing delimiters for macros in item ↵Chayim Refael Friedman-0/+98
position that originates in macros
2022-06-16Auto merge of #98103 - exrook:btreemap-alloc, r=Amanieubors-8/+8
BTreeMap: Support custom allocators (v1.5) Related: https://github.com/rust-lang/wg-allocators/issues/7 https://github.com/TimDiekmann/alloc-wg Blocked on: ~~#77187~~ ~~#78459~~ ~~#95036~~ previous: #77438
2022-06-15The type of the slice length field is architecture dependentWesley Wiser-4/+4
2022-06-16Rollup merge of #98135 - JohnTitor:issue-93022-93775, r=compiler-errorsYuki Okushi-0/+29
Add regression test for #93775 Closes #93775, also closes #93022 as it should have the same root cause r? ```@compiler-errors``` Signed-off-by: Yuki Okushi <jtitor@2k36.org>
2022-06-16Rollup merge of #98119 - EdwinRy:path-parenthesized-type-error, r=estebankYuki Okushi-20/+35
Refactor path segment parameter error This PR attempts to rewrite the error handling for an unexpected parenthesised type parameters to: - Use provided data instead of re-parsing the whole span - Add a multipart suggestion to reflect on the changes with an underline - Remove the unnecessary "if" nesting
2022-06-16Rollup merge of #98092 - GuillaumeGomez:fix-sidebar-items-expand-collapse, ↵Yuki Okushi-1/+24
r=notriddle Fix sidebar items expand collapse The collapse/expand event was not working for the items in the source code viewer sidebar (talking about these items: ![Screenshot from 2022-06-14 11-21-58](https://user-images.githubusercontent.com/3050060/173543346-af056928-e921-458f-b918-60f6fd0ecbde.png) ). This PR fixes it and adds a GUI test to prevent another regression. r? ```@notriddle```
2022-06-16Rollup merge of #98053 - GuillaumeGomez:fix-generic-impl-json-ice, r=notriddleYuki Okushi-0/+24
Fix generic impl rustdoc json output Fixes #97986. The problem in case of generic trait impl is that the trait's items are the same for all the types afterward. But since they're the same, it's safe for rustdoc-json to just ignore them. A little representation of what's going on: ```rust trait T { fn f(); // <- defid 0 } impl<Y> T for Y { fn f() {} // <- defid 1 } struct S; // <- defid 1 (since it matches `impl<Y> T for Y` ``` cc ```@Urgau``` r? ```@CraftSpider```
2022-06-16Rollup merge of #97964 - WaffleLapkin:fix_borrow_par_suggestions, ↵Yuki Okushi-60/+449
r=compiler-errors Fix suggestions for `&a: T` parameters I've accidentally discovered that we have broken suggestions for `&a: T` parameters: ```rust fn f(&mut bar: u32) {} fn main() { let _ = |&mut a| (); } ``` ```text error[E0308]: mismatched types --> ./t.rs:1:6 | 1 | fn f(&mut bar: u32) {} | ^^^^^^^^----- | | | | | expected due to this | expected `u32`, found `&mut _` | help: did you mean `bar`: `&u32` | = note: expected type `u32` found mutable reference `&mut _` error[E0308]: mismatched types --> ./t.rs:4:23 | 4 | let _: fn(u32) = |&mut a| (); | ^^^^^-- | | | | | expected due to this | expected `u32`, found `&mut _` | help: did you mean `a`: `&u32` | = note: expected type `u32` found mutable reference `&mut _` ``` It's hard to see, but 1. The help span is overlapping with "expected" spans 2. It suggests `fn f( &u32) {}` (no `mut` and lost parameter name) and `|&u32 ()` (no closing `|` and lost parameter name) I've tried to fix this. r? ``@compiler-errors``
2022-06-15Auto merge of #97665 - c410-f3r:assert-compiler, r=oli-obkbors-15/+379
[RFC 2011] Minimal initial implementation Tracking issue: #44838 Third step of #96496 Implementation has ~290 LOC with the bare minimum to be in a functional state. Currently only searches for binary operations to mimic what `assert_eq!` and `assert_ne!` already do. r? `@oli-obk`
2022-06-16Exclude cfg "doc" and "doctest" from feature `doc_auto_cfg`Sprite-10/+15
2022-06-16Fix `cfg(not)` and `cfg(all)` causing Rustdoc stab to disappearSprite-1/+17
2022-06-15debuginfo: Fix NatVis for Rc and Arc with unsized pointees.Michael Woerister-40/+104
2022-06-15Add regression test for #93775Yuki Okushi-0/+29
Signed-off-by: Yuki Okushi <jtitor@2k36.org>
2022-06-15[RFC 2011] Minimal initial implementationCaio-15/+379
2022-06-15Rollup merge of #98115 - jhpratt:remove-rustc_deprecated, r=compiler-errorsYuki Okushi-198/+163
Remove `rustc_deprecated` diagnostics Follow-up on #95960. The diagnostics will remain until the next bootstrap, at which point people will have had six weeks to adjust. ``@rustbot`` label +A-diagnostics r? ``@compiler-errors``
2022-06-15Auto merge of #98123 - JohnTitor:rollup-rfg1a4s, r=JohnTitorbors-13/+123
Rollup of 7 pull requests Successful merges: - #97822 (Filter out intrinsics if we have other import candidates to suggest) - #98026 (Move some tests to more reasonable directories) - #98067 (compiler: remove unused deps) - #98078 (Use unchecked mul to compute slice sizes) - #98083 (Rename rustc_serialize::opaque::Encoder as MemEncoder.) - #98087 (Suggest adding a `#[macro_export]` to a private macro) - #98113 (Fix misspelling of "constraint" as "contraint") Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-06-15Rollup merge of #98087 - TaKO8Ki:suggest-adding-macro-export, r=oli-obkYuki Okushi-4/+50
Suggest adding a `#[macro_export]` to a private macro fixes #97628
2022-06-15Rollup merge of #98083 - nnethercote:rename-Encoder, r=bjorn3Yuki Okushi-9/+9
Rename rustc_serialize::opaque::Encoder as MemEncoder. This avoids the name clash with `rustc_serialize::Encoder` (a trait), and allows lots qualifiers to be removed and imports to be simplified (e.g. fewer `as` imports). (This was previously merged as commit 5 in #94732 and then was reverted in #97905 because of a perf regression caused by commit 4 in #94732.) r? ```@bjorn3```
2022-06-15Rollup merge of #98078 - erikdesjardins:uncheckedsize, r=petrochenkovYuki Okushi-0/+29
Use unchecked mul to compute slice sizes This allows LLVM to realize that `slice.len() > 0` iff `slice.len() * size_of::<T>() > 0`, allowing a branch on the latter to be folded into the former when dropping vecs and boxed slices, in some cases. Fixes (partially) #96497
2022-06-15Rollup merge of #98026 - c410-f3r:z-errors, r=petrochenkovYuki Okushi-0/+0
Move some tests to more reasonable directories r? ```@petrochenkov```
2022-06-15Rollup merge of #97822 - compiler-errors:hesitate-to-suggest-intrinsics, ↵Yuki Okushi-0/+35
r=oli-obk Filter out intrinsics if we have other import candidates to suggest Fixes #97618 Also open to just sorting these candidates to be last. Pretty easy to modify the code to do that, too.
2022-06-15Auto merge of #97474 - compiler-errors:if-cond-and-block, r=oli-obkbors-100/+243
Improve parsing errors and suggestions for bad `if` statements 1. Parses `if {}` as `if <err> {}` (block-like conditions that are missing a "then" block), and `if true && {}` as `if true && <err> {}` (unfinished binary operation), which is a more faithful recovery and leads to better typeck errors later on. 1. Points out the span of the condition if we don't see a "then" block after it, to help the user understand what is being parsed as a condition (and by elimination, what isn't). 1. Allow `if cond token else { }` to be fixed properly to `if cond { token } else { }`. 1. Fudge with the error messages a bit. This is somewhat arbitrary and I can revert my rewordings if they're useless. ---- Also this PR addresses a strange parsing regression (1.20 -> 1.21) where we chose to reject this piece of code somewhat arbitrarily, even though we should parse it fine: ```rust fn main() { if { if true { return } else { return }; } {} } ``` For context, all of these other expressions parse correctly: ```rust fn main() { if { if true { return } else { return } } {} if { return; } {} if { return } {} if { return if true { } else { }; } {} } ``` The parser used a heuristic to determine if the "the parsed `if` condition makes sense as a condition" that did like a one-expr-deep reachability analysis. This should not be handled by the parser though.