about summary refs log tree commit diff
path: root/src/test
AgeCommit message (Collapse)AuthorLines
2022-06-02Auto merge of #97293 - est31:remove_box, r=oli-obkbors-1/+1
Add #[rustc_box] and use it inside alloc This commit adds an alternative content boxing syntax, and uses it inside alloc. ```Rust #![feature(box_syntax)] fn foo() { let foo = box bar; } ``` is equivalent to ```Rust #![feature(rustc_attrs)] fn foo() { let foo = #[rustc_box] Box::new(bar); } ``` The usage inside the very performance relevant code in liballoc is the only remaining relevant usage of box syntax in the compiler (outside of tests, which are comparatively easy to port). box syntax was originally designed to be used by all Rust developers. This introduces a replacement syntax more tailored to only being used inside the Rust compiler, and with it, lays the groundwork for eventually removing box syntax. [Earlier work](https://github.com/rust-lang/rust/pull/87781#issuecomment-894714878) by `@nbdd0121` to lower `Box::new` to `box` during THIR -> MIR building ran into borrow checker problems, requiring the lowering to be adjusted in a way that led to [performance regressions](https://github.com/rust-lang/rust/pull/87781#issuecomment-894872367). The proposed change in this PR lowers `#[rustc_box] Box::new` -> `box` in the AST -> HIR lowering step, which is way earlier in the compiler, and thus should cause less issues both performance wise as well as regarding type inference/borrow checking/etc. Hopefully, future work can move the lowering further back in the compiler, as long as there are no performance regressions.
2022-06-02make cenum_impl_drop_cast deny-by-default and show up as future breakage ↵Ralf Jung-1/+16
diagnostic
2022-06-02Basic compiler infraCaio-0/+26
2022-06-02fix wrong suggestion for adding where clausesTakayuki Maeda-0/+24
2022-06-02Add regression test for json reexport bugGuillaume Gomez-0/+17
2022-06-02don't use a `span_note` for ignored implslcnr-30/+5
2022-06-02Rollup merge of #97023 - cjgillot:uniform-anon, r=estebankDylan DPC-26/+384
Diagnose anonymous lifetimes errors more uniformly between async and regular fns Async fns and regular fns are desugared differently. For the former, we create a generic parameter at HIR level. For the latter, we just create an anonymous region for typeck. I plan to migrate regular fns to the async fn desugaring. Before that, this PR attempts to merge the diagnostics for both cases. r? ```@estebank```
2022-06-02rebaselcnr-0/+1
2022-06-02remove unnecessary changelcnr-8/+8
2022-06-02`generic_arg_contains_target`: ignore closureslcnr-24/+14
2022-06-02use verbose suggestionslcnr-8/+24
2022-06-02add new `emit_inference_failure_err`lcnr-606/+1273
2022-06-02Revert #96682.Nicholas Nethercote-86/+59
The change was "Show invisible delimiters (within comments) when pretty printing". It's useful to show these delimiters, but is a breaking change for some proc macros. Fixes #97608.
2022-06-01Make output more specificEsteban Küber-215/+346
2022-06-01Add test for anonymous reexportsGuillaume Gomez-0/+22
2022-06-02Rollup merge of #97626 - RalfJung:expose, r=tmiaskoYuki Okushi-4/+4
rename PointerAddress → PointerExposeAddress `PointerAddress` sounds a bit too much like `ptr.addr()`, but this corresponds to `ptr.expose_addr()`. r? `@tmiasko`
2022-06-02Rollup merge of #97613 - jsha:implementation-is-on-local-type, r=GuillaumeGomezYuki Okushi-1/+1
rustdoc: Improve calculation of "Impls on Foreign Types" The existing code to calculate whether an implementation was on a "Foreign Type" was duplicated across the sidebar generation and the page generation. It also came to the wrong conclusion for some cases where both the trait and the "for" type were re-exports. This PR extracts the logic into a method of `Impl`, breaks it into a multi-line method so it can be commented, and adds a case for when the trait and the "for" type came from the same crate. This fixes some cases - like the platform-specific integer types (`__m256`, `__m128`, etc). But it doesn't fix all cases. See the screenshots below. [Before](https://doc.rust-lang.org/nightly/std/clone/trait.Clone.html#foreign-impls): <img src="https://user-images.githubusercontent.com/220205/171338226-59ce6daf-3d76-4bad-bc8d-72a8259a8f43.png" width=200> [After](https://rustdoc.crud.net/jsha/implementation-is-on-local-type/std/clone/trait.Clone.html): <img src="https://user-images.githubusercontent.com/220205/171338147-28308a65-1597-4223-be47-9550062404dd.png" width=200> The remaining types (`CString`, `NulError`, etc) are all from the `alloc` crate, while the `Clone` trait is from the `core` crate. Since `CString` and `Clone` are both re-exported by `std`, they are logically local to each other, but I couldn't figure out a good way to detect that in this code. I figure this is still a good step forward. Related: #97610 r? `@camelid`
2022-06-02Rollup merge of #97605 - estebank:suggestion-filename, r=oli-obkYuki Okushi-0/+6
Mention filename in suggestion when it differs from primary span
2022-06-02Rollup merge of #97130 - notriddle:notriddle/collect-trait-impls-dup, ↵Yuki Okushi-0/+14
r=GuillaumeGomez rustdoc: avoid including impl blocks with filled-in generics Fixes #94937 # Before ![image](https://user-images.githubusercontent.com/1593513/168933282-02ccc4ae-9c89-4836-ba34-e2bd83946105.png) # After ![image](https://user-images.githubusercontent.com/1593513/168933255-4c17407d-d8d1-406e-87f5-9ea809437173.png)
2022-06-01Fix typoEsteban Küber-8/+8
2022-06-01update explicit impls error msglcnr-7/+7
2022-06-01rename PointerAddress → PointerExposeAddressRalf Jung-4/+4
2022-06-01rustdoc: add test case for auto traits on slice primitiveMichael Howell-0/+14
2022-06-01Fix testEsteban Küber-0/+5
2022-06-01More accurately handle suggestionsEsteban Küber-24/+26
* Confirm the path segment being modified is an `enum` * Check whether type has type param before suggesting changing `Self` * Wording changes * Add clarifying comments * Suggest removing args from `Self` if the type doesn't have type params
2022-06-01Provide more context when denying invalid type paramsEsteban Küber-79/+418
2022-06-01Auto merge of #97624 - matthiaskrgr:rollup-rtcqjx9, r=matthiaskrgrbors-5/+446
Rollup of 4 pull requests Successful merges: - #96271 (suggest `?` when method is missing on `Result<T, _>` but found on `T`) - #97264 (Suggest `extern crate foo` when failing to resolve `use foo`) - #97592 (rustdoc: also index impl trait and raw pointers) - #97621 (update Miri) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-06-01Mention filename in suggestion when it differs from primary spanEsteban Küber-0/+6
2022-06-01Improve calculation of "Impls on Foreign Types"Jacob Hoffman-Andrews-1/+1
2022-06-01Rollup merge of #97592 - notriddle:notriddle/impl-trait, r=GuillaumeGomezMatthias Krüger-0/+151
rustdoc: also index impl trait and raw pointers Revives #92339
2022-06-01Rollup merge of #97264 - ↵Matthias Krüger-5/+78
TaKO8Ki:suggest-extern-crate-when-failing-to-resolve-use-crate, r=estebank Suggest `extern crate foo` when failing to resolve `use foo` closes #97095 r? ``@estebank``
2022-06-01Rollup merge of #96271 - compiler-errors:suggest-question-mark, r=estebankMatthias Krüger-0/+217
suggest `?` when method is missing on `Result<T, _>` but found on `T` The wording needs help, I think. Fixes #95729
2022-06-01Rollup merge of #97580 - JohnTitor:issue-71546, r=compiler-errorsYuki Okushi-0/+39
Add regression test for #71546 Closes #71546 r? `@compiler-errors`
2022-06-01Rollup merge of #97470 - notriddle:notriddle/test-cases, r=GuillaumeGomezYuki Okushi-2/+47
rustdoc: add more test coverage https://github.com/rust-lang/rust/issues/91113
2022-06-01Add regression test for #71546Yuki Okushi-0/+39
2022-06-01Add #[rustc_box]est31-1/+1
This commit adds an alternative content boxing syntax, and uses it inside alloc. The usage inside the very performance relevant code in liballoc is the only remaining relevant usage of box syntax in the compiler (outside of tests, which are comparatively easy to port). box syntax was originally designed to be used by all Rust developers. This introduces a replacement syntax more tailored to only being used inside the Rust compiler, and with it, lays the groundwork for eventually removing box syntax.
2022-05-31Auto merge of #97582 - tmiasko:pointer-address-cast, r=oli-obkbors-4/+4
Add a pointer to address cast kind A pointer to address cast are often special-cased. Introduce a dedicated cast kind to make them easy distinguishable.
2022-05-31rustdoc: also index raw pointersMichael Howell-0/+79
Co-authored-by: Noah Lev <camelidcamel@gmail.com>
2022-05-31rustdoc: also index impl traitMichael Howell-0/+72
2022-05-31Auto merge of #97570 - JakobDegen:dse-test, r=tmiaskobors-326/+21
Fix TLS access mir opt test and remove stale files Thanks `@pietroalbini` for noticing that the TLS test was not doing what it was supposed to. Switched to `PreCodegen` because `SimplifyCfg` does not run on opt level 0. Also addresses the easy part of #97564 . r? rust-lang/mir-opt
2022-05-31Auto merge of #97419 - WaffleLapkin:const_from_ptr_range, r=oli-obkbors-0/+765
Make `from{,_mut}_ptr_range` const This PR makes the following APIs `const`: ```rust // core::slice pub const unsafe fn from_ptr_range<'a, T>(range: Range<*const T>) -> &'a [T]; pub const unsafe fn from_mut_ptr_range<'a, T>(range: Range<*mut T>) -> &'a mut [T]; ``` Tracking issue: #89792. Feature for `from_ptr_range` as a `const fn`: `slice_from_ptr_range_const`. Feature for `from_mut_ptr_range` as a `const fn`: `slice_from_mut_ptr_range_const`. r? `@oli-obk`
2022-05-31Add test for empty impl blocksGuillaume Gomez-0/+20
2022-05-31Rollup merge of #97371 - ChayimFriedman2:closure-non-block-add-semicolon, ↵Dylan DPC-0/+27
r=oli-obk Suggest adding a semicolon to a closure without block This transforms `|| expr` into `|| { expr; }`. Closes #97359.
2022-05-31Rollup merge of #97089 - GuillaumeGomez:improve-settings-theme-display, r=jshaDylan DPC-0/+60
Improve settings theme display This is a follow-up of #96958. In this PR, I changed how the theme radio buttons are displayed and improved their look as well. It now looks like this: ![Screenshot from 2022-05-17 20-46-20](https://user-images.githubusercontent.com/3050060/168887703-a01e3bd5-9644-4012-ac11-2ae7bacd6be6.png) ![Screenshot from 2022-05-17 20-46-12](https://user-images.githubusercontent.com/3050060/168887707-132f8b2d-1163-462f-b7dd-f861121bdee7.png) You can test it [here](https://rustdoc.crud.net/imperio/improve-settings-theme-display/doc/foo/index.html). r? `@jsha`
2022-05-31Auto merge of #97566 - compiler-errors:rollup-qfxw4j8, r=compiler-errorsbors-9/+68
Rollup of 6 pull requests Successful merges: - #89685 (refactor: VecDeques Iter fields to private) - #97172 (Optimize the diagnostic generation for `extern unsafe`) - #97395 (Miri call ABI check: ensure type size+align stay the same) - #97431 (don't do `Sized` and other return type checks on RPIT's real type) - #97555 (Source code page: line number click adds `NaN`) - #97558 (Fix typos in comment) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-05-31Add a pointer to address cast kindTomasz Miąsko-4/+4
A pointer to address cast are often special-cased. Introduce a dedicated cast kind to make them easy distinguishable.
2022-05-31normalize harderMaybe Waffle-58/+59
2022-05-30Fix TLS access mir opt test and remove stale filesJakob Degen-326/+21
2022-05-30Rollup merge of #97555 - GuillaumeGomez:line-number-click, r=notriddleMichael Goulet-3/+13
Source code page: line number click adds `NaN` When you click on the parent element of the line numbers in the source code pages, it'll add `NaN` (like in https://doc.rust-lang.org/nightly/src/alloc/lib.rs.html#NaN). This PR fixes this bug. cc ``@jsha`` r? ``@notriddle``
2022-05-30Rollup merge of #97431 - compiler-errors:issue-97413, r=oli-obkMichael Goulet-0/+18
don't do `Sized` and other return type checks on RPIT's real type Fixes an ICE where we're doing `Sized` check against the RPIT's real type, instead of against the opaque type. This differs from what we're doing in MIR typeck, which causes ICE #97226. This regressed in #96516 -- this adjusts that fix to be a bit more conservative. That PR was backported and thus the ICE is also present in stable. Not sure if it's worth to beta and/or stable backport, probably not the latter but I could believe the former. r? `@oli-obk` cc: another attempt to fix this ICE #97413. I believe this PR addresses the root cause.