about summary refs log tree commit diff
path: root/src
AgeCommit message (Collapse)AuthorLines
2022-01-17Rollup merge of #92937 - GuillaumeGomez:dot-separator, r=jshaMatthias Krüger-3/+38
rustdoc: Add missing dot separator Fixes #92901. ![Screenshot from 2022-01-15 17-47-18](https://user-images.githubusercontent.com/3050060/149631249-e2c0c3a4-9ed8-48e2-92cc-79a5bb347b35.png) r? ``@jsha``
2022-01-17Rollup merge of #92876 - compiler-errors:fix-turbofish-lifetime-suggestion, ↵Matthias Krüger-44/+85
r=nagisa Fix suggesting turbofish with lifetime arguments Now we suggest turbofish correctly given exprs like `foo<'_>`. Also fix suggestion when we have `let x = foo<bar, baz>;` which was broken.
2022-01-17Rollup merge of #92819 - euclio:atty, r=CraftSpiderMatthias Krüger-41/+16
rustdoc: remove hand-rolled isatty This PR replaces bindings to the platform-specific isatty APIs with the `isatty` crate, as done elsewhere in the repository.
2022-01-17Rollup merge of #92808 - ↵Matthias Krüger-10/+31
compiler-errors:wrap-struct-shorthand-field-in-variant, r=davidtwco Fix `try wrapping expression in variant` suggestion with struct field shorthand Fixes a broken suggestion: [playground](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=83fe2dbfe1485f8cfca1aef2a6582e77) before: ``` error[E0308]: mismatched types --> src/main.rs:7:19 | 7 | let x = Foo { bar }; | ^^^ expected enum `Option`, found integer | = note: expected enum `Option<i32>` found type `{integer}` help: try wrapping the expression in `Some` | 7 | let x = Foo { Some(bar) }; | +++++ + ``` after: ``` error[E0308]: mismatched types --> src/main.rs:7:19 | 7 | let x = Foo { bar }; | ^^^ expected enum `Option`, found integer | = note: expected enum `Option<i32>` found type `{integer}` help: try wrapping the expression in `Some` | 7 | let x = Foo { bar: Some(bar) }; | ~~~~~~~~~~~~~~ ``` r? ``@m-ou-se`` since you touched the code last in #91080
2022-01-17Rollup merge of #92799 - rust-lang:followup-from-92533, r=Aaron1011Matthias Krüger-7/+3
Remove some unnecessary uses of `FieldDef::ident` Followup from #92533. cc ``@Aaron1011`` ``@petrochenkov``
2022-01-17Rollup merge of #92795 - jsha:link-to-top, r=GuillaumeGomezMatthias Krüger-1/+8
Link sidebar "location" heading to top of page This makes it easy, when you are scrolled far down in a page, to jump back to the top. Demo: https://rustdoc.crud.net/jsha/link-to-top/std/string/struct.String.html r? ``@GuillaumeGomez``
2022-01-16Auto merge of #92935 - Xanewok:update-rls, r=pietroalbinibors-1/+0
Update RLS and drop rustc-ap-packages Closes #91543 r? `@pietroalbini` cc `@calebcartwright` `@flip1995`
2022-01-16Rollup merge of #92792 - mdibaiee:92662/fix-intra-doc-generics, r=camelidMatthias Krüger-3/+54
rustdoc: fix intra-link for generic trait impls fixes #92662 r? `````@camelid`````
2022-01-16Rollup merge of #92746 - estebank:question-mark-in-type, r=davidtwcoMatthias Krüger-34/+68
Parse `Ty?` as `Option<Ty>` and provide structured suggestion Swift has specific syntax that desugars to `Option<T>` similar to our `?` operator, which means that people might try to use it in Rust. Parse it and gracefully recover.
2022-01-16Rollup merge of #92710 - jackh726:issue-92280, r=nikomatsakisMatthias Krüger-0/+73
Include Projections when elaborating TypeOutlives Fixes #92280 In `Elaborator`, we elaborate that `Foo<<Bar as Baz>::Assoc>: 'a` -> `<Bar as Baz>::Assoc: 'a`. This is the same rule that would be applied to any other `Param`. If there are escaping vars, we continue to do nothing. r? `@nikomatsakis`
2022-01-16Rollup merge of #92646 - mdibaiee:76935/pass-by-value, r=lcnrMatthias Krüger-105/+245
feat: rustc_pass_by_value lint attribute Useful for thin wrapper attributes that are best passed as value instead of reference. Fixes #76935
2022-01-16Rollup merge of #92635 - camelid:yet-more-cleanup, r=ManishearthMatthias Krüger-163/+182
rustdoc: Yet more intra-doc links cleanup r? `@Manishearth`
2022-01-16Rollup merge of #92487 - dtolnay:traitalias, r=matthewjasperMatthias Krüger-1/+1
Fix unclosed boxes in pretty printing of TraitAlias This was causing trait aliases to not even render at all in stringified / pretty printed output. ```rust macro_rules! repro { ($item:item) => { stringify!($item) }; } fn main() { println!("{:?}", repro!(pub trait Trait<T> = Sized where T: 'a;)); } ``` Before:&ensp;`""` After:&ensp;`"pub trait Trait<T> = Sized where T: 'a;"` The fix is copied from how `head`/`end` for `ItemKind::Use`, `ItemKind::ExternCrate`, and `ItemKind::Mod` are all done in the pretty printer: https://github.com/rust-lang/rust/blob/dd3ac41495e85a9b7b5cb3186379d02ce17e51fe/compiler/rustc_ast_pretty/src/pprust/state.rs#L1178-L1184
2022-01-16Use new Racer from crates.ioIgor Matuszewski-0/+0
2022-01-16Drop duplicate checks for now missing rustc_ast dep in tidyIgor Matuszewski-1/+0
2022-01-16Update RLS and drop rustc-ap-packagesIgor Matuszewski-0/+0
2022-01-16Auto merge of #92805 - BoxyUwU:revert-lazy-anon-const-substs, r=lcnrbors-63/+65
partially revertish `lazily "compute" anon const default substs` reverts #87280 except for some of the changes around `ty::Unevaluated` having a visitor and a generic for promoted why revert: <https://github.com/rust-lang/rust/pull/92805#issuecomment-1010736049> r? `@lcnr`
2022-01-16Auto merge of #92740 - cuviper:update-rayons, r=Mark-Simulacrumbors-17/+14
Update rayon and rustc-rayon This updates rayon for various tools and rustc-rayon for the compiler's parallel mode. - rayon v1.3.1 -> v1.5.1 - rayon-core v1.7.1 -> v1.9.1 - rustc-rayon v0.3.1 -> v0.3.2 - rustc-rayon-core v0.3.1 -> v0.3.2 ... and indirectly, this updates all of crossbeam-* to their latest versions. Fixes #92677 by removing crossbeam-queue, but there's still a lingering question about how tidy discovers "runtime" dependencies. None of this is truly in the standard library's dependency tree at all.
2022-01-15Add nll revision for issue-92096 test that passesJack Huey-7/+9
2022-01-16Auto merge of #92598 - Badel2:panic-update-hook, r=yaahcbors-0/+36
Implement `panic::update_hook` Add a new function `panic::update_hook` to allow creating panic hooks that forward the call to the previously set panic hook, without race conditions. It works by taking a closure that transforms the old panic hook into a new one, while ensuring that during the execution of the closure no other thread can modify the panic hook. This is a small function so I hope it can be discussed here without a formal RFC, however if you prefer I can write one. Consider the following example: ```rust let prev = panic::take_hook(); panic::set_hook(Box::new(move |info| { println!("panic handler A"); prev(info); })); ``` This is a common pattern in libraries that need to do something in case of panic: log panic to a file, record code coverage, send panic message to a monitoring service, print custom message with link to github to open a new issue, etc. However it is impossible to avoid race conditions with the current API, because two threads can execute in this order: * Thread A calls `panic::take_hook()` * Thread B calls `panic::take_hook()` * Thread A calls `panic::set_hook()` * Thread B calls `panic::set_hook()` And the result is that the original panic hook has been lost, as well as the panic hook set by thread A. The resulting panic hook will be the one set by thread B, which forwards to the default panic hook. This is not considered a big issue because the panic handler setup is usually run during initialization code, probably before spawning any other threads. Using the new `panic::update_hook` function, this race condition is impossible, and the result will be either `A, B, original` or `B, A, original`. ```rust panic::update_hook(|prev| { Box::new(move |info| { println!("panic handler A"); prev(info); }) }); ``` I found one real world use case here: https://github.com/dtolnay/proc-macro2/blob/988cf403e741aadfd5340bbf67e35e1062a526aa/src/detection.rs#L32 the workaround is to detect the race condition and panic in that case. The pattern of `take_hook` + `set_hook` is very common, you can see some examples in this pull request, so I think it's natural to have a function that combines them both. Also using `update_hook` instead of `take_hook` + `set_hook` reduces the number of calls to `HOOK_LOCK.write()` from 2 to 1, but I don't expect this to make any difference in performance. ### Unresolved questions: * `panic::update_hook` takes a closure, if that closure panics the error message is "panicked while processing panic" which is not nice. This is a consequence of holding the `HOOK_LOCK` while executing the closure. Could be avoided using `catch_unwind`? * Reimplement `panic::set_hook` as `panic::update_hook(|_prev| hook)`?
2022-01-15Return a LocalDefId in get_parent_item.Camille GILLOT-42/+44
2022-01-15Fix broken linkNoah Lev-1/+1
2022-01-15Add test for dot separatorGuillaume Gomez-0/+31
2022-01-15Fix missing dot separatorGuillaume Gomez-3/+7
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 #92767 - arlosi:pdbenum, r=cuviperMatthias Krüger-0/+0
Use the new language identifier for Rust in the PDB debug format Rust currently identifies as MASM (Microsoft Assembler) in the PDB debug info format on Windows because no identifier was available. This change pulls in a cherry-pick to Rust's LLVM that includes the change to use the new identifier for Rust. https://docs.microsoft.com/en-us/visualstudio/debugger/debug-interface-access/cv-cfl-lang
2022-01-14Don't use source-map when detecting struct field shorthandMichael Goulet-2/+2
2022-01-14Fix `try wrapping expression in variant` suggestion with struct field shorthandMichael Goulet-9/+30
2022-01-15Auto merge of #92915 - matthiaskrgr:rollup-pxxk8jp, r=matthiaskrgrbors-32/+66
Rollup of 9 pull requests Successful merges: - #92191 (Prefer projection candidates instead of param_env candidates for Sized predicates) - #92382 (Extend const_convert to rest of blanket core::convert impls) - #92625 (Add `#[track_caller]` to `mirbug`) - #92684 (Export `tcp::IntoIncoming`) - #92743 (Use pre-interned symbols in a couple of places) - #92838 (Clean up some links in RELEASES) - #92868 (librustdoc: Address some clippy lints) - #92875 (Make `opt_const_param_of` work in the presence of `GenericArg::Infer`) - #92891 (Add myself to .mailmap) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
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 #92868 - pierwill:librustdoc-clippy, r=camelidMatthias Krüger-13/+11
librustdoc: Address some clippy lints
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-15Auto merge of #92912 - calebcartwright:rustfmt-generated-files, ↵bors-5/+25
r=Mark-Simulacrum resolve rustfmt issue with generated files Discussed in https://rust-lang.zulipchat.com/#narrow/stream/241545-t-release/topic/1.2E58.20patch.20release refs https://github.com/rust-lang/rustfmt/issues/5080#issuecomment-1013303455 and https://github.com/rust-lang/rustfmt/issues/5172 updating in-tree vs. subtree sync to make backporting easier, would like to nominate backporting to both beta/1.59 as well as the 1.58.1 patch release
2022-01-15nyahggdshjjghsdfhgsfEllen-9/+7
2022-01-15initial revertEllen-64/+68
2022-01-14fix(rustfmt): resolve generated file formatting issueCaleb Cartwright-5/+25
2022-01-14Do not fail evaluation in const blocksMichael Goulet-0/+38
2022-01-14Auto merge of #91948 - nnethercote:rustdoc-more-Symbols, r=GuillaumeGomezbors-169/+255
rustdoc: avoid many `Symbol` to `String` conversions. Particularly when constructing file paths and fully qualified paths. This avoids a lot of allocations, speeding things up on almost all examples. r? `@GuillaumeGomez`
2022-01-14Document and test `UrlPartsBuilder::push_fmt`Noah Lev-0/+23
2022-01-14Make `AVG_PART_LENGTH` a power of 2Noah Lev-3/+10
I seem to recall that in general, it's best to request an allocation with a size that's a power of 2. The low estimate of 5 was probably a little too low as well.
2022-01-14Estimate path length instead of hardcoding 64 bytesNoah Lev-2/+10
2022-01-14Use UrlPartsBuilder and remove `join_with_slash`Noah Lev-36/+16
2022-01-14rustdoc: remove some unnecessary sigils.Nicholas Nethercote-1/+1
2022-01-14rustdoc: remove many unnecessary `.as_ref()` calls.Nicholas Nethercote-38/+29
2022-01-14rustdoc: avoid many `Symbol` to `String` conversions.Nicholas Nethercote-120/+197
Particularly when constructing file paths and fully qualified paths. This avoids a lot of allocations, speeding things up on almost all examples.
2022-01-14Link sidebar "location" heading to top of pageJacob Hoffman-Andrews-1/+8
This makes it easy, when you are scrolled far down in a page, to jump back to the top.
2022-01-14Auto merge of #92883 - matthiaskrgr:rollup-uoudywx, r=matthiaskrgrbors-1707/+3428
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