about summary refs log tree commit diff
path: root/src
AgeCommit message (Collapse)AuthorLines
2022-04-13Update cargoEric Huss-0/+0
2022-04-13Auto merge of #95968 - davidtwco:translation-lazy-fallback, r=oli-obkbors-17/+20
errors: lazily load fallback fluent bundle Addresses (hopefully) https://github.com/rust-lang/rust/pull/95667#issuecomment-1094794087. Loading the fallback bundle in compilation sessions that won't go on to emit any errors unnecessarily degrades compile time performance, so lazily create the Fluent bundle when it is first required. r? `@ghost` (just for perf initially)
2022-04-13Rollup merge of #95991 - PoorlyDefinedBehaviour:fix/issue_95898, r=fee1-deadDylan DPC-0/+24
fix: wrong trait import suggestion for T: The suggestion to bound `T` had an extra `:`. ```rust fn foo<T:>(t: T) { t.clone(); } ``` ``` error[E0599]: no method named `clone` found for type parameter `T` in the current scope --> src/lib.rs:2:7 | 2 | t.clone(); | ^^^^^ method not found in `T` | = help: items from traits can only be used if the type parameter is bounded by the trait help: the following trait defines an item `clone`, perhaps you need to restrict type parameter `T` with it: | 1 | fn foo<T: Clone:>(t: T) { | ~~~~~~~~ ``` Fixes: #95898
2022-04-13Rollup merge of #95885 - gimbles:patch-1, r=Mark-SimulacrumDylan DPC-1/+5
Improve error message in case of missing checksum # Fixes #94217
2022-04-13Rollup merge of #93217 - willcrichton:example-analyzer, r=GuillaumeGomezDylan DPC-88/+342
Improve Rustdoc UI for scraped examples with multiline arguments, fix overflow in line numbers This PR improves a few aspects of the scrape examples feature in Rustdoc. * Only function names and not the full call expression are highlighted. * For call-sites with multiline arguments, the minimized code viewer will scroll to the top of the call-site rather than the middle if the argument is larger than the viewer size, ensuring that the function name is visible. * This fixes an issue where the line numbers column had a visible x-scroll bar. r? `@GuillaumeGomez`
2022-04-13fix: wrong trait import suggestion for T:Bruno Felipe Francisco-0/+24
2022-04-13Auto merge of #95656 - cjgillot:no-id-hashing-mode, r=Aaron1011bors-30/+30
Remove NodeIdHashingMode. r? `@ghost`
2022-04-13Improve error message when there's no checksumgimbles-1/+5
2022-04-13Auto merge of #94255 - b-naber:use-mir-constant-in-thir, r=oli-obkbors-5/+3
Use mir constant in thir instead of ty::Const This is blocked on https://github.com/rust-lang/rust/pull/94059 (does include its changes, the first two commits in this PR correspond to those changes) and https://github.com/rust-lang/rust/pull/93800 being reinstated (which had to be reverted). Mainly opening since `@lcnr` offered to give some feedback and maybe also for a perf-run (if necessary). This currently contains a lot of duplication since some of the logic of `ty::Const` had to be copied to `mir::ConstantKind`, but with the introduction of valtrees a lot of that functionality will disappear from `ty::Const`. Only the last commit contains changes that need to be reviewed here. Did leave some `FIXME` comments regarding future implementation decisions and some things that might be incorrectly implemented. r? `@oli-obk`
2022-04-13Rollup merge of #95989 - rust-lang:notriddle/issue-82446, r=compiler-errorsDylan DPC-0/+27
diagnostics: regression test for spurrious "help: store this in the heap" Closes #82446
2022-04-13Rollup merge of #95954 - ↵Dylan DPC-1/+1
AnthonyMikh:fix-broken-coverage-docs-screenshot-link, r=Dylan-DPC Fix broken link in coverage tools docs During stabilization the link to example screenshot wad not updated, making rendered docs somewhat less useful. Move that screenshot from unstable book into rustc docs and make documentation point to that new place. Also remove `/img` in unstable book since there are no more any files there.
2022-04-13Rollup merge of #95441 - AlecGoncharow:issue-95204-fix, r=Mark-SimulacrumDylan DPC-10/+15
Always use system `python3` on MacOS This PR includes 2 changes: 1. Always use the system Python found at `/usr/bin/python3` on MacOS 2. Removes the hard requirement on having `python` in your system path if you didn't specify alternatives. The proposed change will instead attempt to find and use in order: `python` -> `python3` -> `python2`. This change isn't strictly necessary but without any change to this check, the original issue inspiring this change will still exist. Fixes #95204 r? ```@jyn514```
2022-04-13errors: lazily load fallback fluent bundleDavid Wood-17/+20
Loading the fallback bundle in compilation sessions that won't go on to emit any errors unnecessarily degrades compile time performance, so lazily create the Fluent bundle when it is first required. Signed-off-by: David Wood <david.wood@huawei.com>
2022-04-13Auto merge of #95990 - Dylan-DPC:rollup-r9bh9t7, r=Dylan-DPCbors-285/+635
Rollup of 7 pull requests Successful merges: - #95316 (Rustdoc: Discriminate required and provided associated constants and types) - #95405 (Move name resolution logic to a dedicated file) - #95914 (Implement tuples using recursion) - #95918 (Delay a bug when we see SelfCtor in ref pattern) - #95970 (Fix suggestions in case of `T:` bounds) - #95973 (prevent opaque types from appearing in impl headers) - #95986 (Autolabel library PRs with T-libs) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-04-12Auto merge of #95905 - vacuus:markdown-render, r=GuillaumeGomezbors-2/+3
rustdoc: Reduce allocations in a `markdown` function Not `html::markdown` this time, just `markdown`, haha.
2022-04-12Rollup merge of #95973 - oli-obk:tait_ub3, r=compiler-errorsDylan DPC-41/+153
prevent opaque types from appearing in impl headers cc `@lqd` opaque types are not distinguishable from their hidden type at the codegen stage. So we could either end up with cases where the hidden type doesn't implement the trait (which will thus ICE) or where the hidden type does implement the trait (so we'd be using its impl instead of the one written for the opaque type). This can even lead to unsound behaviour without unsafe code. Fixes https://github.com/rust-lang/rust/issues/86411. Fixes https://github.com/rust-lang/rust/issues/84660. rebase of #87382 plus some diagnostic tweaks
2022-04-12Rollup merge of #95970 - WaffleLapkin:nicer_trait_suggestions, r=compiler-errorsDylan DPC-1/+61
Fix suggestions in case of `T:` bounds This PR fixes a corner case in `suggest_constraining_type_params` that was causing incorrect suggestions. For the following functions: ```rust fn a<T:>(t: T) { [t, t]; } fn b<T>(t: T) where T: { [t, t]; } ``` We previously suggested the following: ```text ... help: consider restricting type parameter `T` | 1 | fn a<T: Copy:>(t: T) { [t, t]; } | ++++++ ... help: consider further restricting this bound | 2 | fn b<T>(t: T) where T: + Copy { [t, t]; } | ++++++ ``` Note that neither `T: Copy:` not `where T: + Copy` is a correct bound. With this commit the suggestions are correct: ```text ... help: consider restricting type parameter `T` | 1 | fn a<T: Copy>(t: T) { [t, t]; } | ++++ ... help: consider further restricting this bound | 2 | fn b<T>(t: T) where T: Copy { [t, t]; } | ++++ ``` r? `@compiler-errors` I've tried fixing #95898 here too, but got too confused with how `suggest_traits_to_import` works and what it does :sweat_smile:
2022-04-12Rollup merge of #95918 - compiler-errors:issue-95878, r=cjgillotDylan DPC-0/+20
Delay a bug when we see SelfCtor in ref pattern Fixes #95878
2022-04-12Rollup merge of #95316 - fmease:rustdoc-discr-req-prov-assoc-consts-tys, ↵Dylan DPC-243/+401
r=notriddle,GuillaumeGomez Rustdoc: Discriminate required and provided associated constants and types Currently, rustdoc merely separates required and provided associated _functions_ (i.e. methods). This PR extends this to constants (fixes #94652) and types. This makes the documentation of all three kinds of associated items more alike and consistent. As an aside, associated types may actually be provided / have a default when users enable the unstable feature `associated_type_defaults`. | Before | After | |---|---| | ![image](https://user-images.githubusercontent.com/14913065/160631832-d5862d13-b395-4d86-b45c-3873ffd4cd4e.png) | ![image](https://user-images.githubusercontent.com/14913065/160631903-33909a03-b6ee-4d75-9cbc-d188f7f8602e.png) | | ![image](https://user-images.githubusercontent.com/14913065/160632173-040d4139-76f4-4410-851b-d8c1cef014d2.png) | ![image](https://user-images.githubusercontent.com/14913065/160632233-6fd3fe73-cadc-4291-b104-59d2e45366a6.png) | ### `clean::types::ItemKind` modification * `ItemKind::TypedefItem(.., true)` → `ItemKind::AssocTypeItem(..)` * `ItemKind::TypedefItem(.., false)` → `ItemKind::TypedefItem(..)` Further, I added `ItemKind::TyAssoc{Const,Type}Item`, the “required” variant of `ItemKind::Assoc{Const,Type}Item`, analogous to `ItemKind::TyMethodItem` with `ItemKind::MethodItem`. These new variants don't contain new information really, they are just the result of me getting rid of the `Option<_>` field in `AssocConstItem` and `AssocTypeItem`. **Goal**: Make associated items more consistent. Originally I thought modifying `ItemKind` was necessary to achieve the new functionality of this PR but in retrospect, it does not. If you don't like the changes to `ItemKind`, I think I _can_ get rid of them. This change is the root cause of those tiny changes in a lot of different files. ### Concerns and Open Questions * **breaking changes** to hyperlinks: Some heading IDs change: * `associated-const` (sic!) -> `{provided,required}-associated-consts` * `associated-types` -> `{provided,required}-associated-types` * **verbosity** of the headings _{Required,Provided} Associated {Constants,Types}_ * For some files, I am not sure if the changes I made are correct. So please take extra care when reviewing `conversions.rs` (conversion to JSON), `cache.rs`/`fold_item`, `stripper.rs`/`fold_item`, `check_doc_test_visibility.rs`/`should_have_doc_example`, `collect_intra_doc_links.rs`/`from_assoc_item` * JSON output: I still map `AssocTypeItem`s to `Typedef` etc. (FIXME)
2022-04-12Bless tests.Camille GILLOT-30/+30
2022-04-12Apply suggestions from code reviewOli Scherer-1/+1
Co-authored-by: Michael Goulet <michael@errs.io> Co-authored-by: Rémy Rakic <remy.rakic+github@gmail.com>
2022-04-12regression test for spurrious "help: store this in the heap"Michael Howell-0/+27
Closes #82446
2022-04-12Add Rustdoc book link to scrape examples help. Remove remaining panicWill Crichton-22/+51
locations in scrape examples.
2022-04-12Rollup merge of #95975 - m-ou-se:test-70093-no-cross, r=joshtriplettMara Bos-0/+1
Don't test -Cdefault-linker-libraries=yes when cross compiling. See https://github.com/rust-lang/rust/pull/95727#issuecomment-1096603163 and the five comments below that. Unblocks #95727.
2022-04-12Rollup merge of #95963 - luqmana:llvm-dist-cross-filecheck, r=Mark-SimulacrumMara Bos-2/+2
[bootstrap] Grab the right FileCheck binary for dist when cross-compiling. Fixes #95862 We were using the target dir for all the other LLVM tools (`llvm-config`, `llvm-ar`, etc) but the build target dir for `FileCheck`. This meant for targets which are cross-compiled, we were copying the wrong binary.
2022-04-12Rollup merge of #95783 - notriddle:notriddle/doctest-signal, r=GuillaumeGomezMara Bos-15/+79
rustdoc doctest: include signal number in exit status Related to #95601
2022-04-12Remove a `format` invocationRoc Yu-2/+3
2022-04-12rustdoc: discr. required+provided assoc consts+tysLeón Orell Valerian Liehr-243/+401
2022-04-12Update src/test/rustdoc-ui/failed-doctest-output-windows.rsMichael Howell-1/+1
Co-authored-by: Guillaume Gomez <guillaume1.gomez@gmail.com>
2022-04-12Auto merge of #95974 - fee1-dead:rollup-2fr55cs, r=fee1-deadbors-23/+33
Rollup of 5 pull requests Successful merges: - #95671 (feat: Allow usage of sudo [while not accessing root] in x.py) - #95716 (sess: warn w/out fluent bundle w/ user sysroot) - #95820 (simplify const params diagnostic on stable) - #95900 (Fix documentation for wasm32-unknown-unknown) - #95947 (`impl const Default for Box<[T]>` and `Box<str>`) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-04-12Don't test -Cdefault-linker-libraries=yes when cross compiling.Mara Bos-0/+1
2022-04-12Rollup merge of #95820 - OliverMD:95150, r=lcnrfee1-dead-20/+4
simplify const params diagnostic on stable Resolves #95150
2022-04-12Rollup merge of #95716 - davidtwco:translation-custom-sysroot-only-warn, ↵fee1-dead-1/+27
r=oli-obk sess: warn w/out fluent bundle w/ user sysroot Addresses https://github.com/rust-lang/rust/pull/95512#issuecomment-1088467139. When a custom sysroot is requested, then don't error when translation resources are not found, only warn. r? `@bjorn3`
2022-04-12Rollup merge of #95671 - gimbles:master, r=Mark-Simulacrumfee1-dead-2/+2
feat: Allow usage of sudo [while not accessing root] in x.py # Fixes This PR should fix #93344 # Info Allows usage of sudo (while not accessing root) in x.py
2022-04-12Compute a more precise span for opaque type implsOli Scherer-20/+20
2022-04-12sess: try sysroot candidates for fluent bundleDavid Wood-1/+27
Instead of checking only the user provided sysroot or the default (when no sysroot is provided), search user provided sysroot and then check default sysroots for locale requested by the user. Signed-off-by: David Wood <david.wood@huawei.com>
2022-04-12Add test for `T:` suggestionsMaybe Waffle-1/+61
2022-04-12Rollup merge of #95936 - TaKO8Ki:fix-relative-paths-error-message, r=Dylan-DPCMatthias Krüger-2/+2
Fix a bad error message for `relative paths are not supported in visibilities` error closes #95638
2022-04-12Rollup merge of #95920 - compiler-errors:cast-suggestion-span, r=oli-obkMatthias Krüger-0/+23
use `Span::find_ancestor_inside` to get right span in CastCheck This is a quick fix. This bad suggestion likely lives in other places... but thought it would be useful to fix all of the CastCheck ones first. Let me know if reviewer would prefer I add more tests for each of the diagnostics in CastCheck, or would like to do a more thorough review of other suggestions that use spans in typeck. I would also be open to further suggestions on how to better expose an API that gives us the "best" span for a diagnostic suggestion. Fixed #95919
2022-04-12Rollup merge of #95910 - ehuss:fix-crate-type-duplicate, r=Dylan-DPCMatthias Krüger-60/+44
Fix crate_type attribute to not warn on duplicates In #88681 I accidentally marked the `crate_type` attribute as only allowing a single attribute. However, multiple attributes are allowed (they are joined together [here](https://github.com/rust-lang/rust/blob/027a232755fa9728e9699337267f6675dfd0a8ba/compiler/rustc_interface/src/util.rs#L530-L542)). This fixes it to not report a warning if duplicates are found. Closes #95902
2022-04-12Rollup merge of #95909 - vacuus:theme-build-rule, r=GuillaumeGomezMatthias Krüger-7/+9
rustdoc: Reduce allocations in a `theme` function `str::replace` allocates a new `String`... This could probably be made more efficient, but I think it'd have to be clunky imperative code to achieve that.
2022-04-12Rollup merge of #95722 - xu-cheng:pre-push, r=Mark-SimulacrumMatthias Krüger-1/+3
pre-push.sh: Use python3 if python is not found Since Python 2 has reached EOL, `python` may not be available in certain systems (e.g., recent macOS). We should use `python3` in this case to avoid error like `python: No such file or directory`.
2022-04-12Rollup merge of #95320 - JakobDegen:mir-docs, r=oli-obkMatthias Krüger-21/+21
Document the current MIR semantics that are clear from existing code This PR adds documentation to places, operands, rvalues, statementkinds, and terminatorkinds that describes their existing semantics and requirements. In many places the semantics depend on the Rust memory model or other T-Lang decisions - when this is the case, it is just noted as such with links to UCG issues where possible. I'm hopeful that none of the documentation added here can be used to justify optimizations that depend on the memory model. The documentation for places and operands probably comes closest to running afoul of this - if people think that it cannot be merged as is, it can definitely also be taken out. The goal here is to only document parts of MIR that seem to be decided already, or are at least depended on by existing code. That leaves quite a number of open questions - those are marked as "needs clarification." I'm not sure what to do with those in this PR - we obviously can't decide all these questions here. Should I just leave them in as is? Take them out? Keep them in but as `//` instead of `///` comments? If this is too big to review at once, I can split this up. r? rust-lang/mir-opt
2022-04-11[bootstrap] Grab the right FileCheck binary for dist when cross-compiling.Luqman Aden-2/+2
2022-04-12Auto merge of #93408 - liangyongrui:master, r=scottmcmbors-4/+4
fix Layout struct member naming style
2022-04-12fix broken link in coverage tools docsAnthonyMikh-1/+1
2022-04-11Auto merge of #95944 - Dylan-DPC:rollup-idggkrh, r=Dylan-DPCbors-476/+726
Rollup of 7 pull requests Successful merges: - #95008 ([`let_chains`] Forbid `let` inside parentheses) - #95801 (Replace RwLock by a futex based one on Linux) - #95864 (Fix miscompilation of inline assembly with outputs in cases where we emit an invoke instead of call instruction.) - #95894 (Fix formatting error in pin.rs docs) - #95895 (Clarify str::from_utf8_unchecked's invariants) - #95901 (Remove duplicate aliases for `check codegen_{cranelift,gcc}` and fix `build codegen_gcc`) - #95927 (CI: do not compile libcore twice when performing LLVM PGO) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-04-11Fix line numbersMichael Howell-15/+15
2022-04-11simplify const params diagnostic on stableOliver Downard-20/+4
2022-04-11Extend the MIR validator to check many more things around rvalues.Jakob Degen-21/+21