about summary refs log tree commit diff
path: root/src
AgeCommit message (Collapse)AuthorLines
2022-08-17Add LLVM15-specific codegen test for `try`/`?`s that now optimize awayScott McMurray-0/+54
These still generated a bunch of code back in Rust 1.63 (<https://rust.godbolt.org/z/z31P8h6rz>), but with LLVM 15 merged they no longer do :tada:
2022-08-14Rollup merge of #100526 - Nilstrieb:tests!, r=Mark-SimulacrumMatthias Krüger-0/+145
Add tests for the drop behavior of some control flow constructs In #100513 it was shown that the drop behaviour of let_chains is not correct currently. Since drop behaviour is something pretty subtle, this adds explicit tests for the drop behavior of `if`, `if let` and `match` to make sure that it does not regress in the future. The `println!`s were left in to make debugging easier in case something goes wrong, but they are not required for the test.
2022-08-14Rollup merge of #100524 - ohno418:impl-debug-for-some-rustbuild-structs, ↵Matthias Krüger-1/+2
r=Mark-Simulacrum Impl `Debug` for some structs of rustbuild A small patch to impl `Debug` for some structs of rustbuild to make debugging easier. (I was trying to impl `Debug` for the `Config` struct, but found to have a bit more things to do. So gave up for now.)
2022-08-14Rollup merge of #100523 - GuillaumeGomez:remove-clean-impls, r=Dylan-DPCMatthias Krüger-13/+7
[rustdoc] remove Clean trait Follow-up of https://github.com/rust-lang/rust/pull/99638. This is (finally!) the last part. r? `@Dylan-DPC`
2022-08-14Rollup merge of #100253 - obeis:issue-100197, r=cjgillotMatthias Krüger-0/+20
Recover from mutable variable declaration where `mut` is placed before `let` Closes #100197
2022-08-14Auto merge of #100429 - GuillaumeGomez:merge-html-elements-together, r=notriddlebors-59/+216
rustdoc: Merge source code pages HTML elements together We realized that the HTML generated for the source code pages could be improved quite a lot. This PR is a first pass toward this goal. Some explanations: it merges similar classes elements (even when there are white characters in between). There is an exception to this: if this is an ident, I also merged it with "unclassified" elements. This part is up to debate and can be very easily removed as the check is performed in one place (in the `can_merge` function). EDIT: The `ident` is now only kept in the code for the `span` it contains but it is not rendered into the HTML. So now some numbers: For these ones, on each page, I run this JS: `document.getElementsByTagName('*').length`. The goal is to count the number of DOM elements. I took some pages that seemed big, but don't hesitate to check some others. | file name | before this PR | with this PR | diff | without ident | diff | |-|-|-|-|-|-| | std/lib.rs.html (source link on std crate page) | 3455 | 2776 | 20.7% | 2387 | 31% | | alloc/vec/mod.rs.html (source on Vec type page) | 11012 | 8084 | 26.6% | 6682 | 39.4% | | alloc/string.rs.html (source on String type page) | 10800 | 8214 | 24% | 6712 | 37.9% | | std/sync/mutex.rs.html (source on Mutex type page) | 2953 | 2403 | 18.7% | 2139 | 27.6% | You can test it [here](https://rustdoc.crud.net/imperio/merge-html-elements-together/src/std/lib.rs.html). cc `@jsha` r? `@notriddle`
2022-08-14Add tests for the drop behavior of some control flow constructsNilstrieb-0/+145
In #100513 it was shown that the drop behavior of let_chains is not correct currently. Since drop behavior is something pretty subtle, this adds explicit tests for the drop behavior of `if`, `if let` and `match` to make sure that it does not regress in the future. The `println!`s were left in to make debugging easier in case something goes wrong, but they are not required for the test.
2022-08-14Rollup merge of #100487 - tmiasko:assert-safe, r=petrochenkovDylan DPC-6/+6
`assert_{inhabited,zero_valid,uninit_valid}` intrinsics are safe Those intrinsics either panic or do nothing. They are safe.
2022-08-14Rollup merge of #100115 - obeis:issue-99910, r=cjgillotDylan DPC-0/+30
Suggest removing `let` if `const let` or `let const` is used Closes #99910
2022-08-14Rollup merge of #99861 - lcnr:orphan-check-cg, r=jackh726Dylan DPC-0/+29
orphan check: rationalize our handling of constants cc `@rust-lang/types` `@rust-lang/project-const-generics` on whether you agree with this reasoning. r? types
2022-08-14Rollup merge of #99582 - compiler-errors:issue-99566, r=cjgillotDylan DPC-0/+28
Delay a span bug if we see ty/const generic params during writeback Fixes #99566
2022-08-14Update rustdoc testsGuillaume Gomez-40/+41
2022-08-14Impl Debug for some structs of rustbuildohno418-1/+2
2022-08-14Remove the Clean traitGuillaume Gomez-4/+0
2022-08-14remove Clean trait implementation for hir::VariantGuillaume Gomez-9/+7
2022-08-14Don't generate ident elements as DOM nodesGuillaume Gomez-14/+23
2022-08-14Merge HTML elements in highlighting when they can be merged togetherGuillaume Gomez-8/+155
2022-08-14Auto merge of #100516 - compiler-errors:rollup-fgrfeb3, r=compiler-errorsbors-223/+719
Rollup of 8 pull requests Successful merges: - #99646 (Only point out a single function parameter if we have a single arg incompatibility) - #100299 (make `clean::Item::span` return `Option` instead of dummy span) - #100335 (Rustdoc-Json: Add `Path` type for traits.) - #100367 (Suggest the path separator when a dot is used on a trait) - #100431 (Enum variant ctor inherits the stability of the enum variant) - #100446 (Suggest removing a semicolon after impl/trait items) - #100468 (Use an extensionless `x` script for non-Windows) - #100479 (Argument type error improvements) Failed merges: - #100483 (Point to generic or arg if it's the self type of unsatisfied projection predicate) r? `@ghost` `@rustbot` modify labels: rollup
2022-08-13Rollup merge of #100479 - compiler-errors:argument-type-error-improvements, ↵Michael Goulet-16/+70
r=lcnr Argument type error improvements Motivated by this interesting code snippet: ```rust #[derive(Copy, Clone)] struct Wrapper<T>(T); fn foo(_: fn(i32), _: Wrapper<i32>) {} fn f(_: u32) {} fn main() { let w = Wrapper::<isize>(1isize); foo(f, w); } ``` Which currently errors like: ``` error[E0308]: arguments to this function are incorrect --> src/main.rs:10:5 | 10 | foo(f, w); | ^^^ - - expected `i32`, found `isize` | | | expected `i32`, found `u32` | = note: expected fn pointer `fn(i32)` found fn item `fn(u32) {f}` = note: expected struct `Wrapper<i32>` found struct `Wrapper<isize>` note: function defined here --> src/main.rs:4:4 | 4 | fn foo(_: fn(i32), _: Wrapper<i32>) {} | ^^^ ---------- --------------- ``` Specifically, that double `expected .. found ..` which is very difficult to correlate to the types in the arguments. Also, the fact that "expected `i32`, found `isize`" and the other argument mismatch label don't even really explain what's going on here. After this PR: ``` error[E0308]: arguments to this function are incorrect --> $DIR/two-mismatch-notes.rs:10:5 | LL | foo(f, w); | ^^^ | note: expected fn pointer, found fn item --> $DIR/two-mismatch-notes.rs:10:9 | LL | foo(f, w); | ^ = note: expected fn pointer `fn(i32)` found fn item `fn(u32) {f}` note: expected struct `Wrapper`, found a different struct `Wrapper` --> $DIR/two-mismatch-notes.rs:10:12 | LL | foo(f, w); | ^ = note: expected struct `Wrapper<i32>` found struct `Wrapper<isize>` note: function defined here --> $DIR/two-mismatch-notes.rs:4:4 | LL | fn foo(_: fn(i32), _: Wrapper<i32>) {} | ^^^ ---------- --------------- error: aborting due to previous error For more information about this error, try `rustc --explain E0308`. ``` Yeah, it's a bit verbose, but much clearer IMO. --- Open to discussions about how this could be further improved. Motivated by `@jyn514's` [tweet](https://mobile.twitter.com/joshuayn514/status/1558042020601634816) here.
2022-08-13Rollup merge of #100468 - cuviper:lazy-x, r=jyn514Michael Goulet-4/+4
Use an extensionless `x` script for non-Windows #99992 added `x.sh` and `x.ps1`, but this broke my lazy `./xTAB` habit that used to get me to `./x.py`. If we rename `x.sh` to `x`, then I can adjust to `./xSPACE` for the same number of characters typed. r? `@jyn514`
2022-08-13Rollup merge of #100446 - ↵Michael Goulet-0/+29
TaKO8Ki:suggest-removing-semicolon-after-impl-trait-items, r=compiler-errors Suggest removing a semicolon after impl/trait items fixes #99822
2022-08-13Rollup merge of #100431 - compiler-errors:enum-ctor-variant-stab, r=estebankMichael Goulet-0/+16
Enum variant ctor inherits the stability of the enum variant Fixes #100399 Fixes #100420 Context #71481 for why enum variants don't need stability
2022-08-13Rollup merge of #100367 - fmease:fix-100365, r=compiler-errorsMichael Goulet-37/+357
Suggest the path separator when a dot is used on a trait Fixes #100365. `@rustbot` label A-diagnostics r? diagnostics
2022-08-13Rollup merge of #100335 - aDotInTheVoid:rdj-resolved-path, r=GuillaumeGomezMichael Goulet-94/+96
Rustdoc-Json: Add `Path` type for traits. Avoids using `Type` for trait fields, as a trait must always be a path, and not any other kind of type. ``@rustbot`` modify labels: +A-rustdoc-json +T-rustdoc Closes #100106
2022-08-13Rollup merge of #100299 - compiler-errors:issue-100283, r=notriddleMichael Goulet-30/+40
make `clean::Item::span` return `Option` instead of dummy span Fixes #100283
2022-08-13Rollup merge of #99646 - compiler-errors:arg-mismatch-single-arg-label, ↵Michael Goulet-42/+107
r=estebank Only point out a single function parameter if we have a single arg incompatibility Fixes #99635
2022-08-14Auto merge of #100495 - RalfJung:miri, r=RalfJungbors-7/+7
update Miri Fixes https://github.com/rust-lang/rust/issues/100424
2022-08-13make clean::Item::span return option instead of dummy spanMichael Goulet-30/+40
2022-08-13Rollup merge of #100509 - BoxyUwU:merge_hrtb_with_higher_rank_trait_bound, ↵Michael Goulet-0/+0
r=compiler-errors merge two test directories that mean the same thing hopefully `hrtb` doesnt have a secret second meaning that i'm not aware of :laughing: r? `@compiler-errors`
2022-08-13Rollup merge of #100475 - chenyukang:fix-100461, r=fee1-deadMichael Goulet-0/+44
Give a helpful diagnostic when the next struct field has an attribute Fixes #100461
2022-08-13Rollup merge of #100464 - khyperia:lld-icf-on-windows, r=jyn514Michael Goulet-1/+6
Make `[rust] use-lld=true` work on windows Before, it would fail with "error: ignoring unknown argument '-Wl,--icf=all'" This option was introduced in https://github.com/rust-lang/rust/pull/99062 (well, technically https://github.com/rust-lang/rust/pull/99680) See zulip thread: https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/rust-lld.3A.20error.3A.20ignoring.20unknown.20argument.20'-Wl.2C--icf.3Dall'
2022-08-13Rollup merge of #100447 - GuillaumeGomez:rm-clean-impl, r=Dylan-DPCMichael Goulet-25/+33
Remove more Clean trait implementations Follow-up of https://github.com/rust-lang/rust/pull/99638. r? ``@Dylan-DPC``
2022-08-13Rollup merge of #100445 - krasimirgg:llvm-16-msan, r=tmiaskoMichael Goulet-1/+1
adapt test for msan message change LLVM commit https://github.com/llvm/llvm-project/commit/057cabd997aeaef136e1e14f2ee645bd5bb197dd removed the function from the msan error message. This adapts our test accordingly. Found via our experimental rust + llvm @ HEAD bot: https://buildkite.com/llvm-project/rust-llvm-integrate-prototype/builds/12634#018289fe-b0bc-4bab-89b3-fb1d4e38f6db
2022-08-13Rollup merge of #100438 - compiler-errors:issue-100360, r=lcnrMichael Goulet-0/+25
Erase regions better in `promote_candidate` Use `tcx.erase_regions` instead of manually walking through the substs.... this also makes the code slightly simpler :see_no_evil: Fixes #100360 Fixes #89851
2022-08-13Rollup merge of #100434 - compiler-errors:issue-100373, r=cjgillotMichael Goulet-0/+28
Fix HIR pretty printing of let else Fixes #100373 Fixes #99318 Fixes #99319
2022-08-13Rollup merge of #100355 - camelid:has2-rename, r=GuillaumeGomezMichael Goulet-304/+310
rustdoc: Rename `@has FILE PATTERN` to `@hasraw FILE PATTERN` Fixes #100354.
2022-08-13moveEllen-0/+0
2022-08-13Do not inline non-simple argument type errors into labelsMichael Goulet-13/+64
2022-08-13Label argument coercion errorsMichael Goulet-3/+6
2022-08-13update MiriRalf Jung-7/+7
2022-08-13use `span_suggestion` instead of `span_suggestion_verbose`Takayuki Maeda-7/+4
2022-08-13rustdoc: Fix incorrect usage of `@!has` and `@!matches`Noah Lev-22/+24
`@!has` (and `@!matches`) with two arguments used to treat the second argument as a literal string of HTML code. Now, that feature has been renamed into `@!hasraw` (and `@!matchesraw`), and the arity-2 `@!has` version is an error. These uses thought the second argument was being treated as an XPath, as with the arity-3 version, but in fact was being treated as literal HTML. Because these were checking for the *absence* of the string, the tests silently did nothing -- an XPath string won't ever be showing up in the test's generated HTML!
2022-08-13Update `@!has` name in testsNoah Lev-127/+127
2022-08-13give a helpful diagnostic even when the next struct field has an attributeyukang-0/+44
2022-08-13Fix line lengthsNoah Lev-3/+7
2022-08-13Rename `@hastext` to `@hasraw` (same for `matches`)Noah Lev-175/+175
I think `@hasraw` is slightly clearer than `@hastext` since it is actually matching against the raw HTML, not the text nodes.
2022-08-13Update tests: arity-2 `@{has,matches}` -> `...text`Noah Lev-168/+168
2022-08-13Rename `@{has,matches}-literal` to `...text`Noah Lev-7/+7
Reasons: 1. It's shorter. 2. `@matches-literal` seems to contradict itself: a regex is intrinsically not a literal match, while it is still a textual match.
2022-08-13Use different name for arity-2 `@has` and `@matches`Noah Lev-9/+9
See #100354 for the rationale.
2022-08-13Auto merge of #100341 - andrewpollack:fuchsia-llvm-libunwind, r=tmandrybors-7/+5
Use llvm-libunwind="in-tree" for Fuchsia targets With updates to Fuchsia CI's Zircon libraries #99833, we can introduce `llvm-libunwind="in-tree"` for Fuchsia targets. This PR restores functionality removed from https://github.com/rust-lang/rust/pull/93604#issuecomment-1136515651. cc `@tmandry` `@djkoloski`