about summary refs log tree commit diff
path: root/src/test/ui
AgeCommit message (Collapse)AuthorLines
2022-07-24Auto merge of #93429 - fee1-dead-contrib:allow-super-trait-tilde-const, ↵bors-0/+100
r=oli-obk Allow `trait A: ~const B` What's included: a minimal working change set for `~const` supertraits to work. r? `@oli-obk`
2022-07-23Auto merge of #99652 - GuillaumeGomez:rollup-38v0x7y, r=GuillaumeGomezbors-31/+78
Rollup of 6 pull requests Successful merges: - #99298 (Make `ui-fulldeps/gated-plugins` and `ui-fulldeps/multiple-plugins` tests stage 2 only) - #99396 (Add some additional double-adjustment regression tests) - #99449 (Do not resolve associated const when there is no provided value) - #99595 (Mark atomics as unsupported on thumbv6m) - #99627 (Lock stdout once when listing tests) - #99638 (Remove Clean trait implementation for hir::Ty and middle::Ty) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-07-23Rollup merge of #99449 - compiler-errors:assoc-const-missing-item, r=lcnrGuillaume Gomez-31/+32
Do not resolve associated const when there is no provided value Fixes #98629, since now we just delay a bug when we're not able to evaluate a const item due to the value not actually being provided by anything. This means compilation proceeds forward to where the "missing item in impl" error is emitted. ---- The root issue here is that when we're looking for the defining `LeafDef` in `resolve_associated_item`, we end up getting the trait's AssocItem instead of the impl's AssocItem (which does not exist). This resolution "succeeds" even if the trait's item has no default value, and then since this item has no value to evaluate, it turns into a const eval error. This root issue becomes problematic (as in #98629) when this const eval error happens in wfcheck (for example, due to normalizing the param-env of something that references this const). Since this happens sooner than the check that an impl actually provides all of the items that a trait requires (which happens during later typecheck), we end up aborting compilation early with only this un-informative message. I'm not exactly sure _why_ this bug arises due to #96591 -- perhaps valtrees are evaluated more eagerly than in the old system? r? ``@oli-obk`` or ``@lcnr`` since y'all are familiar with const eval and reviewed #96591, though feel free to reassign. This is a regression from stable to beta, so I would be open to considering this for beta backport. It seems correct to me, especially given the improvements in the other UI tests this PR touches, but may have some side-effects that I'm unaware of...?
2022-07-23Rollup merge of #99396 - compiler-errors:missing-tests, r=Mark-SimulacrumGuillaume Gomez-0/+46
Add some additional double-adjustment regression tests I accidentally missed these when I rebased #98785 cc #98894 and #98897
2022-07-23Auto merge of #98208 - ivanloz:master, r=nagisabors-1/+1
Add support for LLVM ShadowCallStack. LLVMs ShadowCallStack provides backward edge control flow integrity protection by using a separate shadow stack to store and retrieve a function's return address. LLVM currently only supports this for AArch64 targets. The x18 register is used to hold the pointer to the shadow stack, and therefore this only works on ABIs which reserve x18. Further details are available in the [LLVM ShadowCallStack](https://clang.llvm.org/docs/ShadowCallStack.html) docs. # Usage `-Zsanitizer=shadow-call-stack` # Comments/Caveats * Currently only enabled for the aarch64-linux-android target * Requires the platform to define a runtime to initialize the shadow stack, see the [LLVM docs](https://clang.llvm.org/docs/ShadowCallStack.html) for more detail.
2022-07-23Add testsDeadbeef-0/+100
2022-07-23Rollup merge of #99580 - fmease:fix-issue-99565, r=estebankMatthias Krüger-2/+23
Don't suggest unnameable generic arguments Fixes #99565. `@rustbot` label T-compiler A-diagnostics r? `@rust-lang/wg-diagnostics`
2022-07-22Do not resolve associated const when there is no provided valueMichael Goulet-31/+32
2022-07-22Auto merge of #99521 - fee1-dead-contrib:const_fix_hax, r=oli-obkbors-16/+1
Fix hack that remaps env constness. WARNING: might have perf implications. Are there any more problems with having a constness in the `ParamEnv` now? :) r? `@oli-obk`
2022-07-22Auto merge of #99491 - workingjubilee:sync-psimd, r=workingjubileebors-7/+8
Sync in portable-simd subtree r? `@ghost`
2022-07-22Rollup merge of #99539 - compiler-errors:bidirectional-block-suggestions, ↵Dylan DPC-40/+107
r=fee1-dead Improve suggestions for returning binding Fixes #99525 Also reworks the cause codes for match and if a bit, I think cleaning them up in a positive way. We no longer need to call `could_remove_semicolon` in successful code, which might save a few cycles?
2022-07-22Rollup merge of #99393 - ↵Dylan DPC-169/+178
Logarithmus:feature/99255-omit-const-generic-suffixes, r=petrochenkov feat: omit suffixes in const generics (e.g. `1_i32`) Closes #99255
2022-07-22Don't suggest unnameable generic argumentsLeón Orell Valerian Liehr-2/+23
2022-07-22Auto merge of #99420 - RalfJung:vtable, r=oli-obkbors-211/+266
make vtable pointers entirely opaque This implements the scheme discussed in https://github.com/rust-lang/unsafe-code-guidelines/issues/338: vtable pointers should be considered entirely opaque and not even readable by Rust code, similar to function pointers. - We have a new kind of `GlobalAlloc` that symbolically refers to a vtable. - Miri uses that kind of allocation when generating a vtable. - The codegen backends, upon encountering such an allocation, call `vtable_allocation` to obtain an actually dataful allocation for this vtable. - We need new intrinsics to obtain the size and align from a vtable (for some `ptr::metadata` APIs), since direct accesses are UB now. I had to touch quite a bit of code that I am not very familiar with, so some of this might not make much sense... r? `@oli-obk`
2022-07-21Rollup merge of #99552 - lcnr:orphan_check-rework, r=oli-obkMatthias Krüger-1/+1
Rewrite `orphan_check_trait_ref` to use a `TypeVisitor` The current impl is far more confusing than it has any right to be :sparkles: r? rust-lang/types
2022-07-21Rollup merge of #99549 - JohnTitor:issue-52304, r=compiler-errorsMatthias Krüger-0/+11
Add regression test for #52304 Closes #52304 r? ```@compiler-errors``` Signed-off-by: Yuki Okushi <jtitor@2k36.org>
2022-07-21Rollup merge of #99526 - compiler-errors:normalize-arg-spans, r=oli-obkMatthias Krüger-15/+12
Normalize the arg spans to be within the call span Makes more sense to point out the arg's span, and not the expression inside the macro
2022-07-21Rollup merge of #99413 - steffahn:btree_dropck, r=m-ou-seMatthias Krüger-3/+50
Add `PhantomData` marker for dropck to `BTreeMap` closes #99408
2022-07-21Generalize same_type_modulo_inferMichael Goulet-2/+0
2022-07-21Auto merge of #99059 - Amanieu:fix-96797, r=Mark-Simulacrumbors-0/+26
Add test for #96797 This was fixed in LLVM which was updated in #98285. https://reviews.llvm.org/D127751 Fixes #96797
2022-07-21Add test for #96797Amanieu d'Antras-0/+26
This was fixed in LLVM which was updated in #98285. https://reviews.llvm.org/D127751 Fixes #96797
2022-07-21orphan check: opaque types are an errorlcnr-1/+1
2022-07-21Add regression test for #52304Yuki Okushi-0/+11
Signed-off-by: Yuki Okushi <jtitor@2k36.org>
2022-07-21And for patterns tooMichael Goulet-1/+71
2022-07-21Do if-expression obligation stuff less eagerlyMichael Goulet-38/+37
2022-07-20Introduce core::simd trait imports in testsJubilee Young-7/+8
2022-07-20Auto merge of #99058 - michaelwoerister:remove-stable-set-and-map, r=nagisabors-4/+4
Remove the unused StableSet and StableMap types from rustc_data_structures. The current implementation is not "stable" in the same sense that `HashStable` and `StableHasher` are stable, i.e. across compilation sessions. So, in my opinion, it's better to remove those types (which are basically unused anyway) than to give the wrong impression that these are safe for incr. comp. I plan to provide new "stable" collection types soon that can be used to replace `FxHashMap` and `FxHashSet` in query results (see [draft](https://github.com/michaelwoerister/rust/commit/69d03ac7a7d651a397ab793e9d78f8fce3edf7a6)). It's unsound that `HashMap` and `HashSet` implement `HashStable` (see https://github.com/rust-lang/rust/issues/98890 for a recent P-critical bug caused by this) -- so we should make some progress there.
2022-07-20bless some testsRalf Jung-52/+39
2022-07-20we seem to monomorphize fewer vtables by default now, so adjust some testsRalf Jung-15/+68
2022-07-20make use of symbolic vtables in interpreterRalf Jung-166/+181
2022-07-20Normalize the arg spans to be within the call spanMichael Goulet-15/+12
2022-07-20Fix hack that remaps env constness.Deadbeef-16/+1
WARNING: might have perf implications. Are there any more problems with having a constness in the `ParamEnv` now? :)
2022-07-20Rollup merge of #99480 - miam-miam100:arg-format, r=oli-obkMatthias Krüger-2/+16
Diagnostic width span is not added when '0$' is used as width in format strings When the following code is run rustc does not add diagnostic spans for the width argument. Such spans are necessary for a clippy lint that I am currently writing. ```rust println!("Hello {1:0$}!", 5, "x"); // ^^ // Should have a span here ```
2022-07-20Rollup merge of #99355 - compiler-errors:macro-metavar-less-than-zero, ↵Matthias Krüger-8/+27
r=petrochenkov better error for bad depth parameter on macro metavar expr Fixes #99060
2022-07-20Rollup merge of #99352 - compiler-errors:tighter-spans-on-generic-call, ↵Matthias Krüger-32/+22
r=spastorino Use `typeck_results` to avoid duplicate `ast_ty_to_ty` call Comes with a bunch of improvements in spans :heart_eyes:
2022-07-20Rollup merge of #99212 - davidtwco:partial-stability-implies, r=michaelwoeristerMatthias Krüger-2/+138
introduce `implied_by` in `#[unstable]` attribute Requested by the library team [on Zulip](https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/better.20support.20for.20partial.20stabilizations/near/285581519). If part of a feature is stabilized and a new feature is added for the remaining parts, then the `implied_by` meta-item can be added to `#[unstable]` to indicate which now-stable feature was used previously. ```diagnostic error: the feature `foo` has been partially stabilized since 1.62.0 and is succeeded by the feature `foobar` --> $DIR/stability-attribute-implies-using-unstable.rs:3:12 | LL | #![feature(foo)] | ^^^ | note: the lint level is defined here --> $DIR/stability-attribute-implies-using-stable.rs:2:9 | LL | #![deny(stable_features)] | ^^^^^^^^^^^^^^^ help: if you are using features which are still unstable, change to using `foobar` | LL | #![feature(foobar)] | ~~~~~~ help: if you are using features which are now stable, remove this line | LL - #![feature(foo)] | ``` When a `#![feature(..)]` attribute still exists for the now-stable attribute, then there this has two effects: - There will not be an stability error for uses of items from the implied feature which are still unstable (until the `#![feature(..)]` is removed or updated to the new feature). - There will be an improved diagnostic for the remaining use of the feature attribute for the now-stable feature. ```rust /// If part of a feature is stabilized and a new feature is added for the remaining parts, /// then the `implied_by` attribute is used to indicate which now-stable feature previously /// contained a item. /// /// ```pseudo-Rust /// #[unstable(feature = "foo", issue = "...")] /// fn foo() {} /// #[unstable(feature = "foo", issue = "...")] /// fn foobar() {} /// ``` /// /// ...becomes... /// /// ```pseudo-Rust /// #[stable(feature = "foo", since = "1.XX.X")] /// fn foo() {} /// #[unstable(feature = "foobar", issue = "...", implied_by = "foo")] /// fn foobar() {} /// ``` ``` In the Zulip discussion, this was envisioned as `implies` on `#[stable]` but I went with `implied_by` on `#[unstable]` because it means that only the unstable attribute needs to be changed in future, not the new stable attribute, which seems less error-prone. It also isn't particularly feasible for me to detect whether items from the implied feature are used and then only suggest updating _or_ removing the `#![feature(..)]` as appropriate, so I always do both. There's some new information in the cross-crate metadata as a result of this change, that's a little unfortunate, but without requiring that the `#[unstable]` and `#[stable]` attributes both contain the implication information, it's necessary: ```rust /// This mapping is necessary unless both the `#[stable]` and `#[unstable]` attributes should /// specify their implications (both `implies` and `implied_by`). If only one of the two /// attributes do (as in the current implementation, `implied_by` in `#[unstable]`), then this /// mapping is necessary for diagnostics. When a "unnecessary feature attribute" error is /// reported, only the `#[stable]` attribute information is available, so the map is necessary /// to know that the feature implies another feature. If it were reversed, and the `#[stable]` /// attribute had an `implies` meta item, then a map would be necessary when avoiding a "use of /// unstable feature" error for a feature that was implied. ``` I also change some comments to documentation comments in the compiler, add a helper for going from a `Span` to a `Span` for the entire line, and fix a incorrect part of the pre-existing stability attribute diagnostics. cc `@yaahc`
2022-07-20passes: check implied feature existsDavid Wood-0/+18
Add a check confirming that features referenced in `implied_by` meta items actually exist. Signed-off-by: David Wood <david.wood@huawei.com>
2022-07-20passes: improved partial stabilization diagnosticDavid Wood-4/+20
Improves the diagnostic when a feature attribute is specified unnecessarily but the feature implies another (i.e. it was partially stabilized) to refer to the implied feature. Signed-off-by: David Wood <david.wood@huawei.com>
2022-07-20middle: add `implies_by` to `#[unstable]`David Wood-0/+102
If part of a feature is stabilized and a new feature is added for the remaining parts, then the `implied_by` attribute can be used to indicate which now-stable feature previously contained a item. If the now-stable feature is still active (if the user has only just updated rustc, for example) then there will not be an stability error for uses of the item from the implied feature. Signed-off-by: David Wood <david.wood@huawei.com>
2022-07-20Add ShadowCallStack SupportIvan Lozano-1/+1
Adds support for the LLVM ShadowCallStack sanitizer.
2022-07-20Auto merge of #99506 - Dylan-DPC:rollup-q3msucx, r=Dylan-DPCbors-134/+224
Rollup of 7 pull requests Successful merges: - #98101 (stdlib support for Apple WatchOS) - #99345 (Do not allow typeck children items to constrain outer RPITs) - #99383 (Formalize defining_use_anchor) - #99436 (Add flag to configure `noalias` on `Box<T>`) - #99483 (Fix a numerical underflow in tuple wrap suggestion) - #99485 (Stop injecting `#[allow(unused_qualifications)]` in generated `derive` implementations) - #99486 (Refactor: remove a string comparison between types in `check_str_addition`) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-07-20Fix off by one error and add ui test.miam-miam100-2/+16
2022-07-20Rollup merge of #99485 - mdholloway:unused-qualifications-in-derive, r=oli-obkDylan DPC-99/+38
Stop injecting `#[allow(unused_qualifications)]` in generated `derive` implementations Currently, the `#[derive]` attribute always injects an `#[allow(unused_qualifications)]` attribute in the generated implementation. This results in an error when a derive is used in combination with `#![forbid(unused_qualifications)]`, because the `forbid` rule by definition cannot be overridden by `allow`. It appears that the original issue that prompted the inclusion of `#[allow(unused_qualifications)]` (#19102) is no longer present in the current stable release, and the associated [test case](https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-19102.rs) still passes, so the `allow` is simply removed here. Fixes #71898.
2022-07-20Rollup merge of #99483 - compiler-errors:issue-99482, r=jyn514Dylan DPC-0/+24
Fix a numerical underflow in tuple wrap suggestion Fixes #99482 I'm a clown, I rewrote the arg mismatch algo to use well-typed indices to avoid things like this, but then I added my own indexing bug, lol.
2022-07-20Rollup merge of #99383 - ouz-a:issue_57961, r=oli-obkDylan DPC-35/+108
Formalize defining_use_anchor This tackles issue #57961 Introduces new enum called `DefiningAnchor` that replaces `Option<LocalDefId>` of `defining_use_anchor`. Now every use of it is explicit and exhaustively matched, catching errors like one in the linked issue. This is not a perfect fix but it's a step in the right direction. r? `@oli-obk`
2022-07-20Rollup merge of #99345 - compiler-errors:issue-99073-redux, r=oli-obkDylan DPC-0/+54
Do not allow typeck children items to constrain outer RPITs Fixes #99073 in a simpler and more conservative way than #99079. Simply raise a mismatched types error if we try to constrain an RPIT in an item that isn't the RPIT's parent. r? `@oli-obk`
2022-07-20Use FxIndexMap instead of otherwise unused StableMap for WEAK_ITEMS_REFS.Michael Woerister-4/+4
2022-07-20Auto merge of #99495 - oli-obk:revert_98582, r=oli-obkbors-131/+24
Revert "Rollup merge of #98582 - oli-obk:unconstrained_opaque_type, r… …=estebank" This reverts commit 6f8fb911ad504b77549cf3256a09465621beab9d, reversing changes made to 7210e46dc69a4b197a313d093fe145722c248b7d. r? `@ghost` rebase of https://github.com/rust-lang/rust/pull/99368
2022-07-20attr: fix expected meta-item for `#[stable]`David Wood-2/+2
When an unexpected meta item is provided to `#[stable]`, the diagnostic lists "since" and "note" as expected meta-items, however the surrounding code actually expects "feature" and "since". Signed-off-by: David Wood <david.wood@huawei.com>
2022-07-20take opaq typesouz-a-35/+108