about summary refs log tree commit diff
path: root/src/test/ui
AgeCommit message (Collapse)AuthorLines
2022-03-02Auto merge of #94514 - matthiaskrgr:rollup-pdzn82h, r=matthiaskrgrbors-0/+210
Rollup of 9 pull requests Successful merges: - #94464 (Suggest adding a new lifetime parameter when two elided lifetimes should match up for traits and impls.) - #94476 (7 - Make more use of `let_chains`) - #94478 (Fix panic when handling intra doc links generated from macro) - #94482 (compiler: fix some typos) - #94490 (Update books) - #94496 (tests: accept llvm intrinsic in align-checking test) - #94498 (9 - Make more use of `let_chains`) - #94503 (Provide C FFI types via core::ffi, not just in std) - #94513 (update Miri) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-03-02Rollup merge of #94464 - kckeiks:lifetime-elision-mismatch-hint-for-traits, ↵Matthias Krüger-0/+210
r=estebank Suggest adding a new lifetime parameter when two elided lifetimes should match up for traits and impls. Suggest adding a new lifetime parameter when two elided lifetimes should match up for functions in traits and impls. Issue #94462
2022-03-02Auto merge of #87402 - nagisa:nagisa/request-feature-requests-for-features, ↵bors-15/+65
r=estebank Direct users towards using Rust target feature names in CLI This PR consists of a couple of changes on how we handle target features. In particular there is a bug-fix wherein we avoid passing through features that aren't prefixed by `+` or `-` to LLVM. These appear to be causing LLVM to assert, which is pretty poor a behaviour (and also makes it pretty clear we expect feature names to be prefixed). The other commit, I anticipate to be somewhat more controversial is outputting a warning when users specify a LLVM-specific, or otherwise unknown, feature name on the CLI. In those situations we request users to either replace it with a known Rust feature name (e.g. `bmi` -> `bmi1`) or file a feature request. I've a couple motivations for this: first of all, if users are specifying these features on the command line, I'm pretty confident there is also a need for these features to be usable via `#[cfg(target_feature)]` machinery. And second, we're growing a fair number of backends recently and having ability to provide some sort of unified-ish interface in this place seems pretty useful to me. Sponsored by: standard.ai
2022-03-01update (bless) test resultsFausto-34/+34
2022-03-01Rollup merge of #94359 - tmiasko:legacy-verbose-const, r=petrochenkovMatthias Krüger-96/+1304
Fix inconsistent symbol mangling of integers constants with -Zverbose The `PrettyPrinter` changes formatting of array size and integer constants based on `-Zverbose`, so its implementation cannot be used in legacy symbol mangling. Example symbol demangling before changes: ```console $ cat a.rs pub struct A<T>(T); impl A<[u8; 128]> { pub fn f() {} } $ rustc --crate-type=lib a.rs -Zverbose=n && nm -C ./liba.rlib 00000000 T a::A<[u8; 128]>::f $ rustc --crate-type=lib a.rs -Zverbose=y && nm -C ./liba.rlib 00000000 T a::A<[u8; Const { ty. usize, val. Value(Scalar(0x0000000000000080)) }]>::f ```
2022-03-01Auto merge of #94471 - matthiaskrgr:rollup-ffz65qt, r=matthiaskrgrbors-8/+37
Rollup of 3 pull requests Successful merges: - #94438 (Check method input expressions once) - #94459 (Update cargo) - #94470 (:arrow_up: rust-analyzer) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-03-01Rollup merge of #94438 - compiler-errors:check-method-inputs-once, r=davidtwcoMatthias Krüger-8/+37
Check method input expressions once If the user mistakenly forgets to wrap their method args in a tuple, then the compiler tries to check that types within the tuple match the expression args. This means we call `check_expr` once within this diagnostic code, so when we check the expr once again in `demand_compatible`, we attempt to apply expr adjustments twice, leading to ICEs. This PR attempts to fix this by skipping the expression type check in `demand_compatible` if we have detected an method arg mismatch at all. This does lead to a single UI test regressing slightly, due to a diagnostic disappearing, though I don't know if it is generally meaningful to even raise an type error after noting that the argument count is incorrect in a function call, since the user might be providing (in-context) meaningless expressions to the wrong method. I can adjust this to be a bit more targeted (to just skip checking exprs in `demand_compatible` in the tuple case) if this UI test regression is a problem. fixes #94334 cc #94291 Also drive-by fixup of `.node_type(expr.hir_id)` to `.expr_ty(expr)`, since that method exists.
2022-03-01Rollup merge of #93926 - PatchMixolydic:bugfix/must_use-on-exprs, r=cjgillotDylan DPC-162/+493
Lint against more useless `#[must_use]` attributes This expands the existing `#[must_use]` check in `unused_attributes` to lint against pretty much everything `#[must_use]` doesn't support. Fixes #93906.
2022-03-01Rollup merge of #91545 - compiler-errors:deref-suggestion-improvements, ↵Dylan DPC-0/+120
r=estebank Generalize "remove `&`" and "add `*`" suggestions to more than one deref Suggest removing more than one `&` and `&mut`, along with suggesting adding more than one `*` (or a combination of the two). r? `@estebank` (since you're experienced with these types of suggestions, feel free to reassign)
2022-03-01Querify `global_backend_features`Simonas Kazlauskas-29/+2
At the very least this serves to deduplicate the diagnostics that are output about unknown target features provided via CLI.
2022-03-01Direct users towards using Rust feature names in CLISimonas Kazlauskas-15/+80
If they are trying to use features rustc doesn't yet know about, request a feature request. Additionally, also warn against using feature names without leading `+` or `-` signs.
2022-02-28Auto merge of #94299 - oli-obk:stable_hash_ty, r=michaelwoeristerbors-4/+4
Caching the stable hash of Ty within itself Instead of computing stable hashes on types as needed, we compute it during interning. This way we can, when a hash is requested, just hash that hash, which is significantly faster than traversing the type itself. We only do this for incremental for now, as incremental is the only frequent user of stable hashing. As a next step we can try out * moving the hash and TypeFlags to Interner, so projections and regions get the same benefit (tho regions are not nested, so maybe that's not a good idea? Would be nice for dedup tho) * start comparing types via their stable hash instead of their address?
2022-02-28Suggest adding a new lifetime parameter when two elided lifetimes should ↵Fausto-0/+210
match up for traits and impls. Issue #94462
2022-02-28Fix inconsistent symbol mangling of integers constants with -ZverboseTomasz Miąsko-2/+472
The `PrettyPrinter` changes formatting of array size and integer constants based on `-Zverbose`, so its implementation cannot be used in legacy symbol mangling.
2022-02-28Rollup merge of #94449 - GuillaumeGomez:explanation-e0726, r=UrgauMatthias Krüger-1/+6
Add long explanation for E0726 This is the cleaned up version of #87655 with the missing fixes. Part of https://github.com/rust-lang/rust/issues/61137. r? `@Urgau`
2022-02-28Rollup merge of #94414 - DrMeepster:box_alloc_ice2, r=tmiaskoMatthias Krüger-6/+23
Fix ICE when using Box<T, A> with large A A sequel to #94043 that fixes #81270 and #92054 (duplicate).
2022-02-28Rollup merge of #94248 - compiler-errors:fix-while-loop-bad-delay, ↵Matthias Krüger-0/+13
r=petrochenkov Fix ICE when passing block to while-loop condition We were incorrectly delaying a bug when we passed _any_ block (that evaluated to `()`) to a while loop. This PR makes the check a bit more sophisticated. We should only suppress the error here in cases that are equivalent to those we find in #93574 (i.e. only while loop conditions that have destructuring assignment expressions in them). Fixes #93997 cc `@estebank` who added this code I would not be opposed to removing the delay-bug altogether, and just emitting this error always. I much prefer duplicate errors over no errors.
2022-02-28Tweak diagnosticsEsteban Kuber-106/+164
* Recover from invalid `'label: ` before block. * Make suggestion to enclose statements in a block multipart. * Point at `match`, `while`, `loop` and `unsafe` keywords when failing to parse their expression. * Do not suggest `{ ; }`. * Do not suggest `|` when very unlikely to be what was wanted (in `let` statements).
2022-02-28Update ui test with the add of E0726 explanationGuillaume Gomez-1/+6
2022-02-28Rollup merge of #93389 - cameron1024:issue-90847-regression, r=Mark-SimulacrumMatthias Krüger-0/+9
regression for issue 90847 Adds a regression test for issue #90847
2022-02-28Auto merge of #94427 - cjgillot:inline-fresh-expn, r=oli-obkbors-4/+8
Only create a single expansion for each inline integration. The inlining integrator used to create one expansion for each span from the callee body. This PR reverses the logic to create a single expansion for the whole call, which is more consistent with how macro expansions work for macros. This should remove the large memory regression in #91743.
2022-02-27expadn abi check + condese & fix testsDrMeepster-7/+2
2022-02-27only check method inputs onceMichael Goulet-8/+37
2022-02-27fix ICE when passing empty block to while-loop conditionMichael Goulet-0/+13
2022-02-27Make deref suggestion betterMichael Goulet-0/+120
2022-02-27Do not pass through features without +/- prefixSimonas Kazlauskas-0/+12
LLVM really dislikes this and will assert, saying something along the lines of: ``` rustc: llvm/lib/MC/MCSubtargetInfo.cpp:60: void ApplyFeatureFlag( llvm::FeatureBitset&, llvm::StringRef, llvm::ArrayRef<llvm::SubtargetFeatureKV> ): Assertion `SubtargetFeatures::hasFlag(Feature) && "Feature flags should start with '+' or '-'"` failed. ```
2022-02-27Only create a single expansion for each inline integration.Camille GILLOT-4/+8
2022-02-27Lint against more useless `#[must_use]` attributesRuby Lazuli-162/+493
This expands the existing `#[must_use]` check in `unused_attributes` to lint against pretty much everything `#[must_use]` doesn't support. Fixes #93906.
2022-02-27fix box icing when it has aggregate abiDrMeepster-0/+22
2022-02-26Auto merge of #93516 - nagisa:branch-protection, r=cjgillotbors-1/+18
No branch protection metadata unless enabled Even if we emit metadata disabling branch protection, this metadata may conflict with other modules (e.g. during LTO) that have different branch protection metadata set. This is an unstable flag and feature, so ideally the flag not being specified should act as if the feature wasn't implemented in the first place. Additionally this PR also ensures we emit an error if `-Zbranch-protection` is set on targets other than the supported aarch64. For now the error is being output from codegen, but ideally it should be moved to earlier in the pipeline before stabilization.
2022-02-26Auto merge of #93449 - JakobDegen:restrict-hasdrop-optimization, r=cjgillotbors-0/+14
Restrict query recursion in `needs_significant_drop` Overly aggressive use of the query system to improve caching lead to query cycles and consequently ICEs. This patch fixes this by restricting the use of the query system as a cache to those cases where it is definitely correct. Closes #92725 . This is essentially a revert of #90845 for the significant drop case only. The general `needs_drop` still does the same thing. The hope is that this is enough to preserve the performance improvements of that PR while fixing the ICE. Should get a perf run to verify that this is the case. cc `@cjgillot`
2022-02-26Auto merge of #94078 - ↵bors-0/+329
TaKO8Ki:suggest-float-literal-for-float-divided-by-integer, r=estebank Suggest a float literal when dividing a floating-point type by `{integer}` closes #93829
2022-02-26Auto merge of #94392 - matthiaskrgr:rollup-npscf95, r=matthiaskrgrbors-3/+83
Rollup of 5 pull requests Successful merges: - #93400 (Do not suggest using a const parameter when there are bounds on an unused type parameter) - #93982 (Provide extra note if synthetic type args are specified) - #94087 (Remove unused `unsound_ignore_borrow_on_drop`) - #94235 (chalk: Fix wrong debrujin index in opaque type handling.) - #94306 (Avoid exhausting stack space in dominator compression) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-02-26Rollup merge of #94235 - Dirbaio:fix-chalk-opaque-debrujin, r=jackh726Matthias Krüger-0/+48
chalk: Fix wrong debrujin index in opaque type handling. A folder in opaque type lowering was substituting all opaque type references with a variable with debrujin index 0 ignoring how many binders deep we are. This caused an ICE with `Not enough bound vars: ^0 not found in []` ([full logs](https://gist.github.com/Dirbaio/2b9374ff4fce37afb9d665dc9f0000df)) with the following code. ```rust fn main() -> () {} async fn foo(x: u32) -> u32 { x } ``` With the fix, it no longer ICEs. It still doesn't typecheck due to generator issues. I've added a "known-bug" test so that at least it doesn't regress back to ICEing. r? ``@jackh726``
2022-02-26Rollup merge of #93982 - nbdd0121:explicit-generic-args, r=jackh726Matthias Krüger-0/+1
Provide extra note if synthetic type args are specified Implement the unresolved question in #83701 as suggested in https://github.com/rust-lang/rust/pull/86176#discussion_r680613890. r? ``@jackh726``
2022-02-26Rollup merge of #93400 - ↵Matthias Krüger-3/+34
ChayimFriedman2:dont-suggest-using-const-with-bounds-unused-generic-param, r=jackh726 Do not suggest using a const parameter when there are bounds on an unused type parameter The user wrote the bound, so it's obvious they want a type.
2022-02-26suggest a float literal when dividing a floating-point type by {integer}Takayuki Maeda-0/+329
fix a message implement a rustfix-applicable suggestion implement `suggest_floating_point_literal` add `ObligationCauseCode::BinOp` remove duplicate code fix function names in uitests use `Diagnostic` instead of `DiagnosticBuilder`
2022-02-26Auto merge of #92884 - compiler-errors:const-generic-expr-recovery, r=jackh726bors-0/+81
Suggest adding `{ .. }` around more bad const generic exprs Fixes #92776
2022-02-26Provide extra note if synthetic type args are specifiedGary Guo-0/+1
2022-02-25Suggest {} around more bad const generic exprsMichael Goulet-0/+81
2022-02-26Rollup merge of #94377 - cynecx:fix-used-with-args, r=nikicMatthias Krüger-0/+9
`check_used` should only look at actual `used` attributes cc? https://github.com/rust-lang/rust/issues/94348 r? ``@nikic``
2022-02-26Rollup merge of #94355 - ouz-a:master, r=oli-bokMatthias Krüger-0/+36
Add one more case to avoid ICE Fix for the #94291, added one more case to related function to avoid ICE. Not sure if my test is in the correct place 😅
2022-02-26Rollup merge of #93870 - tmiasko:const-precise-live-drops-with-coverage, ↵Matthias Krüger-0/+16
r=ecstatic-morse Fix switch on discriminant detection in a presence of coverage counters Fixes #93848. r? ``@ecstatic-morse``
2022-02-25Add one more case to avoid ICEouz-a-0/+36
2022-02-25`check_used` should only look at actual `used` attributescynecx-0/+9
2022-02-25Rollup merge of #94353 - flip1995:fix_debug_assert_unused, r=Dylan-DPCMatthias Krüger-6/+6
Fix debug_assert in unused lint pass This fixes a debug assertion in the unused lint pass. As a side effect, this also improves the span generated for tuples in the `unused_must_use` lint. found in #94329 A reproducer for this would be ```rust fn main() { (1, (3,)); } ``` Not sure, if I should add a regression test for a `debug_assert`.
2022-02-25Rollup merge of #93850 - asquared31415:extern-static-size-ice, r=jackh726Matthias Krüger-0/+63
Don't ICE when an extern static is too big for the current architecture Fixes #93760 Emit an error instead of ICEing when an `extern` static's size overflows the allowed maximum for the target. Changes the error message in the existing `delay_span_bug` call to the true layout error, first for debugging purposes, but opted to leave in to potentially assist future developers as it was being reached in unexpected ways already.
2022-02-25Test legacy type manglingTomasz Miąsko-0/+640
2022-02-25Test legacy mangling of bool, char and integer constantsTomasz Miąsko-96/+194
The existing v0 tests have been slightly adjusted for compatibility with legacy mangler, which requires an item to have an ancestor in a value namespace or a type namespace to produce a symbol for it. In v0 mangling this results in an extra `Nv` component.
2022-02-25Rollup merge of #94344 - notriddle:notriddle/suggest-parens-more, r=oli-obkMatthias Krüger-1/+135
diagnostic: suggest parens when users want logical ops, but get closures Fixes #93536