about summary refs log tree commit diff
path: root/src/test
AgeCommit message (Collapse)AuthorLines
2022-08-30Auto merge of #101183 - Dylan-DPC:rollup-6kewixv, r=Dylan-DPCbors-534/+667
Rollup of 9 pull requests Successful merges: - #95376 (Add `vec::Drain{,Filter}::keep_rest`) - #100092 (Fall back when relating two opaques by substs in MIR typeck) - #101019 (Suggest returning closure as `impl Fn`) - #101022 (Erase late bound regions before comparing types in `suggest_dereferences`) - #101101 (interpret: make read-pointer-as-bytes a CTFE-only error with extra information) - #101123 (Remove `register_attr` feature) - #101175 (Don't --bless in pre-push hook) - #101176 (rustdoc: remove unused CSS selectors for `.table-display`) - #101180 (Add another MaybeUninit array test with const) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-08-30Rollup merge of #101180 - SUPERCILEX:const-maybeuninit, r=TaKO8KiDylan DPC-0/+6
Add another MaybeUninit array test with const This is another possible syntax and I just want to be absolutely sure it behaves correctly.
2022-08-30Rollup merge of #101123 - JohnTitor:rm-register-attr, r=TaKO8KiDylan DPC-506/+183
Remove `register_attr` feature Closes #66080 Signed-off-by: Yuki Okushi <jtitor@2k36.org>
2022-08-30Rollup merge of #101101 - RalfJung:read-pointer-as-bytes, r=oli-obkDylan DPC-28/+311
interpret: make read-pointer-as-bytes a CTFE-only error with extra information Next step in the reaction to https://github.com/rust-lang/rust/issues/99923. Also teaches Miri to implicitly strip provenance in more situations when transmuting pointers to integers, which fixes https://github.com/rust-lang/miri/issues/2456. Pointer-to-int transmutation during CTFE now produces a message like this: ``` = help: this code performed an operation that depends on the underlying bytes representing a pointer = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported ``` r? ``@oli-obk``
2022-08-30Rollup merge of #101022 - compiler-errors:issue-101020, r=jackh726Dylan DPC-0/+62
Erase late bound regions before comparing types in `suggest_dereferences` Fixes #101020
2022-08-30Rollup merge of #101019 - compiler-errors:return-closure-suggestion, r=cjgillotDylan DPC-0/+40
Suggest returning closure as `impl Fn` Fixes #100936
2022-08-30Rollup merge of #100092 - compiler-errors:issue-100075, r=oli-obkDylan DPC-0/+65
Fall back when relating two opaques by substs in MIR typeck This is certainly _one_ way to fix #100075. Not really confident it's the _best_ way to do it, though. The root cause of this issue is that during MIR type-check, we end up trying to equate an opaque against the same opaque def-id but with different substs. Because of the way that we replace RPITs during (HIR) typeck with an inference variable, we don't end up emitting a type-checking error, so the delayed MIR bug causes an ICE. See the `src/test/ui/impl-trait/issue-100075-2.rs` test below to make that clear -- in that example, we try to equate `{impl Sized} substs=[T]` and `{impl Sized} substs=[Option<T>]`, which causes an ICE. This new logic will instead cause us to infer `{impl Sized} substs=[Option<T>]` as the hidden type for `{impl Sized} substs=[T]`, which causes a proper error to be emitted later on when we check that an opaque isn't recursive. I'm open to closing this in favor of something else. Ideally we'd fix this in typeck, but the thing we do to ensure backwards compatibility with weird RPIT cases makes that difficult. Also open to discussing this further.
2022-08-30Auto merge of #100812 - Nilstrieb:revert-let-chains-nightly, r=Mark-Simulacrumbors-371/+693
Revert let_chains stabilization This is the revert against master, the beta revert was already done in #100538. Bumps the stage0 compiler which already has it reverted.
2022-08-29Add another MaybeUninit array test with constAlex Saveau-0/+6
Signed-off-by: Alex Saveau <saveau.alexandre@gmail.com>
2022-08-29Auto merge of #101167 - matthiaskrgr:rollup-yt3jdmp, r=matthiaskrgrbors-28/+134
Rollup of 7 pull requests Successful merges: - #100898 (Do not report too many expr field candidates) - #101056 (Add the syntax of references to their documentation summary.) - #101106 (Rustdoc-Json: Retain Stripped Modules when they are imported, not when they have items) - #101131 (CTFE: exposing pointers and calling extern fn is just impossible) - #101141 (Simplify `get_trait_ref` fn used for `virtual_function_elimination`) - #101146 (Various changes to logging of borrowck-related code) - #101156 (Remove `Sync` requirement from lint pass objects) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-08-29Rollup merge of #101131 - RalfJung:ctfe-no-needs-rfc, r=oli-obkMatthias Krüger-2/+5
CTFE: exposing pointers and calling extern fn is just impossible The remaining "needs RFC" errors are just needlessly confusing, I think -- time to get rid of that error variant. They are anyway only reachable with miri-unleashed (if at all). r? `@oli-obk`
2022-08-29Rollup merge of #101106 - aDotInTheVoid:rdj-stripped-mod, r=GuillaumeGomezMatthias Krüger-10/+56
Rustdoc-Json: Retain Stripped Modules when they are imported, not when they have items Fixes #101103 Fixes #100973 r? `@GuillaumeGomez`
2022-08-29Rollup merge of #100898 - compiler-errors:too-many-expr-fields, r=spastorinoMatthias Krüger-16/+73
Do not report too many expr field candidates When considering "this expressions' field has a {field/method}" suggestions: 1. Don't report methods that are out of scope 2. Use `span_suggestions` instead of reporting each field candidate, which caps the number of suggestions to 4 4. Blacklist some common traits like `Clone` and `Deref` Fixes #100894
2022-08-29Revert let_chains stabilizationNilstrieb-371/+693
This reverts commit 326646074940222d602f3683d0559088690830f4. This is the revert against master, the beta revert was already done in #100538.
2022-08-29Rollup merge of #101000 - m-ou-se:count-is-star, r=nagisaDylan DPC-1/+14
Separate CountIsStar from CountIsParam in rustc_parse_format. `rustc_parse_format`'s parser would result in the exact same output for `{:.*}` and `{:.0$}`, making it hard for diagnostics to handle these cases properly. This splits those cases by adding a new `CountIsStar` enum variant. This fixes #100995 Prerequisite for https://github.com/rust-lang/rust/pull/100996
2022-08-29Rollup merge of #100239 - RalfJung:const-prop-uninit, r=oli-obkDylan DPC-1/+2
remove an ineffective check in const_prop Based on https://github.com/rust-lang/rust/pull/100043, only the last two commits are new. ConstProp has a special check when reading from a local that prevents reading uninit locals. However, if that local flows into `force_allocation`, then no check fires and evaluation proceeds. So this check is not really effective at preventing accesses to uninit locals. With https://github.com/rust-lang/rust/pull/100043, `read_immediate` and friends always fail when reading uninit locals, so I don't see why ConstProp would need a separate check. Thus I propose we remove it. This is needed to be able to do https://github.com/rust-lang/rust/pull/100085.
2022-08-29Rollup merge of #99821 - cjgillot:ast-lifetimes-2, r=compiler-errorsDylan DPC-12/+12
Remove separate indexing of early-bound regions ~Based on https://github.com/rust-lang/rust/pull/99728.~ This PR copies some modifications from https://github.com/rust-lang/rust/pull/97839 around object lifetime defaults. These modifications allow to stop counting generic parameters during lifetime resolution, and rely on the indexing given by `rustc_typeck::collect`.
2022-08-29Rollup merge of #98304 - SUPERCILEX:maybeuninit, r=nikicDylan DPC-0/+11
Add MaybeUninit memset test Closes #96274
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-29Rustdoc-Json: Retain Stripped Modules when they are imported, not when they ↵Nixon Enraght-Moony-10/+56
have items. Fixes #101103 Fixes #100973
2022-08-28entirely get rid of NeedsRfc CTFE errorsRalf Jung-0/+3
2022-08-28CTFE: exposing pointers and calling extern fn doesn't need an RFC, it is ↵Ralf Jung-2/+2
just impossible
2022-08-28Use the declaration's SourceInfo for FnEntry retags, not the outermostBen Kimock-8/+8
2022-08-28Remove `register_attr`-related testsYuki Okushi-506/+183
Signed-off-by: Yuki Okushi <jtitor@2k36.org>
2022-08-28Rollup merge of #101091 - TaKO8Ki:fix-101076, r=notriddleMatthias Krüger-0/+14
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/+86
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 #92845 - Amanieu:std_personality, r=Mark-Simulacrumbors-0/+5
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-28Add test for APITMichael Goulet-3/+23
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-27adjust testsRalf Jung-28/+311
2022-08-28extend attrs if local_def_id existsTakayuki Maeda-0/+14
2022-08-27remove an ineffective check in const_propRalf Jung-1/+2
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-22/+40
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 #101046 - notriddle:notriddle/table-css, r=jshaYuki Okushi-0/+30
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 #101018 - notriddle:notriddle/item-right-docblock-short, ↵Yuki Okushi-4/+2
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 #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-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