about summary refs log tree commit diff
path: root/src
AgeCommit message (Collapse)AuthorLines
2022-06-16Auto merge of #98108 - SpriteOvO:doc_auto_cfg-feature-rmv-fix, ↵bors-12/+40
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-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-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-4/+27
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-10/+67
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-11/+19
2022-06-16Fix `cfg(not)` and `cfg(all)` causing Rustdoc stab to disappearSprite-7/+27
2022-06-15Auto merge of #95897 - AzureMarker:feature/horizon-std, r=nagisabors-1/+132
STD support for the Nintendo 3DS Rustc already supports compiling for the Nintendo 3DS using the `armv6k-nintendo-3ds` target (Tier 3). Until now though, only `core` and `alloc` were supported. This PR adds standard library support for the Nintendo 3DS. A notable exclusion is `std::thread` support, which will come in a follow-up PR as it requires more complicated changes. This has been a joint effort by `@Meziu,` `@ian-h-chamberlain,` myself, and prior work by `@rust3ds` members. ### Background The Nintendo 3DS (Horizon OS) is a mostly-UNIX looking system, with the caveat that it does not come with a full libc implementation out of the box. On the homebrew side (I'm not under NDA), the libc interface is partially implemented by the [devkitPro](https://devkitpro.org/wiki/devkitPro_pacman) toolchain and a user library like [`libctru`](https://github.com/devkitPro/libctru). This is important because there are [some possible legal barriers](https://github.com/rust-lang/rust/pull/88529#issuecomment-919938396) to linking directly to a library that uses the underlying platform APIs, since they might be considered a trade secret or under NDA. To get around this, the standard library impl for the 3DS does not directly depend on any platform-level APIs. Instead, it expects standard libc functions to be linked in. The implementation of these libc functions is left to the user. Some functions are provided by the devkitPro toolchain, but in our testing, we used the following to fill in the other functions: - [`libctru`] - provides more basic APIs, such as `nanosleep`. Linked in by way of [`ctru-sys`](https://github.com/Meziu/ctru-rs/tree/master/ctru-sys). - [`pthread-3ds`](https://github.com/Meziu/pthread-3ds) - provides pthread APIs for `std::thread`. Implemented using [`libctru`]. - [`linker-fix-3ds`](https://github.com/Meziu/rust-linker-fix-3ds) - fulfills some other missing libc APIs. Implemented using [`libctru`]. For more details, see the `src/doc/rustc/src/platform-support/armv6k-nintendo-3ds.md` file added in this PR. ### Notes We've already upstreamed changes to the [`libc`] crate to support this PR, as well as the upcoming threading PR. These changes have all been released as of 0.2.121, so we bump the crate version in this PR. Edit: After some rebases, the version bump has already been merged so it doesn't appear in this PR. A lot of the changes in this PR are straightforward, and follow in the footsteps of the ESP-IDF target: https://github.com/rust-lang/rust/pull/87666. The 3DS does not support user space process spawning, so these APIs are unimplemented (similar to ESP-IDF). [`libctru`]: https://github.com/devkitPro/libctru [`libc`]: https://github.com/rust-lang/libc
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-15Rollup merge of #98110 - cjgillot:closure-brace, r=Aaron1011Yuki Okushi-98/+112
Make `ExprKind::Closure` a struct variant. Simple refactor since we both need it to introduce additional fields in `ExprKind::Closure`. r? ``@Aaron1011``
2022-06-15Auto merge of #98123 - JohnTitor:rollup-rfg1a4s, r=JohnTitorbors-17/+127
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-11/+11
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-2/+2
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.
2022-06-15Refactor path segment parameter errorEdwinRy-20/+35
2022-06-14Remove `rustc_deprecated` diagnosticsJacob Pratt-198/+163
2022-06-14Auto merge of #96285 - flip1995:pk-vfe, r=nagisabors-0/+174
Introduce `-Zvirtual-function-elimination` codegen flag Fixes #68262 This PR adds a codegen flag `-Zvirtual-function-elimination` to enable the VFE optimization in LLVM. To make this work, additonal information has to be added to vtables ([`!vcall_visibility` metadata](https://llvm.org/docs/TypeMetadata.html#vcall-visibility-metadata) and a `typeid` of the trait). Furthermore, instead of just `load`ing functions, the [`llvm.type.checked.load` intrinsic](https://llvm.org/docs/LangRef.html#llvm-type-checked-load-intrinsic) has to be used to map functions to vtables. For technical details of the changes, see the commit messages. I also tested this flag on https://github.com/tock/tock on different boards to verify that this fixes the issue https://github.com/tock/tock/issues/2594. This flag is able to improve the size of the resulting binary by about 8k-9k bytes by removing the unused debug print functions. [Rendered documentation update](https://github.com/flip1995/rust/blob/pk-vfe/src/doc/rustc/src/codegen-options/index.md#virtual-function-elimination)
2022-06-14use unchecked mul to compute slice sizesErik Desjardins-0/+29
...since slice sizes can't signed wrap see https://doc.rust-lang.org/std/slice/fn.from_raw_parts.html > The total size len * mem::size_of::<T>() of the slice must be no larger than isize::MAX.
2022-06-14Add GUI test for sidebar items expand/collapseGuillaume Gomez-1/+24
2022-06-14btreemap-alloc: adjust ui testJacob Hughes-8/+8
2022-06-15add a test case for `decl_macro`Takayuki Maeda-3/+21
2022-06-14account for endianness in debuginfo for const argsb-naber-2/+2
2022-06-14rebaseb-naber-41/+113
2022-06-14fix wrong evaluation in clippyb-naber-8/+8
2022-06-14address reviewb-naber-54/+45
2022-06-14bless 32-bit ui testsb-naber-4/+10
2022-06-14manually bless 32-bit mir-opt testsb-naber-25/+25
2022-06-14address reviewb-naber-6/+6
2022-06-14fix clippy test failuresb-naber-64/+102
2022-06-14implement valtrees as the type-system representation for constant valuesb-naber-385/+519
2022-06-14Add VFE test for 32 bitflip1995-0/+36
The offset in the llvm.type.checked.load intrinsic differs on 32 bit platforms
2022-06-14Add user documentation for -Zvirtual-function-eliminationflip1995-0/+39
2022-06-14Add test for VFE optimizationflip1995-0/+99
2022-06-14Auto merge of #98091 - Dylan-DPC:rollup-ueb6b5x, r=Dylan-DPCbors-37/+161
Rollup of 5 pull requests Successful merges: - #97869 (BTree: tweak internal comments) - #97935 (Rename the `ConstS::val` field as `kind`.) - #97948 (lint: add diagnostic translation migration lints) - #98042 (Fix compat_fn option method on miri) - #98069 (rustdoc: remove link on slice brackets) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-06-14Fix expand/collapse on source viewer sidebar foldersGuillaume Gomez-3/+3
2022-06-14Rollup merge of #98069 - notriddle:notriddle/square-brackets, r=jshaDylan DPC-30/+5
rustdoc: remove link on slice brackets This is #91778, take two. Fixes #91173 The reason I'm reevaluating this change is #97668, which makes fully-generic slices link to the slice docs page. This fixes some downsides in the original PR, where `Box<[T]>`, for example, was not linked to the primitive.slice.html page. In this PR, the `[T]` inside is still a link. The other major reason for wanting to reevaluate this is the changed color scheme. When this feature was first introduced in rustdoc, primitives were a different color from structs and enums. This way, eagle-eyed users could figure out that the square brackets were separate links from the structs inside. Now, all types have the same color, so a significant fraction of users won't even know the links are there unless they pay close attention to the status bar or use an accessibility tool that lists all links on the page.
2022-06-14Rollup merge of #97948 - davidtwco:diagnostic-translation-lints, r=oli-obkDylan DPC-0/+149
lint: add diagnostic translation migration lints Introduce allow-by-default lints for checking whether diagnostics are written in `SessionDiagnostic` or `AddSubdiagnostic` impls and whether diagnostics are translatable. These lints can be denied for modules once they are fully migrated to impls and translation. These lints are intended to be temporary - once all diagnostics have been changed then we can just change the APIs we have and that will enforce these constraints thereafter. r? `````@oli-obk`````
2022-06-14Rollup merge of #97935 - nnethercote:rename-ConstS-val-as-kind, r=lcnrDylan DPC-7/+7
Rename the `ConstS::val` field as `kind`. And likewise for the `Const::val` method. Because its type is called `ConstKind`. Also `val` is a confusing name because `ConstKind` is an enum with seven variants, one of which is called `Value`. Also, this gives consistency with `TyS` and `PredicateS` which have `kind` fields. The commit also renames a few `Const` variables from `val` to `c`, to avoid confusion with the `ConstKind::Value` variant. r? `@BoxyUwU`
2022-06-14Auto merge of #98082 - lnicola:rust-analyzer-2022-06-14, r=lnicolabors-8/+8
:arrow_up: rust-analyzer r? `@ghost`
2022-06-14change edition to 2021Takayuki Maeda-1/+1
2022-06-14suggest adding a `#[macro_export]` to a private macroTakayuki Maeda-4/+32
2022-06-14Rename rustc_serialize::opaque::Encoder as MemEncoder.Nicholas Nethercote-11/+11
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.)