about summary refs log tree commit diff
path: root/src/test/ui
AgeCommit message (Collapse)AuthorLines
2022-07-05Rollup merge of #98860 - RalfJung:dangling-int-ptr, r=davidtwcoMatthias Krüger-32/+32
adjust dangling-int-ptr error message based on suggestions by `@saethlin` in https://github.com/rust-lang/miri/issues/2163 Fixes https://github.com/rust-lang/miri/issues/2163 I also did a bit of refactoring on this, so we have a helper method to create a `Pointer` with `None` provenance.
2022-07-05adjust dangling-int-ptr error messageRalf Jung-32/+32
2022-07-05Rollup merge of #98624 - davidtwco:translation-on-lints, r=compiler-errorsDylan DPC-52/+52
lints: mostly translatable diagnostics As lints are created slightly differently than other diagnostics, intended to try make them translatable first and then look into the applicability of diagnostic structs but ended up just making most of the diagnostics in the crate translatable (which will still be useful if I do make a lot of them structs later anyway). r? ``@compiler-errors``
2022-07-05Rollup merge of #98873 - ↵Dylan DPC-0/+22
TaKO8Ki:suggest-default-derive-to-enum-with-default-attribute, r=fee1-dead Suggest `#[derive(Default)]` to enums with `#[default]` fixes #95226
2022-07-05Rollup merge of #98761 - lcnr:need_type_info-cont, r=estebankDylan DPC-24/+86
more `need_type_info` improvements this now deals with macros in suggestions and the source cost computation does what I want for `channel` :tada: r? ``@estebank``
2022-07-05Avoid the unnecessary innermost match in `partial_cmp`/`cmp`.Nicholas Nethercote-105/+23
We currently do a match on the comparison of every field in a struct or enum variant. But the last field has a degenerate match like this: ``` match ::core::cmp::Ord::cmp(&self.y, &other.y) { ::core::cmp::Ordering::Equal => ::core::cmp::Ordering::Equal, cmp => cmp, }, ``` This commit changes it to this: ``` ::core::cmp::Ord::cmp(&self.y, &other.y), ``` This is fairly straightforward thanks to the existing `cs_fold1` function. The commit also removes the `cs_fold` function which is no longer used. (Note: there is some repetition now in `cs_cmp` and `cs_partial_cmp`. I will remove that in a follow-up PR.)
2022-07-04Rollup merge of #98879 - compiler-errors:async-closure-wrap-parens, r=oli-obkMatthias Krüger-2/+22
Fix "wrap closure in parenthesis" suggestion for `async` closure Fixes #98023
2022-07-04Rollup merge of #98782 - compiler-errors:specialization-error-span, r=oli-obkMatthias Krüger-11/+11
Improve spans for specialization error Fixes #98777
2022-07-04`InferSource::GenericArg`, check for containslcnr-13/+22
2022-07-04resolve vars in node substslcnr-2/+11
2022-07-04stop suggesting things inside of macroslcnr-8/+6
2022-07-04update infer cost computation for typeslcnr-15/+61
2022-07-04suggest `#[derive(Default)]` to enums with `#[default]`Takayuki Maeda-0/+22
2022-07-04Auto merge of #98641 - lcnr:mir-dropck, r=oli-obkbors-76/+18
fully move dropck to mir r? `@oli-obk`
2022-07-04Avoid unnecessary 1-tuples in derived code.Nicholas Nethercote-31/+31
2022-07-04Don't repeat `AssertParamIs{Clone,Eq}` assertions.Nicholas Nethercote-13/+0
It's common to see repeated assertions like this in derived `clone` and `eq` methods: ``` let _: ::core::clone::AssertParamIsClone<u32>; let _: ::core::clone::AssertParamIsClone<u32>; ``` This commit avoids them.
2022-07-04Avoid unnecessary blocks in derive output.Nicholas Nethercote-316/+260
By not committing to either block form or expression form until necessary, we can avoid lots of unnecessary blocks.
2022-07-04Add 0-variant and 1-variant enums to the `deriving-all-codegen.rs` test.Nicholas Nethercote-0/+176
Because they are interesting cases with their own code generation paths.
2022-07-04Add a union to the `deriving-all-codegen.rs` test.Nicholas Nethercote-0/+26
Because `derive(Clone)` on unions triggers special behaviour.
2022-07-04fully move dropck to mirlcnr-76/+18
2022-07-04Fix wrap parenthesis suggestion for async closureMichael Goulet-2/+22
2022-07-04Rollup merge of #98870 - TaKO8Ki:add-regression-test-for-86784, ↵Matthias Krüger-0/+2597
r=compiler-errors Add regression test for #86784 closes #86784
2022-07-04Rollup merge of #98823 - compiler-errors:rust-call-mir-inline, r=cjgillotMatthias Krüger-0/+3
Fix rust-call ICE in mir-inliner Fixes #98821 r? ``@cjgillot``
2022-07-04add regression test for #86784Takayuki Maeda-0/+2597
2022-07-04Auto merge of #98446 - nnethercote:derive-no-match-destructuring, r=scottmcmbors-325/+252
Don't use match-destructuring for derived ops on structs. r? `@scottmcm`
2022-07-04Don't use match-destructuring for derived ops on structs.Nicholas Nethercote-358/+173
All derive ops currently use match-destructuring to access fields. This is reasonable for enums, but sub-optimal for structs. E.g.: ``` fn eq(&self, other: &Point) -> bool { match *other { Self { x: ref __self_1_0, y: ref __self_1_1 } => match *self { Self { x: ref __self_0_0, y: ref __self_0_1 } => (*__self_0_0) == (*__self_1_0) && (*__self_0_1) == (*__self_1_1), }, } } ``` This commit changes derive ops on structs to use field access instead, e.g.: ``` fn eq(&self, other: &Point) -> bool { self.x == other.x && self.y == other.y } ``` This is faster to compile, results in smaller binaries, and is simpler to generate. Unfortunately, we have to keep the old pattern generating code around for `repr(packed)` structs because something like `&self.x` (which doesn't show up in `PartialEq` ops, but does show up in `Debug` and `Hash` ops) isn't allowed. But this commit at least changes those cases to use let-destructuring instead of match-destructuring, e.g.: ``` fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { { let Self(ref __self_0_0) = *self; { ::core::hash::Hash::hash(&(*__self_0_0), state) } } } ``` There are some unnecessary blocks remaining in the generated code, but I will fix them in a follow-up PR.
2022-07-04Add an interesting case to the `deriving-all-codegen.rs` test.Nicholas Nethercote-2/+114
2022-07-02Fix rust-call ICE in mir-inlinerMichael Goulet-0/+3
2022-07-02Rollup merge of #98715 - matthiaskrgr:test_97047, r=Mark-SimulacrumRalf Jung-0/+86
add ice test for #97047 Fixes #97047
2022-07-02Rollup merge of #98701 - TaKO8Ki:add-regression-test-for-50439, ↵Ralf Jung-0/+39
r=Mark-Simulacrum Add regression test for #50439 closes #50439
2022-07-02Auto merge of #97235 - nbdd0121:unwind, r=Amanieubors-14/+124
Fix FFI-unwind unsoundness with mixed panic mode UB maybe introduced when an FFI exception happens in a `C-unwind` foreign function and it propagates through a crate compiled with `-C panic=unwind` into a crate compiled with `-C panic=abort` (#96926). To prevent this unsoundness from happening, we will disallow a crate compiled with `-C panic=unwind` to be linked into `panic-abort` *if* it contains a call to `C-unwind` foreign function or function pointer. If no such call exists, then we continue to allow such mixed panic mode linking because it's sound (and stable). In fact we still need the ability to do mixed panic mode linking for std, because we only compile std once with `-C panic=unwind` and link it regardless panic strategy. For libraries that wish to remain compile-once-and-linkable-to-both-panic-runtimes, a `ffi_unwind_calls` lint is added (gated under `c_unwind` feature gate) to flag any FFI unwind calls that will cause the linkable panic runtime be restricted. In summary: ```rust #![warn(ffi_unwind_calls)] mod foo { #[no_mangle] pub extern "C-unwind" fn foo() {} } extern "C-unwind" { fn foo(); } fn main() { // Call to Rust function is fine regardless ABI. foo::foo(); // Call to foreign function, will cause the crate to be unlinkable to panic-abort if compiled with `-Cpanic=unwind`. unsafe { foo(); } //~^ WARNING call to foreign function with FFI-unwind ABI let ptr: extern "C-unwind" fn() = foo::foo; // Call to function pointer, will cause the crate to be unlinkable to panic-abort if compiled with `-Cpanic=unwind`. ptr(); //~^ WARNING call to function pointer with FFI-unwind ABI } ``` Fix #96926 `@rustbot` label: T-compiler F-c_unwind
2022-07-02Auto merge of #91743 - cjgillot:enable_mir_inlining_inline_all, r=oli-obkbors-79/+24
Enable MIR inlining Continuation of https://github.com/rust-lang/rust/pull/82280 by `@wesleywiser.` #82280 has shown nice compile time wins could be obtained by enabling MIR inlining. Most of the issues in https://github.com/rust-lang/rust/issues/81567 are now fixed, except the interaction with polymorphization which is worked around specifically. I believe we can proceed with enabling MIR inlining in the near future (preferably just after beta branching, in case we discover new issues). Steps before merging: - [x] figure out the interaction with polymorphization; - [x] figure out how miri should deal with extern types; - [x] silence the extra arithmetic overflow warnings; - [x] remove the codegen fulfilment ICE; - [x] remove the type normalization ICEs while compiling nalgebra; - [ ] tweak the inlining threshold.
2022-07-02Handle fresh lifetimes on bare trait objects.Camille GILLOT-71/+2
2022-07-02Add known bug test.Camille GILLOT-0/+118
2022-07-01Improve spans for specialization errorMichael Goulet-11/+11
2022-07-01Auto merge of #98781 - GuillaumeGomez:rollup-798kb8u, r=GuillaumeGomezbors-89/+108
Rollup of 5 pull requests Successful merges: - #97249 (`<details>`/`<summary>` UI fixes) - #98418 (Allow macOS to build LLVM as shared library) - #98460 (Use CSS variables to handle theming) - #98497 (Improve some inference diagnostics) - #98708 (rustdoc: fix 98690 Panic if invalid path for -Z persist-doctests) Failed merges: - #98761 (more `need_type_info` improvements) r? `@ghost` `@rustbot` modify labels: rollup
2022-07-01Rollup merge of #98497 - compiler-errors:span-inference-note, r=lcnrGuillaume Gomez-89/+108
Improve some inference diagnostics - Properly point out point location where "type must be known at this point", or else omit the note if it's not associated with a useful span. - Fix up some type ambiguity diagnostics, errors shouldn't say "cannot infer type for reference `&'a ()`" when the given type has no inference variables.
2022-07-01Auto merge of #93967 - cjgillot:short-struct-span, r=petrochenkovbors-3402/+2034
Shorten def_span for more items. The `def_span` query only returns the signature span for functions. Struct/enum/union definitions can also have a very long body. This PR shortens the associated span.
2022-07-01Move Sized check before first error is createdMichael Goulet-10/+7
2022-07-01Don't point at Self type if we can't find an infer variable in ambiguous ↵Michael Goulet-30/+50
trait predicate
2022-07-01Show source of ambiguity in a few more placesMichael Goulet-17/+32
2022-07-01Only label place where type is needed if span is meaningfulMichael Goulet-32/+19
2022-07-01Auto merge of #98767 - Dylan-DPC:rollup-j1gq5sr, r=Dylan-DPCbors-1/+316
Rollup of 6 pull requests Successful merges: - #97488 (Suggest blanket impl to the local traits) - #98585 (Make `ThinBox<T>` covariant in `T`) - #98644 (fix ICE with -Wrust-2021-incompatible-closure-captures) - #98739 (fix grammar in useless doc comment lint) - #98741 (Many small deriving cleanups) - #98756 (Use const instead of function and make it private) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-07-01Bless recursion test.Camille GILLOT-2/+3
2022-07-01Shorten def_span for more items.Camille GILLOT-3402/+2034
2022-07-01Rollup merge of #98739 - euclio:useless-comment-plural, r=Dylan-DPCDylan DPC-1/+1
fix grammar in useless doc comment lint
2022-07-01Rollup merge of #98644 - matthiaskrgr:drp_loc_span_err__2021_inc_clos_cap, ↵Dylan DPC-0/+150
r=lcnr fix ICE with -Wrust-2021-incompatible-closure-captures Fixes #93117 Fixes #96258
2022-07-01Rollup merge of #97488 - vincenzopalazzo:macros/blanket_sugg, r=compiler-errorsDylan DPC-0/+165
Suggest blanket impl to the local traits This PR will add additional suggestion regarding the blanket implementation when it is possible, by generation a new help message + suggestion. Closes https://github.com/rust-lang/rust/issues/96076 Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
2022-07-01Auto merge of #98402 - cjgillot:undead, r=michaelwoeristerbors-96/+115
Rewrite dead-code pass to avoid fetching HIR. This allows to get a more uniform handling of spans, and to simplify the grouping of diagnostics for variants and fields.
2022-07-01Remove type flag based opaque type workaroundOli Scherer-173/+30