about summary refs log tree commit diff
path: root/src
AgeCommit message (Collapse)AuthorLines
2022-08-29Auto merge of #98626 - oli-obk:tracing, r=lcnrbors-0/+1
bump tracing version Bump tracing dependency to 0.1.35 to give us features like printing the return value of functions
2022-08-29Auto merge of #101143 - matthiaskrgr:rollup-g8y5k0g, r=matthiaskrgrbors-95/+214
Rollup of 9 pull requests Successful merges: - #94890 (Support parsing IP addresses from a byte string) - #96334 (socket `set_mark` addition.) - #99027 (Replace `Body::basic_blocks()` with field access) - #100437 (Improve const mismatch `FulfillmentError`) - #100843 (Migrate part of rustc_infer to session diagnostic) - #100897 (extra sanity check against consts pointing to mutable memory) - #100959 (translations: rename warn_ to warning) - #101111 (Use the declaration's SourceInfo for FnEntry retags, not the outermost) - #101116 ([rustdoc] Remove Attrs type alias) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-08-29Rollup merge of #101116 - GuillaumeGomez:rm-attrs-ty-alias, r=notriddleMatthias Krüger-8/+6
[rustdoc] Remove Attrs type alias When working on https://github.com/rust-lang/rust/pull/101006, I was quite confused because of this type alias as I'm used to having rustdoc types into `clean/types.rs`. Anyway, considering how few uses of it we have, I simply removed it. r? `````@notriddle`````
2022-08-29Rollup merge of #101111 - saethlin:better-fnentry-spans, r=RalfJungMatthias Krüger-8/+8
Use the declaration's SourceInfo for FnEntry retags, not the outermost This addresses a long-standing `// FIXME` in the pass that adds retags. The changes to Miri's UI tests will look like this: ``` --> $DIR/aliasing_mut1.rs:LL:CC | LL | pub fn safe(_x: &mut i32, _y: &mut i32) {} < | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not granting access to tag <TAG> because incompatible item [Unique for <TAG>] is protected by call ID > | ^^ not granting access to tag <TAG> because incompatible item [Unique for <TAG>] is protected by call ID | ``` r? ````@RalfJung````
2022-08-29Rollup merge of #100959 - ↵Matthias Krüger-23/+22
LuisCardosoOliveira:translation-rename-attr-warning, r=davidtwco translations: rename warn_ to warning ## Description This MR renames the the macro `warn_` to `warning`. To give a little bit of context, as [explained](https://rust-lang.zulipchat.com/#narrow/stream/336883-i18n/topic/.23100717.20diag.20translation/near/295074146) by ```````@davidtwco``````` in the Zulip channel, `warn_` was named like that because the keyword `warn` is a built-in attribute and at the time this macro was created the word `warning` was also taken. However, it is no longer the case and we can rename `warn_` to `warning`.
2022-08-29Rollup merge of #100897 - RalfJung:const-not-to-mutable, r=lcnrMatthias Krüger-10/+10
extra sanity check against consts pointing to mutable memory This should be both unreachable and redundant (since we already ensure that validation only reads from read-only memory, when validating consts), but I feel like we cannot be paranoid enough here, and also if this ever fails it'll be a nicer error than the "cannot read from mutable memory" error.
2022-08-29Rollup merge of #100437 - compiler-errors:better-const-mismatch-err, r=oli-obkMatthias Krüger-42/+164
Improve const mismatch `FulfillmentError` Fixes #100414
2022-08-29Rollup merge of #99027 - tmiasko:basic-blocks, r=oli-obkMatthias Krüger-4/+4
Replace `Body::basic_blocks()` with field access Since the refactoring in #98930, it is possible to borrow the basic blocks independently from other parts of MIR by accessing the `basic_blocks` field directly. Replace unnecessary `Body::basic_blocks()` method with a direct field access, which has an additional benefit of borrowing the basic blocks only.
2022-08-29Auto merge of #100908 - lnicola:rust-analyzer-2022-08-23, r=lnicolabors-625/+2091
:arrow_up: rust-analyzer r? `@ghost`
2022-08-28Auto merge of #100497 - kadiwa4:remove_clone_into_iter, r=cjgillotbors-18/+20
Avoid cloning a collection only to iterate over it `@rustbot` label: +C-cleanup
2022-08-28Use the declaration's SourceInfo for FnEntry retags, not the outermostBen Kimock-8/+8
2022-08-28Auto merge of #101115 - matthiaskrgr:rollup-iy14ztr, r=matthiaskrgrbors-53/+216
Rollup of 13 pull requests Successful merges: - #97015 (std::io: migrate ReadBuf to BorrowBuf/BorrowCursor) - #98301 (Add GDB/LLDB pretty-printers for NonZero types) - #99570 (Box::from(slice): Clarify that contents are copied) - #100296 (Add standard C error function aliases to last_os_error) - #100520 (Add mention of `BufReader` in `Read::bytes` docs) - #100885 (Export Cancel from std::os::fortanix_sgx::usercalls::raw) - #100955 (Some papercuts on error::Error) - #101002 (Provide structured suggestion for `hashmap[idx] = val`) - #101038 (no alignment check during interning) - #101055 (Use smaller span for suggestions) - #101091 (Extend attrs if local_def_id exists) - #101098 (rustc_middle: Remove `Visibility::Invisible`) - #101102 (unstable-book-gen: use std::fs::write) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-08-28Remove Attrs type aliasGuillaume Gomez-8/+6
2022-08-28Rollup merge of #101102 - est31:unstable_book_gen_write, r=Mark-SimulacrumMatthias Krüger-23/+10
unstable-book-gen: use std::fs::write I wrote this code in 2017 back when std::fs::write wasn't available. Also, use the t macro from tidy.
2022-08-28Rollup merge of #101098 - petrochenkov:noinvis, r=TaKO8KiMatthias Krüger-5/+0
rustc_middle: Remove `Visibility::Invisible` It had a different meaning in the past, but now it's only used as an implementation detail of import resolution.
2022-08-28Rollup merge of #101091 - TaKO8Ki:fix-101076, r=notriddleMatthias Krüger-2/+17
Extend attrs if local_def_id exists Fixes #101076
2022-08-28Rollup merge of #101055 - TaKO8Ki:use-smaller-span, r=compiler-errorsMatthias Krüger-12/+20
Use smaller span for suggestions
2022-08-28Rollup merge of #101038 - RalfJung:interning-alignment, r=oli-obkMatthias Krüger-0/+17
no alignment check during interning This should fix https://github.com/rust-lang/rust/issues/101034 r? `@oli-obk` Unfortunately we don't have a self-contained testcase for this problem. I am not sure how it can be triggered...
2022-08-28Rollup merge of #101002 - estebank:hashmap-idx, r=davidtwcoMatthias Krüger-10/+36
Provide structured suggestion for `hashmap[idx] = val`
2022-08-28Rollup merge of #98301 - ortem:pretty-printers-nonzero, r=wesleywiserMatthias Krüger-1/+116
Add GDB/LLDB pretty-printers for NonZero types Add GDB/LLDB pretty-printers for `NonZero` types. These pretty-printers were originally implemented for IntelliJ Rust by ```@Kobzol``` in https://github.com/intellij-rust/intellij-rust/pull/5270. Part of #29392.
2022-08-28Auto merge of #100863 - ehuss:sunset-rls, r=Mark-Simulacrumbors-180/+142
Sunset RLS This removes RLS per the plan outlined in https://blog.rust-lang.org/2022/07/01/RLS-deprecation.html. This replaces the `rls` executable with a small program which will display an alert telling the user that RLS is no longer available. An overview of the changes here: * Removes the rls submodule and replaces it with a small stub program. * `rls` is removed from `./x.py install`. I do not think users running `install` will need the stub. * `rls` is removed from `./x.py test`, it doesn't have any tests. Other things of note: * I kept `DIST_REQUIRE_ALL_TOOLS` even though it is no longer needed, with the thought that it could be useful in the feature. However, I could remove it if desired. * I kept `extra_deps` in `tool_extended` (which allows tools to depend on other things), even though it is no longer needed. This can also be removed if desired. * ~~This keeps RLS in the macOS `pkg` installer and the Windows `msi` installer. I kinda lean towards removing it from those, but I'm not sure?~~ RLS has been removed from pkg and msi. * This does not remove the analysis component. It is not clear if we should keep this or not. RLS was the primary user, but I think there are a few users that have made tools around it. * There will be several followup steps after this PR: * Updating the toolstate repo to remove RLS. * Updating documentation, such as rustc-dev-guide, to remove references to RLS. The alert looks like this in VSCode: <img width="989" alt="image" src="https://user-images.githubusercontent.com/43198/185817530-930c5842-24b5-4162-a213-016a25810955.png"> In Sublime it looks similar. I would appreciate if others could help test with other editors such as vim or Emacs.
2022-08-27Remove RLS from macOS pkg and Windows msi installers.Eric Huss-64/+3
These generally aren't used too much, and I feel like aren't really helpful for installing the RLS stub.
2022-08-27Sunset RLSEric Huss-116/+139
2022-08-28Auto merge of #92845 - Amanieu:std_personality, r=Mark-Simulacrumbors-0/+7
Move EH personality functions to std These were previously in the panic_unwind crate with dummy stubs in the panic_abort crate. However it turns out that this is insufficient: we still need a proper personality function even with -C panic=abort to handle the following cases: 1) `extern "C-unwind"` still needs to catch foreign exceptions with -C panic=abort to turn them into aborts. This requires landing pads and a personality function. 2) ARM EHABI uses the personality function when creating backtraces. The dummy personality function in panic_abort was causing backtrace generation to get stuck in a loop since the personality function is responsible for advancing the unwind state to the next frame. Fixes #41004
2022-08-28Auto merge of #96946 - WaffleLapkin:ptr_mask, r=scottmcmbors-0/+11
Add pointer masking convenience functions This PR adds the following public API: ```rust impl<T: ?Sized> *const T { fn mask(self, mask: usize) -> *const T; } impl<T: ?Sized> *mut T { fn mask(self, mask: usize) -> *const T; } // mod intrinsics fn mask<T>(ptr: *const T, mask: usize) -> *const T ``` This is equivalent to `ptr.map_addr(|a| a & mask)` but also uses a cool llvm intrinsic. Proposed in https://github.com/rust-lang/rust/pull/95643#issuecomment-1121562352 cc `@Gankra` `@scottmcm` `@RalfJung` r? rust-lang/libs-api
2022-08-28unstable-book-gen: use std::fs::writeest31-23/+10
I wrote this code in 2017 back when std::fs::write wasn't available. Also, use the t macro from tidy.
2022-08-27rustc_middle: Remove `Visibility::Invisible`Vadim Petrochenkov-5/+0
2022-08-28extend attrs if local_def_id existsTakayuki Maeda-2/+17
2022-08-27Add replace-version-placeholder toolest31-1/+107
This tool is to be ran at specific points in the release process to replace the version place holder made by stabilizations with the version number.
2022-08-27tidy: move directory traversal utility functions into dedicated moduleest31-62/+74
2022-08-27tidy: forbid since values for features that point to the current release or ↵est31-5/+55
future ones It's a common phenomenon that feature stabilizations don't make it into a particular release, but the version is still inaccurate. Often this leads to subsequent changes to adjust/correct the version. Instead, require people to put a placeholder that gets replaced during beta branching time with the current rust version. That way, there is no chance that an error can be introduced. Usage of the placeholder is required on the nightly channel, and forbidden on the stable and beta channels.
2022-08-27Auto merge of #100989 - lcnr:implied-bounds-uwu, r=spastorinobors-0/+48
no unnormalized types for implied bounds outside borrowck fixes #100910 - introduced in https://github.com/rust-lang/rust/pull/100676 - by only considering normalized types for wf. r? types
2022-08-27use smaller span for suggestionsTakayuki Maeda-12/+20
2022-08-27Auto merge of #101074 - JohnTitor:rollup-zwznihq, r=JohnTitorbors-87/+96
Rollup of 11 pull requests Successful merges: - #96240 (Stabilize `const_ptr_offset_from`.) - #99784 (Make forward compatibility lint deprecated_cfg_attr_crate_type_name deny by default) - #100811 (Fix wrong compiletest filters on Windows) - #100924 (Smaller improvements of tidy and the unicode generator) - #100953 (Update documentation for `write!` and `writeln!`) - #101018 (rustdoc: omit start/end tags for empty item description blocks) - #101044 (rustdoc: remove unused CSS for `hidden-by-*-hider`) - #101046 (rustdoc: remove incorrect CSS selector `.impl-items table td`) - #101057 (Merge implementations of HIR fn_decl and fn_sig.) - #101062 (rustdoc: remove empty extern_crates and type="text/javascript" on script) - #101063 (Merge duplicated CSS rules) Failed merges: - #101055 (Use smaller span for suggestions) r? `@ghost` `@rustbot` modify labels: rollup
2022-08-27Rollup merge of #101063 - GuillaumeGomez:merge-duplicated-css, r=notriddleYuki Okushi-30/+8
Merge duplicated CSS rules I used the [stylelint](https://stylelint.io/user-guide/configure) tool to check for duplicated CSS rules in order to merge them. r? `@notriddle`
2022-08-27Rollup merge of #101062 - notriddle:notriddle/text-javascript, r=GuillaumeGomezYuki Okushi-5/+7
rustdoc: remove empty extern_crates and type="text/javascript" on script Like #101023, this removes an attribute with a default value.
2022-08-27Rollup merge of #101046 - notriddle:notriddle/table-css, r=jshaYuki Okushi-1/+31
rustdoc: remove incorrect CSS selector `.impl-items table td` Fixes #100994 This selector was added in c7312fbae4979c6d4fdfbd1f55a71cd47d82a480. The bug can be seen at <https://doc.rust-lang.org/1.27.0/alloc/slice/trait.SliceIndex.html#foreign-impls>. This rule was added to help with a `<table>` that was used for displaying the function signature [src] lockup. That lockup was changed in 34bd2b845b3acd84c5a9bddae3ff8081c19ec5e9 to use flexbox instead, leaving this selector unused (at least, for its original purpose).
2022-08-27Rollup merge of #101044 - notriddle:notriddle/css-hidden-by, r=jshaYuki Okushi-6/+0
rustdoc: remove unused CSS for `hidden-by-*-hider` This CSS seems to have become obsolete with the move to `<details>` tags, and its corresponding JavaScript was removed in aee054d05d8b795d35c0b448a4b731b6507aa459
2022-08-27Rollup merge of #101018 - notriddle:notriddle/item-right-docblock-short, ↵Yuki Okushi-8/+16
r=GuillaumeGomez rustdoc: omit start/end tags for empty item description blocks Related to #100952 This is definitely not a complete solution, but it does shrink keysyms/index.html on smithay from 620K to 516K.
2022-08-27Rollup merge of #100924 - est31:closure_to_fn_ptr, r=Mark-SimulacrumYuki Okushi-18/+17
Smaller improvements of tidy and the unicode generator
2022-08-27Rollup merge of #100811 - czzrr:master, r=Mark-SimulacrumYuki Okushi-1/+9
Fix wrong compiletest filters on Windows As discussed in [#79334](https://github.com/rust-lang/rust/issues/79334), when calling e.g. ``` python x.py test src/test/ui/expr/compound-assignment/eval-order.rs ``` on Windows, compiletest passes the filter `expr/compound-assignment/eval-order.rs` to libtest, which instead should be `expr\compound-assignment\eval-order.rs`, as that is the file found when collecting tests. This is what I fixed. I'm not sure how to organize a test for this. Any suggestions?
2022-08-27Rollup merge of #99784 - est31:deny_cfg_attr_crate_type_name, r=Mark-SimulacrumYuki Okushi-14/+7
Make forward compatibility lint deprecated_cfg_attr_crate_type_name deny by default Turns the forward compatibility lint added by #83744 to deprecate `cfg_attr` usage with `#![crate_type]` and `#![crate_name]` attributes into deny by default. Copying the example from #83744: ```Rust #![crate_type = "lib"] // remains working #![cfg_attr(foo, crate_type = "bin")] // will stop working ``` Over 8 months have passed since #83744 was merged so I'd say this gives ample time for people to have been warned, so we can make the warning stronger. No usage was found via grep.app except for one, which was in an unmaintained code base that didn't seem to be used in the open source eco system. The crater run conducted in #83744 also didn't show up anything. cc #91632 - tracking issue for the lint
2022-08-27Rollup merge of #96240 - fee1-dead-contrib:stabilize_const_offset_from, ↵Yuki Okushi-4/+1
r=Mark-Simulacrum Stabilize `const_ptr_offset_from`. Stabilization has been completed [here](https://github.com/rust-lang/rust/issues/92980#issuecomment-1065644848) with a FCP. Closes #92980.
2022-08-27Auto merge of #100732 - dpaoliello:import_name_type, r=wesleywiserbors-6/+398
Implementation of import_name_type Fixes #96534 by implementing https://github.com/rust-lang/compiler-team/issues/525 Symbols that are exported or imported from a binary on 32bit x86 Windows can be named in four separate ways, corresponding to the [import name types](https://docs.microsoft.com/en-us/windows/win32/debug/pe-format#import-name-type) from the PE-COFF spec. The exporting and importing binaries must use the same name encoding, otherwise mismatches can lead to link failures due to "missing symbols" or to 0xc0000139 (`STATUS_ENTRYPOINT_NOT_FOUND`) errors when the executable/library is loaded. For details, see the comments on the raw-dylib feature's https://github.com/rust-lang/rust/issues/58713. To generate the correct import libraries for these DLLs, therefore, rustc must know the import name type for each `extern` function, and there is currently no way for users to provide this information. This change adds a new `MetaNameValueStr` key to the `#[link]` attribute called `import_name_type`, and which accepts one of three values: `decorated`, `noprefix`, and `undecorated`. A single DLL is likely to export all its functions using the same import type name, hence `import_name_type` is a parameter of `#[link]` rather than being its own attribute that is applied per-function. It is possible to have a single DLL that exports different functions using different import name types, but users could express such cases by providing multiple export blocks for the same DLL, each with a different import name type. Note: there is a fourth import name type defined in the PE-COFF spec, `IMPORT_ORDINAL`. This case is already handled by the `#[link_ordinal]` attribute. While it could be merged into `import_type_name`, that would not make sense as `#[link_ordinal]` provides per-function information (namely the ordinal itself). Design decisions (these match the MCP linked above): * For GNU, `decorated` matches the PE Spec and MSVC rather than the default behavior of `dlltool` (i.e., there will be a leading `_` for `stdcall`). * If `import_name_type` is not present, we will keep our current behavior of matching the environment (MSVC vs GNU) default for decorating. * Using `import_name_type` on architectures other than 32bit x86 will result in an error. * Using `import_name_type` with link kinds other than `"raw-dylib"` will result in an error.
2022-08-27Auto merge of #101064 - compiler-errors:rollup-fwm5m5f, r=compiler-errorsbors-0/+37
Rollup of 9 pull requests Successful merges: - #100724 (Migrate ast lowering to session diagnostic) - #100735 (Migrate `rustc_ty_utils` to `SessionDiagnostic`) - #100738 (Diagnostics migr const eval) - #100744 (Migrate rustc_mir_dataflow to diagnostic structs) - #100776 (Migrate `rustc_lint` errors to `SessionDiagnostic`) - #100817 (sugg: suggest the usage of boolean value when there is a typo in the keyword) - #100836 (Migrate `rustc_attr` crate diagnostics) - #100890 (Migrate rustc_driver to SessionDiagnostic) - #100900 (on `region_errors.rs`) Failed merges: - #100831 (Migrate `symbol_mangling` module to new diagnostics structs) r? `@ghost` `@rustbot` modify labels: rollup
2022-08-26Rollup merge of #100817 - vincenzopalazzo:macros/bool_spelling_sugg, r=davidtwcoMichael Goulet-0/+37
sugg: suggest the usage of boolean value when there is a typo in the keyword Fixes https://github.com/rust-lang/rust/issues/100686 This adds a new suggestion when there is a well-known typo With the following program ```rust fn main() { let x = True; } ``` Now we have the following suggestion ``` error[E0425]: cannot find value `True` in this scope --> test.rs:2:13 | 2 | let x = True; | ^^^^ not found in this scope | help: you may want to use a bool value instead | 2 | let x = true; | ~~~~ error: aborting due to previous error ``` Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
2022-08-27Merge duplicated CSS rulesGuillaume Gomez-30/+8
2022-08-26rustdoc: remove empty extern_crates and type="text/javascript" on scriptMichael Howell-5/+7
Like #101023, this removes an attribute with a default value.
2022-08-26Auto merge of #100043 - RalfJung:scalar-always-init, r=RalfJungbors-429/+282
interpret: remove support for uninitialized scalars With Miri no longer supporting `-Zmiri-allow-uninit-numbers`, we no longer need to support storing uninit data in a `Scalar`. We anyway already only use this representation for types with *initialized* `Scalar` layout (and we have to, due to partial initialization), so let's get rid of the `ScalarMaybeUninit` type entirely. I tried to stage this into meaningful commits, but the one that changes `read_immediate` to always trigger UB on uninit is the largest chunk of the PR and I don't see how it could be subdivided. Fixes https://github.com/rust-lang/miri/issues/2187 r? `@oli-obk`
2022-08-26make read_immediate error immediately on uninit, so ImmTy can carry ↵Ralf Jung-429/+282
initialized Scalar