about summary refs log tree commit diff
path: root/src/test/ui
AgeCommit message (Collapse)AuthorLines
2022-08-05Improve diagnostics for `const a: = expr;`Maybe Waffle-54/+86
2022-08-05recover require,include instead of use in itemyukang-2/+30
2022-08-05Auto merge of #95977 - FabianWolff:issue-92790-dead-tuple, r=estebankbors-159/+240
Warn about dead tuple struct fields Continuation of #92972. Fixes #92790. The language team has already commented on this in https://github.com/rust-lang/rust/pull/92972#issuecomment-1021511970; I have incorporated their requests here. Specifically, there is now a new allow-by-default `unused_tuple_struct_fields` lint (name bikesheddable), and fields of unit type are ignored (https://github.com/rust-lang/rust/pull/92972#issuecomment-1021815408), so error messages look like this: ``` error: field is never read: `1` --> $DIR/tuple-struct-field.rs:6:21 | LL | struct Wrapper(i32, [u8; LEN], String); | ^^^^^^^^^ | help: change the field to unit type to suppress this warning while preserving the field numbering | LL | struct Wrapper(i32, (), String); | ~~ ``` r? `@joshtriplett`
2022-08-05remove an unnecessary `str::rfind`Takayuki Maeda-3/+6
2022-08-05Auto merge of #99867 - spastorino:refactor-remap-lifetimes, r=nikomatsakisbors-0/+7
Split create_def and lowering of lifetimes for opaque types and bare async fns r? `@cjgillot` This work is kind of half-way, but I think it could be merged anyway. I think we should be able to remove all the vacant arms in `new_named_lifetime_with_res`, if I'm not wrong that requires visiting more nodes. We can do that as a follow up. In follow-up PRs, besides the thing mentioned previously, I'll be trying to remove `LifetimeCaptureContext`, `captured_lifetimes` as a global data structure, global `binders_to_ignore` and all their friends :). Also try to remap in a more general way based on def-ids.
2022-08-04opt node typeMichael Goulet-2/+44
2022-08-04Explain why let-underscoring a lock guard is incorrect.Aaron Kofsky-2/+4
Currently, the let_underscore_lock lint simply tells what is wrong, but not why it is wrong. We fix this by using a `MultiSpan` to explain specifically that doing `let _ = ` immediately drops the lock guard because it does not assign the lock guard to a binding.
2022-08-04Rollup merge of #100093 - wcampbell0x2a:unused-parens-for-match-arms, ↵Matthias Krüger-0/+41
r=petrochenkov Enable unused_parens for match arms Fixes: https://github.com/rust-lang/rust/issues/92751 Currently I can't get the `stderr` to work with `./x.py test`, but this should fix the issue. Help would be appreciated!
2022-08-04Rollup merge of #100058 - ↵Matthias Krüger-0/+115
TaKO8Ki:suggest-positional-formatting-argument-instead-of-format-args-capture, r=estebank Suggest a positional formatting argument instead of a captured argument This patch fixes a part of #96999. fixes #98241 fixes #97311 r? `@estebank`
2022-08-04Rollup merge of #98796 - compiler-errors:no-semi-if-comma, r=estebankMatthias Krüger-12/+21
Do not exclusively suggest `;` when `,` is also a choice Fixes #96791
2022-08-04Add test for raw-dylib with an external variableDaniel Paoliello-7/+88
2022-08-04Completely remove captures flagSantiago Pastorino-0/+7
2022-08-04Enable unused_parens for match armswcampbell-0/+41
2022-08-04Auto merge of #99953 - cjgillot:in-path-always, r=petrochenkovbors-0/+17
Always create elided lifetimes, even if inferred. `PathSource` gives the context in which a path is encountered. The same `PathSource` is used for the full path and the `QSelf` part. Therefore, we can only rely on `PathSource` to know whether typechecking will be able to infer the lifetimes, not whether we need to insert them at all. Fixes https://github.com/rust-lang/rust/issues/99949
2022-08-04Use (actually) dummy place for let-else divergenceMichael Goulet-0/+15
2022-08-04Auto merge of #100120 - matthiaskrgr:rollup-g6ycykq, r=matthiaskrgrbors-11/+224
Rollup of 6 pull requests Successful merges: - #98771 (Add support for link-flavor rust-lld for iOS, tvOS and watchOS) - #98835 (relate `closure_substs.parent_substs()` to parent fn in NLL) - #99746 (Use `TraitEngine` in more places that don't specifically need `FulfillmentContext::new_in_snapshot`) - #99786 (Recover from C++ style `enum struct`) - #99795 (Delay a bug when failed to normalize trait ref during specialization) - #100029 (Prevent ICE for `doc_alias` on match arm, statement, expression) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-08-04Resolve vars before emitting coerce errorMichael Goulet-11/+100
2022-08-04Don't point out return span on every E0308Michael Goulet-5/+37
2022-08-04link_ordinal is available for foreign staticyukang-5/+18
2022-08-04Add ui test for #99910Obei Sideg-0/+30
2022-08-03Rollup merge of #100111 - estebank:missing-let, r=compiler-errorsMatthias Krüger-0/+26
Provide suggestion on missing `let` in binding statement Fix #78907. Fallout from the type ascription syntax.
2022-08-03Rollup merge of #100107 - klensy:tr-w, r=compiler-errorsMatthias Krüger-1/+1
fix trailing whitespace in error message
2022-08-03Rollup merge of #100105 - TaKO8Ki:add-regression-test-for-90871, ↵Matthias Krüger-0/+28
r=compiler-errors Add regression test for #90871 closes #90871
2022-08-03Rollup merge of #100029 - hdelc:master, r=cjgillotMatthias Krüger-11/+35
Prevent ICE for `doc_alias` on match arm, statement, expression Fixes #99777. This is a pretty minimal fix that should be safe, since rustdoc doesn't generate documentation for match arms, statements, or expressions. I mentioned in the linked issue that the `doc_alias` target checking should probably be improved to avoid future ICEs, but as a new contributor, I'm not confident enough with the HIR types to make a larger change.
2022-08-03Rollup merge of #99795 - ↵Matthias Krüger-0/+58
compiler-errors:delay-specialization-normalize-error, r=spastorino Delay a bug when failed to normalize trait ref during specialization The error messages still kinda suck here but they don't ICE anymore... Fixes #45814 Fixes #43037 r? types
2022-08-03Rollup merge of #99786 - obeis:issue-99625, r=compiler-errorsMatthias Krüger-0/+34
Recover from C++ style `enum struct` Closes #99625
2022-08-03Rollup merge of #98835 - aliemjay:relate_closure_substs, r=nikomatsakisMatthias Krüger-0/+97
relate `closure_substs.parent_substs()` to parent fn in NLL Fixes #98589 The discrepancy between early- and late-bound lifetimes is because we map early-bound lifetimes into those found in the `closure_substs` while late-bound lifetimes are mapped into liberated free regions: https://github.com/rust-lang/rust/blob/5f98537eb7b5f42c246a52c550813c3cff336069/compiler/rustc_borrowck/src/universal_regions.rs#L255-L261 r? `@rust-lang/types`
2022-08-03Bless ui tests.Camille GILLOT-58/+45
2022-08-03Provide suggestion on missing `let` in binding statementEsteban Küber-0/+26
Fix #78907.
2022-08-03Auto merge of #100064 - RalfJung:disaligned, r=petrochenkovbors-1/+150
fix is_disaligned logic for nested packed structs https://github.com/rust-lang/rust/pull/83605 broke the `is_disaligned` logic by bailing out of the loop in `is_within_packed` early. This PR fixes that problem and adds suitable tests. Fixes https://github.com/rust-lang/rust/issues/99838
2022-08-03fix is_disaligned logic for nested packed structsRalf Jung-1/+150
2022-08-03fix trailing whitespace in error messageklensy-1/+1
2022-08-03Warn about dead tuple struct fieldsFabian Wolff-159/+240
2022-08-03add regression test for #90871Takayuki Maeda-0/+28
2022-08-03Skip over structs with no private fields that impl DerefMichael Goulet-0/+49
2022-08-03Don't suggest field method if it's just missing some boundsMichael Goulet-16/+0
2022-08-03Consider privacy more carefully when suggesting accessing fieldsMichael Goulet-50/+0
2022-08-03Suggest expressions' fields even if they're not ADTsMichael Goulet-0/+74
2022-08-03Auto merge of #100082 - matthiaskrgr:rollup-ywu4iux, r=matthiaskrgrbors-104/+220
Rollup of 6 pull requests Successful merges: - #99933 (parallelize HTML checking tool) - #99958 (Improve position named arguments lint underline and formatting names) - #100008 (Update all pre-cloned submodules on startup) - #100049 (:arrow_up: rust-analyzer) - #100070 (Clarify Cargo.toml comments) - #100074 (rustc-docs: Be less specific about the representation of `+bundle`) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-08-03check link ordinal make sure target is foreign functionyukang-0/+41
2022-08-02Add items to `DocAliasBadLocation` check error match armhdelc-9/+9
- Added `Impl`, `Closure`, ForeignMod` targets - `Target::name` changed for `Target::Impl` - Error output for `Target::ForeignMod` changed to "foreign module"
2022-08-03add tests for `Debug` formatters and precision formattersTakayuki Maeda-1/+40
2022-08-03suggest a positional formatting argument instead of a captured argumentTakayuki Maeda-0/+76
2022-08-03Delay a bug when failed to normalize trait ref during specializationMichael Goulet-0/+58
2022-08-02Stabilize backtraceTheodore Dubois-4/+0
2022-08-02Auto merge of #92268 - jswrenn:transmute, r=oli-obkbors-0/+4128
Initial implementation of transmutability trait. *T'was the night before Christmas and all through the codebase, not a miri was stirring — no hint of `unsafe`!* This PR provides an initial, **incomplete** implementation of *[MCP 411: Lang Item for Transmutability](https://github.com/rust-lang/compiler-team/issues/411)*. The `core::mem::BikeshedIntrinsicFrom` trait provided by this PR is implemented on-the-fly by the compiler for types `Src` and `Dst` when the bits of all possible values of type `Src` are safely reinterpretable as a value of type `Dst`. What this PR provides is: - [x] [support for transmutations involving primitives](https://github.com/jswrenn/rust/tree/transmute/src/test/ui/transmutability/primitives) - [x] [support for transmutations involving arrays](https://github.com/jswrenn/rust/tree/transmute/src/test/ui/transmutability/arrays) - [x] [support for transmutations involving structs](https://github.com/jswrenn/rust/tree/transmute/src/test/ui/transmutability/structs) - [x] [support for transmutations involving enums](https://github.com/jswrenn/rust/tree/transmute/src/test/ui/transmutability/enums) - [x] [support for transmutations involving unions](https://github.com/jswrenn/rust/tree/transmute/src/test/ui/transmutability/unions) - [x] [support for weaker validity checks](https://github.com/jswrenn/rust/blob/transmute/src/test/ui/transmutability/unions/should_permit_intersecting_if_validity_is_assumed.rs) (i.e., `Assume::VALIDITY`) - [x] visibility checking What isn't yet implemented: - [ ] transmutability options passed using the `Assume` struct - [ ] [support for references](https://github.com/jswrenn/rust/blob/transmute/src/test/ui/transmutability/references.rs) - [ ] smarter error messages These features will be implemented in future PRs.
2022-08-02never consider unsafe blocks unused if they would be required with ↵Ralf Jung-599/+109
unsafe_op_in_unsafe_fn
2022-08-02Rollup merge of #99958 - PrestonFrom:issue_99907, r=compiler-errorsMatthias Krüger-104/+220
Improve position named arguments lint underline and formatting names For named arguments used as implicit position arguments, underline both the opening curly brace and either: * if there is formatting, the next character (which will either be the closing curl brace or the `:` denoting the start of formatting args) * if there is no formatting, the entire arg span (important if there is whitespace like `{ }`) This should make it more obvious where the named argument should be. Additionally, in the lint message, emit the formatting argument names without a dollar sign to avoid potentially confusion. Fixes #99907
2022-08-02Rollup merge of #100045 - Amanieu:global_asm_may_unwind, r=tmiaskoMatthias Krüger-36/+36
Properly reject the `may_unwind` option in `global_asm!` This was accidentally accepted even though it had no effect in `global_asm!`. The option only makes sense for `asm!` which runs within a function.
2022-08-02NLL: relate closure to parent fnAli MJ Al-Nasrawy-0/+97