about summary refs log tree commit diff
path: root/src/test/ui
AgeCommit message (Collapse)AuthorLines
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-21break out scopes when let-else fails to matchDing Xiang Fei-0/+61
2022-07-20Remove implicit names and values from --cfg in --check-cfgUrgau-38/+63
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
2022-07-20Revert "Rollup merge of #98582 - oli-obk:unconstrained_opaque_type, r=estebank"Oli Scherer-131/+24
This reverts commit 6f8fb911ad504b77549cf3256a09465621beab9d, reversing changes made to 7210e46dc69a4b197a313d093fe145722c248b7d.
2022-07-20Use non-relocatable code in nofile-limit.rs testTomasz Miąsko-1/+1
To avoid using static-pie which is not essential to the test but which was reported to cause problems on Void Linux where glibc is build without support for static-pie.
2022-07-20Rollup merge of #99481 - JohnTitor:issue-71547, r=compiler-errorsDylan DPC-0/+18
Add regression test for #71547 Closes #71547 r? `@compiler-errors` Signed-off-by: Yuki Okushi <jtitor@2k36.org>
2022-07-20Rollup merge of #99433 - cjgillot:erase-foreign-sig, r=compiler-errorsDylan DPC-0/+24
Erase regions before comparing signatures of foreign fns. Fixes https://github.com/rust-lang/rust/issues/99276 The version with explicit lifetimes is probably tracked in another bug, but I could not find it.
2022-07-20Rollup merge of #98784 - compiler-errors:forgot-to-return-binding, r=estebankDylan DPC-9/+154
Suggest returning local on "expected `ty`, found `()`" due to expr-less block Putting this up for _initial_ review. Notably, this doesn't consider if the value has possibly been moved, or whether the type is `Copy`. It also provides a structured suggestion if there's one "preferred" binding that matches the type (i.e. one binding in the block or its parent), otherwise it just points them out if there's fewer than 4 of them. Fixes #98177 r? `@estebank`
2022-07-20Suggest returning binding from block or enclosing scope on ↵Michael Goulet-9/+154
coerce_forced_unit error
2022-07-19Remove #[allow(unused_qualifications)] lines from derive diff testMichael Holloway-99/+0
2022-07-19Fix a numerical underflow in tuple wrap suggestionMichael Goulet-0/+24
2022-07-20Add regression test for #71547Yuki Okushi-0/+18
Signed-off-by: Yuki Okushi <jtitor@2k36.org>
2022-07-19Auto merge of #98180 - notriddle:notriddle/rustdoc-fn, ↵bors-11/+21
r=petrochenkov,GuillaumeGomez Improve the function pointer docs This is #97842 but for function pointers instead of tuples. The concept is basically the same. * Reduce duplicate impls; show `fn (T₁, T₂, …, Tₙ)` and include a sentence saying that there exists up to twelve of them. * Show `Copy` and `Clone`. * Show auto traits like `Send` and `Sync`, and blanket impls like `Any`. https://notriddle.com/notriddle-rustdoc-test/std/primitive.fn.html
2022-07-19Erase regions before comparing signatures of foreign fns.Camille GILLOT-0/+24
2022-07-19better error for bad depth on macro metavar exprMichael Goulet-8/+27
2022-07-19Do not allow typeck children items to constrain outer RPITsMichael Goulet-0/+54
2022-07-19Improve the function pointer docsMichael Howell-7/+17
* Reduce duplicate impls; show only the `fn (T)` and include a sentence saying that there exists up to twelve of them. * Show `Copy` and `Clone`. * Show auto traits like `Send` and `Sync`, and blanket impls like `Any`.
2022-07-19Rollup merge of #99457 - SparrowLii:para_iter, r=fee1-deadMatthias Krüger-3/+24
use `par_for_each_in` in `par_body_owners` and `collect_crate_mono_items` Using `par_iter` in non-parallel mode will cause the entire process to abort when any iteration panics. So we can use `par_for_each_in` instead to make the error message consistent with parallel mode. This means that the compiler will output more error messages in some cases. This fixes the following ui tests when set `parallel-compiler = true`: ``` [ui] src/test\ui\privacy\privacy2.rs [ui] src/test\ui\privacy\privacy3.rs [ui] src/test\ui\type_length_limit.rs ``` This refers to #68171 Updates #75760
2022-07-19Rollup merge of #99438 - WaffleLapkin:dont_wrap_in_non_zero, r=compiler-errorsMatthias Krüger-0/+123
Improve suggestions for `NonZeroT` <- `T` coercion error Currently, when encountering a type mismatch error with `NonZeroT` and `T` (for example `NonZeroU8` and `u8`) we errorneusly suggest wrapping expression in `NonZeroT`: ```text error[E0308]: mismatched types --> ./t.rs:7:35 | 7 | let _: std::num::NonZeroU64 = 1; | -------------------- ^ expected struct `NonZeroU64`, found integer | | | expected due to this | help: try wrapping the expression in `std::num::NonZeroU64` | 7 | let _: std::num::NonZeroU64 = std::num::NonZeroU64(1); | +++++++++++++++++++++ + ``` I've removed this suggestion and added suggestions to call `new` (for `Option<NonZeroT>` <- `T` case) or `new` and `unwrap` (for `NonZeroT` <- `T` case): ```text error[E0308]: mismatched types --> ./t.rs:7:35 | 7 | let _: std::num::NonZeroU64 = 1; | -------------------- ^ expected struct `NonZeroU64`, found integer | | | expected due to this | help: Consider calling `NonZeroU64::new` | 7 | let _: std::num::NonZeroU64 = NonZeroU64::new(1).unwrap(); | ++++++++++++++++ ++++++++++ error[E0308]: mismatched types --> ./t.rs:8:43 | 8 | let _: Option<std::num::NonZeroU64> = 1; | ---------------------------- ^ expected enum `Option`, found integer | | | expected due to this | = note: expected enum `Option<NonZeroU64>` found type `{integer}` help: Consider calling `NonZeroU64::new` | 8 | let _: Option<std::num::NonZeroU64> = NonZeroU64::new(1); | ++++++++++++++++ + ``` r? `@compiler-errors`
2022-07-19Rollup merge of #99435 - CAD97:revert-dollar-dollar-crate, r=Mark-SimulacrumMatthias Krüger-19/+55
Revert "Stabilize $$ in Rust 1.63.0" This mechanically reverts commit 9edaa76adce4de737db54194eb13d6c298827b37, the one commit from #95860. https://github.com/rust-lang/rust/issues/99035; the behavior of `$$crate` is potentially unexpected and not ready to be stabilized. https://github.com/rust-lang/rust/pull/99193 attempts to forbid `$$crate` without also destabilizing `$$` more generally. `@rustbot` modify labels +T-compiler +T-lang +P-medium +beta-nominated +relnotes (applying the labels I think are accurate from the issue and alternative partial revert) cc `@Mark-Simulacrum`
2022-07-19Rollup merge of #99384 - compiler-errors:issue-99375, r=oli-obkMatthias Krüger-0/+21
use body's param-env when checking if type needs drop The type comes from the body, so we should be using the body's param-env, as opposed to the ADT's param env, because we know less in the latter compared to the former. Fixes #99375
2022-07-19Rollup merge of #98028 - aticu:master, r=estebankMatthias Krüger-63/+194
Add E0790 as more specific variant of E0283 Fixes #81701 I think this should be good to go, there are only two things where I am somewhat unsure: - Is there a better way to get the fully-qualified path for the suggestion? I tried `self.tcx.def_path_str`, but that didn't seem to always give a correct path for the context. - Should all this be extracted into it's own method or is it fine where it is? r? `@estebank`
2022-07-19use `par_for_each_in` in `par_body_owners` and `collect_crate_mono_items`SparrowLii-3/+24