about summary refs log tree commit diff
path: root/src/test
AgeCommit message (Collapse)AuthorLines
2022-01-15Auto merge of #92441 - cjgillot:resolve-trait-impl-item, r=matthewjasperbors-251/+260
Link impl items to corresponding trait items in late resolver. Hygienically linking trait impl items to declarations in the trait can be done directly by the late resolver. In fact, it is already done to diagnose unknown items. This PR uses this resolution work and stores the `DefId` of the trait item in the HIR. This avoids having to do this resolution manually later. r? `@matthewjasper` Related to #90639. The added `trait_item_id` field can be moved to `ImplItemRef` to be used directly by your PR.
2022-01-15Rollup merge of #92892 - compiler-errors:const-param-env-for-const-block, ↵Matthias Krüger-0/+38
r=fee1-dead Do not fail evaluation in const blocks Evaluate const blocks with a const param-env, so we properly check `~const` trait bounds. Fixes #92713 (I will fix the poor diagnostics in #92713 and #92712 in a separate PR) cc `@nbdd0121` who wrote the code this PR touches in #89561
2022-01-15Rollup merge of #92873 - eholk:async-symbol-names, r=tmandryMatthias Krüger-2/+2
Generate more precise generator names Currently all generators are named with a `generator$N` suffix, regardless of where they come from. This means an `async fn` shows up as a generator in stack traces, which can be surprising to async programmers since they should not need to know that async functions are implementated using generators. This change generators a different name depending on the generator kind, allowing us to tell whether the generator is the result of an async block, an async closure, an async fn, or a plain generator. r? `@tmandry` cc `@michaelwoerister` `@wesleywiser` `@dpaoliello`
2022-01-15Rollup merge of #92865 - jackh726:gats-outlives-no-static, r=nikomatsakisMatthias Krüger-0/+13
Ignore static lifetimes for GATs outlives lint cc https://github.com/rust-lang/rust/issues/87479#issuecomment-1010484170 Also included a bit of cleanup of `ty_known_to_outlive` and `region_known_to_outlive` r? `@nikomatsakis`
2022-01-15Rollup merge of #92875 - BoxyUwU:infer_arg_opt_const_param_of, r=lcnrMatthias Krüger-11/+15
Make `opt_const_param_of` work in the presence of `GenericArg::Infer` highly recommend viewing the first and second commits on their own rather than looking at file changes :rofl: Because we filtered args down to just const args we would ignore `GenericArg::Infer` which made us get a `arg_index` which was wrong by however many const `GenericArg::Infer` came previously [example](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=46dba6a53aca6333028a10908ef16e0b) of the [bugs](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=a8eebced26eefa4119fc2e7ae0c76de6) fixed. r? ```@lcnr```
2022-01-15Rollup merge of #92191 - jackh726:issue-89352, r=nikomatsakisMatthias Krüger-8/+40
Prefer projection candidates instead of param_env candidates for Sized predicates Fixes #89352 Also includes some drive by logging and verbose printing changes that I found useful when debugging this, but I can remove this if needed. This is a little hacky - but imo no more than the rest of `candidate_should_be_dropped_in_favor_of`. Importantly, in a Chalk-like world, both candidates should be completely compatible. r? ```@nikomatsakis```
2022-01-14Do not fail evaluation in const blocksMichael Goulet-0/+38
2022-01-14Auto merge of #92883 - matthiaskrgr:rollup-uoudywx, r=matthiaskrgrbors-17/+69
Rollup of 9 pull requests Successful merges: - #92045 (Don't fall back to crate-level opaque type definitions.) - #92381 (Suggest `return`ing tail expressions in async functions) - #92768 (Partially stabilize `maybe_uninit_extra`) - #92810 (Deduplicate box deref and regular deref suggestions) - #92818 (Update documentation for doc_cfg feature) - #92840 (Fix some lints documentation) - #92849 (Clippyup) - #92854 (Use the updated Rust logo in rustdoc) - #92864 (Fix a missing dot in the main item heading) Failed merges: - #92838 (Clean up some links in RELEASES) r? `@ghost` `@rustbot` modify labels: rollup
2022-01-14Rollup merge of #92810 - compiler-errors:deduplicate-box-deref-suggestion, ↵Matthias Krüger-15/+27
r=camelid Deduplicate box deref and regular deref suggestions Remove the suggestion code special-cased for Box deref. r? ```@camelid``` since you introduced the code in #90627
2022-01-14Rollup merge of #92381 - ThePuzzlemaker:issue-92308, r=estebankMatthias Krüger-2/+42
Suggest `return`ing tail expressions in async functions This PR fixes #92308. Previously, the suggestion to `return` tail expressions (introduced in #81769) did not apply to `async` functions, as the suggestion checked whether the types were equal disregarding `impl Future<Output = T>` syntax sugar for `async` functions. This PR changes that in order to fix a potential papercut. I'm not sure if this is the "right" way to do this, so if there is a better way then please let me know. I amended an existing test introduced in #81769 to add a regression test for this, if you think I should make a separate test I will.
2022-01-14Auto merge of #92781 - lambinoo:I-92755-no-mir-missing-reachable, r=petrochenkovbors-0/+27
Set struct/union/enum fields/variants as reachable when item is Fixes #92755
2022-01-14Auto merge of #92844 - matthiaskrgr:rollup-z5wb6yi, r=matthiaskrgrbors-76/+64
Rollup of 9 pull requests Successful merges: - #90001 (Make rlib metadata strip works with MIPSr6 architecture) - #91687 (rustdoc: do not emit tuple variant fields if none are documented) - #91938 (Add `std::error::Report` type) - #92006 (Welcome opaque types into the fold) - #92142 ([code coverage] Fix missing dead code in modules that are never called) - #92277 (rustc_metadata: Stop passing `CrateMetadataRef` by reference (step 1)) - #92334 (rustdoc: Preserve rendering of macro_rules matchers when possible) - #92807 (Update cargo) - #92832 (Update RELEASES for 1.58.) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-01-14fix: set struct/union/enum fields/variants as reachable when item isLamb-0/+27
2022-01-14fix bugEllen-11/+15
2022-01-13Fix non-MSVC testEric Holk-1/+1
2022-01-13Generate more precise generator namesEric Holk-1/+1
Currently all generators are named with a `generator$N` suffix, regardless of where they come from. This means an `async fn` shows up as a generator in stack traces, which can be surprising to async programmers since they should not need to know that async functions are implementated using generators. This change generators a different name depending on the generator kind, allowing us to tell whether the generator is the result of an async block, an async closure, an async fn, or a plain generator.
2022-01-13Ignore static lifetimes for GATs outlives lintJack Huey-0/+13
2022-01-13Auto merge of #89861 - nbdd0121:closure, r=wesleywiserbors-28/+101
Closure capture cleanup & refactor Follow up of #89648 Each commit is self-contained and the rationale/changes are documented in the commit message, so it's advisable to review commit by commit. The code is significantly cleaner (at least IMO), but that could have some perf implication, so I'd suggest a perf run. r? `@wesleywiser` cc `@arora-aman`
2022-01-13Rollup merge of #92334 - dtolnay:rustdocmatcher, r=camelid,GuillaumeGomezMatthias Krüger-16/+30
rustdoc: Preserve rendering of macro_rules matchers when possible Fixes #92331. This approach restores the behavior prior to #86282 **if** the matcher token held by the compiler **and** the matcher token found in the source code are identical TokenTrees. Thus #86208 remains fixed, but without regressing formatting for the vast majority of macros which are not macro-generated.
2022-01-13Rollup merge of #92142 - wesleywiser:fix_codecoverage_partitioning, r=tmandryMatthias Krüger-1/+14
[code coverage] Fix missing dead code in modules that are never called The issue here is that the logic used to determine which CGU to put the dead function stubs in doesn't handle cases where a module is never assigned to a CGU (which is what happens when all of the code in the module is dead). The partitioning logic also caused issues in #85461 where inline functions were duplicated into multiple CGUs resulting in duplicate symbols. This commit fixes the issue by removing the complex logic used to assign dead code stubs to CGUs and replaces it with a much simpler model: we pick one CGU to hold all the dead code stubs. We pick a CGU which has exported items which increases the likelihood the linker won't throw away our dead functions and we pick the smallest to minimize the impact on compilation times for crates with very large CGUs. Fixes #91661 Fixes #86177 Fixes #85718 Fixes #79622 r? ```@tmandry``` cc ```@richkadel``` This PR is not urgent so please don't let it interrupt your holidays! 🎄 🎁
2022-01-13Rollup merge of #92006 - oli-obk:welcome_opaque_types_into_the_fold, ↵Matthias Krüger-57/+3
r=nikomatsakis Welcome opaque types into the fold r? ```@nikomatsakis``` because idk who else to bug on the type_op changes The commits have explanations in them. The TLDR is that * 5c4600227329a273c0c6c844e4a10ce650ead601 stops the "recurse and replace" scheme that replaces opaque types with their canonical inference var by just doing that ahead of time * bdeeb07bf6400622074f04ca2523dac1512ab662 does not affect anything on master afaict, but since opaque types generate obligations when instantiated, and lazy TAIT instantiates opaque types *everywhere*, we need to properly handle obligations here instead of just hoping no problematic obligations ever come up.
2022-01-13Rollup merge of #91687 - euclio:tuple-variant-field-section, r=GuillaumeGomezMatthias Krüger-2/+17
rustdoc: do not emit tuple variant fields if none are documented Fixes #90824. Before: ![2021-12-15T22:26:41](https://user-images.githubusercontent.com/1372438/146302871-4d265433-b9aa-4e53-adfb-e7cb92107180.png) After: ![2021-12-15T22:27:01](https://user-images.githubusercontent.com/1372438/146302872-e39eda3d-2fb2-4fb9-aae7-2008e4e1b4dd.png)
2022-01-12Bless tests.Camille GILLOT-199/+216
2022-01-12Err about fn traits in a single place.Camille GILLOT-30/+30
2022-01-12suggest deref/unboxing before wrapping variantMichael Goulet-4/+4
2022-01-12Rollup merge of #92764 - GuillaumeGomez:fix-rust-logo-style, r=jshaMatthias Krüger-0/+78
Fix rust logo style The style on the rust logo is currently broken: ![Screenshot from 2022-01-11 13-36-30](https://user-images.githubusercontent.com/3050060/148946754-a1a57253-bed0-44cf-a41c-83e0eecbd6b5.png) With this fix, we're back to normal: ![Screenshot from 2022-01-11 13-42-07](https://user-images.githubusercontent.com/3050060/148946778-99f44678-aac1-419f-bb8c-ffa837e0c1ee.png) I also used a GUI test to prevent future silent regressions. r? ```@jsha```
2022-01-12Rollup merge of #92699 - camelid:private-fields, r=jshaMatthias Krüger-6/+6
rustdoc: Display "private fields" instead of "fields omitted" Also: * Always use `/* */` block comments * Use the same message everywhere, rather than sometimes prefixing with "some" When I first read rustdoc docs, I was confused why the fields were being omitted. It was only later that I realized it was because they were private. It's also always bothered me that rustdoc sometimes uses `//` and sometimes uses `/*` comments for these messages, so this change makes them all use `/*`. Technically, I think fields can be omitted if they are public but `doc(hidden)` too, but `doc(hidden)` is analogous to privacy. It's really just used to emulate "doc privacy" when -- because of technical limitations -- an item has to be public. So I think it's fine to include this under the category of "private fields". r? ```@jsha```
2022-01-12Rollup merge of #92432 - fee1-dead:constck-impl-constness, r=oli-obkMatthias Krüger-0/+26
Error when selected impl is not const in constck Catches bad things when checking a `default_method_body_is_const` body, such as: ```rust self.map(/* .. */).is_sorted(); ``` When `Map` does not yet have a `const` `impl` for `Iterator`. r? ```@oli-obk```
2022-01-11Deduplicate box deref and regular deref suggestionsMichael Goulet-18/+30
2022-01-11rustdoc: do not emit tuple variant fields if none are documentedAndy Russell-2/+17
2022-01-11Auto merge of #90948 - oli-obk:🧹, r=nikomatsakisbors-1/+25
Actually instantiate the opaque type when checking bounds Before this change, `instantiate_opaque_types` was a no-op, because it only works relative to the defined opaque type inference anchor. If it is a no-op, the for loop will not actually have anything to iterate over, and thus nothing is checked at all.
2022-01-11Add testDeadbeef-0/+26
2022-01-11Add GUI test for rust logo style in the sidebarsGuillaume Gomez-0/+78
2022-01-10Ignore `unused_mod.rs` file in code coverage resultsWesley Wiser-10/+1
As discussed in https://github.com/rust-lang/rust/pull/92142#issuecomment-1008239473, tests that contain multiple files order their results differently on Windows and Linux which the test runner currently can't handle correctly. For now, ignore the "bin" part of the test and only include the unused library dependency which is what the test really cares about anyway.
2022-01-10Auto merge of #92719 - matthiaskrgr:rollup-tc7oqys, r=matthiaskrgrbors-27/+92
Rollup of 7 pull requests Successful merges: - #92248 (Normalize struct tail type when checking Pointee trait) - #92357 (Fix invalid removal of newlines from doc comments) - #92602 (Make source links look cleaner) - #92636 (Normalize generator-local types with unevaluated constants) - #92693 (Release notes: add `Result::unwrap_{,err_}unchecked`) - #92702 (Clean up lang_items::extract) - #92717 (update miri) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-01-10Rollup merge of #92636 - compiler-errors:normalize-generator-const-expr, ↵Matthias Krüger-0/+26
r=oli-obk Normalize generator-local types with unevaluated constants Normalize generator-interior types in addition to (i.e. instead of just) erasing regions, since sometimes we collect types with unevaluated const exprs. Fixes #84737 Fixes #88171 Fixes #92091 Fixes #92634 Probably also fixes #73114, but that one has no code I could test. It looks like it's the same issue, though.
2022-01-10Rollup merge of #92602 - jsha:source-link-2, r=GuillaumeGomezMatthias Krüger-25/+32
Make source links look cleaner Change from syntaxy-looking [src] to the plain word "source". Change the syntaxy-looking `[-]` at the top of the page to say "collapse". Reduce opacity of rightside content. Part of #59851 r? `@GuillaumeGomez` Demo: https://rustdoc.crud.net/jsha/source-link-2/std/string/struct.String.html [Discussed on Zulip](https://rust-lang.zulipchat.com/#narrow/stream/266220-rustdoc/topic/display.20of.20source.20link).
2022-01-10Rollup merge of #92357 - GuillaumeGomez:fix-doc-comment-backline-removal, ↵Matthias Krüger-2/+12
r=camelid Fix invalid removal of newlines from doc comments Fixes https://github.com/rust-lang/rust/issues/91201. Before: ![Screenshot from 2021-12-28 17-02-11](https://user-images.githubusercontent.com/3050060/147585187-c8e67531-c1b4-457d-9d30-d5b44bf91fea.png) After: ![Screenshot from 2021-12-28 17-02-25](https://user-images.githubusercontent.com/3050060/147585190-30aa0398-1fc7-4fe7-9e8b-5c475d4f9613.png) r? `@camelid`
2022-01-10Rollup merge of #92248 - compiler-errors:normalize-type-for-pointee, r=jackh726Matthias Krüger-0/+22
Normalize struct tail type when checking Pointee trait Let's go ahead and implement the FIXMEs by properly normalizing the struct-tail type when satisfying a Pointee obligation. This should fix the ICE when we try to calculate a layout depending on `<Ty as Pointee>::Metadata` later. Fixes #92128 Fixes #92577 Additionally, mark the obligation as ambiguous if there are any infer types in that struct-tail type. This has the effect of causing `<_ as Pointee>::Metadata` to be properly replaced with an infer variable ([here](https://github.com/rust-lang/rust/blob/master/compiler/rustc_trait_selection/src/traits/project.rs#L813)) and registered as an obligation... this turns out to be very important in unifying function parameters with formals that are assoc types. Fixes #91446
2022-01-09Compute most of Public/Exported access level in rustc_resolveLamb-0/+28
Mak DefId to AccessLevel map in resolve for export hir_id to accesslevel in resolve and applied in privacy using local def id removing tracing probes making function not recursive and adding comments Move most of Exported/Public res to rustc_resolve moving public/export res to resolve fix missing stability attributes in core, std and alloc move code to access_levels.rs return for some kinds instead of going through them Export correctness, macro changes, comments add comment for import binding add comment for import binding renmae to access level visitor, remove comments, move fn as closure, remove new_key fmt fix rebase fix rebase fmt fmt fix: move macro def to rustc_resolve fix: reachable AccessLevel for enum variants fmt fix: missing stability attributes for other architectures allow unreachable pub in rustfmt fix: missing impl access level + renaming export to reexport Missing impl access level was found thanks to a test in clippy
2022-01-09Display "private fields" instead of "fields omitted"Noah Lev-6/+6
Also: * Always use `/* */` block comments * Use the same message everywhere, rather than sometimes prefixing with "some" When I first read rustdoc docs, I was confused why the fields were being omitted. It was only later that I realized it was because they were private. It's also always bothered me that rustdoc sometimes uses `//` and sometimes uses `/*` comments for these messages, so this change makes them all use `/*`. Technically, I think fields can be omitted if they are public but `doc(hidden)` too, but `doc(hidden)` is analogous to privacy. It's really just used to emulate "doc privacy" when -- because of technical limitations -- an item has to be public. So I think it's fine to include this under the category of "private fields".
2022-01-09Auto merge of #92534 - Aaron1011:hash-hir, r=petrochenkovbors-2/+2
Hash `Ident` spans in all HIR structures This PR removes all of the `#[stable_hasher(project(name))]` attributes used in HIR structs. While these attributes are not known to be causing any issues in practice, we need to hash these in order for the incremental system to work correctly - a query could be otherwise be incorrectly marked green when a change occures in one of the `Span`s that it uses.
2022-01-09Rollup merge of #92510 - inquisitivecrystal:foreign-block, r=cjgillotMatthias Krüger-0/+33
Don't resolve blocks in foreign functions Although it is an error for a foreign function to have a block, it is still possible at the level of the AST. #74204 made AST lowering skip over blocks belonging to foreign functions, since they're invalid. However, resolve still treated these blocks normally, resulting in a mismatch between the HIR and resolve, which could cause an ICE under certain circumstances. This PR changes resolve to skip over blocks belonging to foreign functions, as AST lowering does. Fixes #91370. r? ``@cjgillot``
2022-01-09Rollup merge of #92490 - jsha:crates-in-results, r=GuillaumeGomezMatthias Krüger-7/+5
Move crate drop-down to search results page This reduces clutter on doc pages. Part of #59840 r? ```@GuillaumeGomez``` Demo: https://rustdoc.crud.net/jsha/crates-in-results/std/index.html?search=str
2022-01-08Link impl items to corresponding trait items in late resolver.Camille GILLOT-22/+14
2022-01-08Make source links look cleanerJacob Hoffman-Andrews-25/+32
Change from syntaxy-looking [src] to the plain word "source".
2022-01-07Flatten InferredCaptureInformationGary Guo-28/+101
Min capture computation can already handle the same place appearing twice, and previous commits made CaptureInfo construction very cheap, so just delegate all work to min capture and let InferBorrowKind and process_collected_capture_information handle everything linearly.
2022-01-07Update clippy for associated item changesMatthew Jasper-18/+18
2022-01-06Normalize generator-local types with unevaluated constantsMichael Goulet-0/+26
2022-01-06Rollup merge of #92417 - dtolnay:printimpl, r=jackh726Matthias Krüger-1/+7
Fix spacing and ordering of words in pretty printed Impl Follow-up to #92238 fixing one of the FIXMEs. ```rust macro_rules! repro { ($item:item) => { stringify!($item) }; } fn main() { println!("{}", repro!(impl<T> Struct<T> {})); println!("{}", repro!(impl<T> const Trait for T {})); } ``` Before:&ensp;`impl <T> Struct<T> {}` After:&ensp;`impl<T> Struct<T> {}` Before:&ensp;`impl const <T> Trait for T {}` :crying_cat_face: After:&ensp;`impl<T> const Trait for T {}`