about summary refs log tree commit diff
path: root/src/test/ui
AgeCommit message (Collapse)AuthorLines
2022-11-22Auto merge of #104711 - Dylan-DPC:rollup-gkw1qr8, r=Dylan-DPCbors-0/+36
Rollup of 6 pull requests Successful merges: - #104295 (Check generics parity before collecting return-position `impl Trait`s in trait) - #104464 (Reduce exceptions overallocation on non Windows x86_64) - #104615 (Create def_id for async fns during lowering) - #104669 (Only declare bindings for if-let guards once per arm) - #104701 (Remove a lifetime resolution hack from `compare_predicate_entailment`) - #104710 (disable strict-provenance-violating doctests in Miri) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-11-22Rollup merge of #104669 - LeSeulArtichaut:88015-if-let-guard-bindings, ↵Dylan DPC-0/+7
r=cjgillot Only declare bindings for if-let guards once per arm Currently, each candidate for a match arm uses separate locals for the bindings in the if-let guard, causing problems (#88015) when those branches converge in the arm body. Fixes #88015 (🤞)
2022-11-22Rollup merge of #104295 - compiler-errors:rpitit-generics-parity, r=eholkDylan DPC-0/+29
Check generics parity before collecting return-position `impl Trait`s in trait The only thing is that this duplicates the error message for number of generics mismatch, but we already deduplicate that error message in Cargo. I could add a flag to delay the error if the reviewer cares. Fixes #104281 Also drive-by adds a few comments to the `collect_trait_impl_trait_tys` method, and removes an unused argument from `compare_number_of_generics`.
2022-11-22Auto merge of #103578 - petrochenkov:nofict, r=nagisabors-294/+122
Unreserve braced enum variants in value namespace With this PR braced enum variants (`enum E { V { /*...*/ } }`) no longer take a slot in value namespace, so the special case mentioned in the note in https://github.com/rust-lang/rfcs/blob/master/text/1506-adt-kinds.md#braced-structs is removed. Report - https://github.com/rust-lang/rust/pull/103578#issuecomment-1292594900.
2022-11-22Delay bug to deduplicate diagnosticsMichael Goulet-11/+1
2022-11-22Check generics parity between impl and trait before collecting RPITITsMichael Goulet-0/+39
2022-11-22Auto merge of #104696 - matthiaskrgr:rollup-gi1pdb0, r=matthiaskrgrbors-3/+64
Rollup of 11 pull requests Successful merges: - #103396 (Pin::new_unchecked: discuss pinning closure captures) - #104416 (Fix using `include_bytes` in pattern position) - #104557 (Add a test case for async dyn* traits) - #104559 (Split `MacArgs` in two.) - #104597 (Probe + better error messsage for `need_migrate_deref_output_trait_object`) - #104656 (Move tests) - #104657 (Do not check transmute if has non region infer) - #104663 (rustdoc: factor out common button CSS) - #104666 (Migrate alias search result to CSS variables) - #104674 (Make negative_impl and negative_impl_exists take the right types) - #104692 (Update test's cfg-if dependency to 1.0) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-11-22Rollup merge of #104657 - hi-rustin:rustin-patch-check-transmute, ↵Matthias Krüger-0/+19
r=compiler-errors Do not check transmute if has non region infer close https://github.com/rust-lang/rust/issues/104609 See: https://github.com/rust-lang/rust/issues/104609#issuecomment-1320956351 r? `@compiler-errors`
2022-11-22Rollup merge of #104656 - c410-f3r:moar-errors, r=petrochenkovMatthias Krüger-0/+0
Move tests r? `@petrochenkov`
2022-11-22Rollup merge of #104597 - ↵Matthias Krüger-2/+2
compiler-errors:need_migrate_deref_output_trait_object-msg, r=eholk Probe + better error messsage for `need_migrate_deref_output_trait_object` 1. Use `InferCtxt::probe` in `need_migrate_deref_output_trait_object` -- that normalization *could* technically do type inference as a side-effect, and this is a lint, so it should have no side-effects. 2. Return the trait-ref so we format the error message correctly. See the UI test change -- `(dyn A + 'static)` is not a trait.
2022-11-22Rollup merge of #104557 - eholk:dyn-star-in-traits, r=compiler-errorsMatthias Krüger-0/+36
Add a test case for async dyn* traits This adds a test case that approximates async functions in dyn traits using `dyn*`. The purpose is to have an example of where we are with `dyn*` and the goal of using it for dyn traits. Issue #102425 r? `@compiler-errors`
2022-11-22Rollup merge of #104416 - clubby789:fix-104414, r=eholkMatthias Krüger-1/+7
Fix using `include_bytes` in pattern position Fix #104414
2022-11-21Simplify testOli Scherer-3/+1
Co-authored-by: lcnr <rust@lcnr.de>
2022-11-21Fix an ICE that I just made worseOli Scherer-0/+28
2022-11-21Unreserve braced enum variants in value namespaceVadim Petrochenkov-294/+122
2022-11-21Coercions work nowEric Holk-1/+1
2022-11-21Add a test case for async dyn* traitsEric Holk-0/+36
2022-11-21Auto merge of #104673 - matthiaskrgr:rollup-85f65ov, r=matthiaskrgrbors-22/+11
Rollup of 9 pull requests Successful merges: - #104420 (Fix doc example for `wrapping_abs`) - #104499 (rustdoc JSON: Use `Function` everywhere and remove `Method`) - #104500 (`rustc_ast`: remove `ref` patterns) - #104511 (Mark functions created for `raw-dylib` on x86 with DllImport storage class) - #104595 (Add `PolyExistentialPredicate` type alias) - #104605 (deduplicate constant evaluation in cranelift backend) - #104628 (Revert "Update CI to use Android NDK r25b") - #104662 (Streamline deriving on packed structs.) - #104667 (Revert formatting changes of a test) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-11-21Rollup merge of #104667 - WaffleLapkin:unfmttest, r=Dylan-DPCMatthias Krüger-5/+5
Revert formatting changes of a test See https://github.com/rust-lang/rust/pull/99935/files#r1027259119 cc ``@CAD97``
2022-11-21Rollup merge of #104662 - nnethercote:tweak-deriving-for-packed-non-copy, ↵Matthias Krüger-17/+6
r=jackh726 Streamline deriving on packed structs. The current approach to field accesses in derived code: - Normal case: `&self.0` - In a packed struct that derives `Copy`: `&{self.0}` - In a packed struct that doesn't derive `Copy`: `let Self(ref x) = *self` The `let` pattern used in the third case is equivalent to the simpler field access in the first case. This commit changes the third case to use a field access. The commit also combines two boolean arguments (`is_packed` and `always_copy`) into a single field (`copy_fields`) earlier, to save passing both around. r? ``@jackh726``
2022-11-21Auto merge of #103491 - cjgillot:self-rpit, r=oli-obkbors-79/+230
Support using `Self` or projections inside an RPIT/async fn I reuse the same idea as https://github.com/rust-lang/rust/pull/103449 to use variances to encode whether a lifetime parameter is captured by impl-trait. The current implementation of async and RPIT replace all lifetimes from the parent generics by `'static`. This PR changes the scheme ```rust impl<'a> Foo<'a> { fn foo<'b, T>() -> impl Into<Self> + 'b { ... } } opaque Foo::<'_a>::foo::<'_b, T>::opaque<'b>: Into<Foo<'_a>> + 'b; impl<'a> Foo<'a> { // OLD fn foo<'b, T>() -> Foo::<'static>::foo::<'static, T>::opaque::<'b> { ... } ^^^^^^^ the `Self` becomes `Foo<'static>` // NEW fn foo<'b, T>() -> Foo::<'a>::foo::<'b, T>::opaque::<'b> { ... } ^^ the `Self` stays `Foo<'a>` } ``` There is the same issue with projections. In the example, substitute `Self` by `<T as Trait<'b>>::Assoc` in the sugared version, and `Foo<'_a>` by `<T as Trait<'_b>>::Assoc` in the desugared one. This allows to support `Self` in impl-trait, since we do not replace lifetimes by `'static` any more. The same trick allows to use projections like `T::Assoc` where `Self` is allowed. The feature is gated behind a `impl_trait_projections` feature gate. The implementation relies on 2 tweaking rules for opaques in 2 places: - we only relate substs that correspond to captured lifetimes during TypeRelation; - we only list captured lifetimes in choice region computation. For simplicity, I encoded the "capturedness" of lifetimes as a variance, `Bivariant` vs `Invariant` for unused vs captured lifetimes. The `variances_of` query used to ICE for opaques. Impl-trait that do not reference `Self` or projections will have their variances as: - `o` (invariant) for each parent type or const; - `*` (bivariant) for each parent lifetime --> will not participate in borrowck; - `o` (invariant) for each own lifetime. Impl-trait that does reference `Self` and/or projections will have some parent lifetimes marked as `o` (as the example above), and participate in type relation and borrowck. In the example above, `variances_of(opaque) = ['_a: o, '_b: *, T: o, 'b: o]`. r? types cc `@compiler-errors` , as you asked about the issue with `Self` and projections.
2022-11-21Only declare bindings for if-let guards once per armLéo Lanteri Thauvin-0/+7
2022-11-21Revert formatting changes of a testMaybe Waffle-5/+5
2022-11-21Auto merge of #103454 - camsteffen:remove-conservatively-uninhabited, r=oli-obkbors-3/+3
Factor out `conservative_is_privately_uninhabited` After #102660 there is no more need for `conservative_is_privately_uninhabited`. r? `@oli-obk`
2022-11-21Streamline deriving on packed structs.Nicholas Nethercote-17/+6
The current approach to field accesses in derived code: - Normal case: `&self.0` - In a packed struct that derives `Copy`: `&{self.0}` - In a packed struct that doesn't derive `Copy`: `let Self(ref x) = *self` The `let` pattern used in the third case is equivalent to the simpler field access in the first case. This commit changes the third case to use a field access. The commit also combines two boolean arguments (`is_packed` and `always_copy`) into a single field (`copy_fields`) earlier, to save passing both around.
2022-11-20Factor out conservative_is_privately_uninhabitedCameron Steffen-2/+2
2022-11-20Change to Ty::is_inhabited_fromCameron Steffen-1/+1
2022-11-21Do not check transmute if has non region inferhi-rustin-0/+19
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2022-11-20Move testsCaio-0/+0
2022-11-20Rollup merge of #104504 - compiler-errors:fru-syntax-note, r=estebankMatthias Krüger-19/+65
Add a detailed note for missing comma typo w/ FRU syntax Thanks to `@pierwill` for working on this with me! Fixes #104373, perhaps `@alice-i-cecile` can comment on the new error for the example provided on that issue -- feedback is welcome. ``` error[E0063]: missing field `defaulted` in initializer of `Outer` --> $DIR/multi-line-fru-suggestion.rs:14:5 | LL | Outer { | ^^^^^ missing `defaulted` | note: this expression may have been misinterpreted as a `..` range expression --> $DIR/multi-line-fru-suggestion.rs:16:16 | LL | inner: Inner { | ________________^ LL | | a: 1, LL | | b: 2, LL | | } | |_________^ this expression does not end in a comma... LL | ..Default::default() | ^^^^^^^^^^^^^^^^^^^^ ... so this is interpreted as a `..` range expression, instead of functional record update syntax help: to set the remaining fields from `Default::default()`, separate the last named field with a comma | LL | }, | + error: aborting due to previous error For more information about this error, try `rustc --explain E0063`. ```
2022-11-20Auto merge of #103390 - compiler-errors:metadata-mod-regions, r=eholkbors-0/+17
Check fat pointer metadata compatibility modulo regions Regions don't really mean anything anyways during hir typeck. If this `erase_regions` makes anyone nervous, it's probably equally valid to just equate the types using a type relation, but regardless we should _not_ be using strict type equality while region variables are present. Fixes #103384
2022-11-20Auto merge of #98914 - fee1-dead-contrib:min-deref-patterns, r=compiler-errorsbors-0/+65
Minimal implementation of implicit deref patterns for Strings cc `@compiler-errors` `@BoxyUwU` https://github.com/rust-lang/lang-team/issues/88 #87121 ~~I forgot to add a feature gate, will do so in a minute~~ Done
2022-11-20Rollup merge of #104467 - ↵Yuki Okushi-0/+45
fuzzypixelz:fix/attempt-to-substract-with-overflow, r=compiler-errors Fix substraction with overflow in `wrong_number_of_generic_args.rs` Fixes #104287 This issue happens in the `suggest_moving_args_from_assoc_fn_to_trait_for_qualified_path` function, which seems to run before the error checking facilities can catch an invalid use of generic arguments. Thus we get a subtraction with overflow because the code implicitly assumes that the source program makes sense (or is this assumption not true even if the program is correct?).
2022-11-19Add a UI test to ensure rustc doesn't do arithmetic overflowsMahmoud Mazouz-0/+45
This relies on the CI testing a rustc that's compiled with overflow-checks = true
2022-11-19Rollup merge of #104593 - compiler-errors:rpitit-object-safety-spans, ↵Matthias Krüger-6/+46
r=fee1-dead Improve spans for RPITIT object-safety errors No reason why we can't point at the `impl Trait` that causes the object-safety violation. Also [drive-by: Add is_async fn to hir::IsAsync](https://github.com/rust-lang/rust/pull/104593/commits/c4165f3a965e258531928180195637455299c6f3), which touches clippy too.
2022-11-19Rollup merge of #104497 - lyming2007:issue-104379-fix, r=fee1-deadMatthias Krüger-1/+20
detect () to avoid redundant <> suggestion for type fix #104379
2022-11-19Rollup merge of #104469 - estebank:long-types, r=oli-obkMatthias Krüger-48/+55
Make "long type" printing type aware and trim types in E0275 Instead of simple string cutting, use a custom printer to hide parts of long printed types. On E0275, check for type length before printing.
2022-11-19Auto merge of #103509 - compiler-errors:opaques-w-bound-vars-r-hard, r=oli-obkbors-0/+47
Revert "Normalize opaques with escaping bound vars" This caused a perf regression in #103423, cc `@skyzh` this should fix #103423. reverts #100980 r? `@oli-obk`
2022-11-19Rollup merge of #104580 - notriddle:notriddle/issue-102354-hide-sugg, ↵Dylan DPC-9/+4
r=compiler-errors diagnostics: only show one suggestion for method -> assoc fn Fixes #102354
2022-11-19Rollup merge of #104575 - lcnr:dedup-tests, r=jackh726Dylan DPC-39/+9
deduplicate tests originally added in #100514. Using revisions for this reduces the amount of tests in the repo
2022-11-19Rollup merge of #104554 - BoxyUwU:less_unchecked_pls, r=lcnrDylan DPC-2/+1
Use `ErrorGuaranteed::unchecked_claim_error_was_emitted` less there are only like 3 or 4 call sites left after this but it wasnt obvious to me how to remove them
2022-11-19Rollup merge of #104411 - lcnr:bivariance-nll, r=compiler-errorsDylan DPC-0/+26
nll: correctly deal with bivariance fixes #104409 when in a bivariant context, relating stuff should always trivially succeed. Also changes the mir validator to correctly deal with higher ranked regions. r? types cc ``@RalfJung``
2022-11-19Probe + better error messsage for need_migrate_deref_output_trait_objectMichael Goulet-2/+2
2022-11-19Improve spans for RPITIT object-safety errorsMichael Goulet-6/+46
2022-11-18Auto merge of #104591 - Manishearth:rollup-b3ser4e, r=Manishearthbors-0/+135
Rollup of 8 pull requests Successful merges: - #102977 (remove HRTB from `[T]::is_sorted_by{,_key}`) - #103378 (Fix mod_inv termination for the last iteration) - #103456 (`unchecked_{shl|shr}` should use `u32` as the RHS) - #103701 (Simplify some pointer method implementations) - #104047 (Diagnostics `icu4x` based list formatting.) - #104338 (Enforce that `dyn*` coercions are actually pointer-sized) - #104498 (Edit docs for `rustc_errors::Handler::stash_diagnostic`) - #104556 (rustdoc: use `code-header` class to format enum variants) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-11-18Rollup merge of #104338 - compiler-errors:pointer-sized, r=eholkManish Goregaokar-0/+115
Enforce that `dyn*` coercions are actually pointer-sized Implement a perma-unstable, rudimentary `PointerSized` trait to enforce `dyn*` casts are `usize`-sized for now, at least to prevent ICEs and weird codegen issues from cropping up after monomorphization since currently we enforce *nothing*. This probably can/should be removed in favor of a more sophisticated trait for handling `dyn*` conversions when we decide on one, but I just want to get something up for discussion and experimentation for now. r? ```@eholk``` cc ```@tmandry``` (though feel free to claim/reassign) Fixes #102141 Fixes #102173
2022-11-18Rollup merge of #102977 - lukas-code:is-sorted-hrtb, r=m-ou-seManish Goregaokar-0/+20
remove HRTB from `[T]::is_sorted_by{,_key}` Changes the signature of `[T]::is_sorted_by{,_key}` to match `[T]::binary_search_by{,_key}` and make code like https://github.com/rust-lang/rust/issues/53485#issuecomment-885393452 compile. Tracking issue: https://github.com/rust-lang/rust/issues/53485 ~~Do we need an ACP for something like this?~~ Edit: Filed ACP here: https://github.com/rust-lang/libs-team/issues/121
2022-11-18Auto merge of #104573 - matthiaskrgr:rollup-k36ybtp, r=matthiaskrgrbors-0/+212
Rollup of 8 pull requests Successful merges: - #101162 (Migrate rustc_resolve to use SessionDiagnostic, part # 1) - #103386 (Don't allow `CoerceUnsized` into `dyn*` (except for trait upcasting)) - #103405 (Detect incorrect chaining of if and if let conditions and recover) - #103594 (Fix non-associativity of `Instant` math on `aarch64-apple-darwin` targets) - #104006 (Add variant_name function to `LangItem`) - #104494 (Migrate GUI test to use functions) - #104516 (rustdoc: clean up sidebar width CSS) - #104550 (fix a typo) Failed merges: - #104554 (Use `ErrorGuaranteed::unchecked_claim_error_was_emitted` less) r? `@ghost` `@rustbot` modify labels: rollup
2022-11-18Check both align and size in PointerSizedMichael Goulet-0/+48
2022-11-18Enforce that dyn* casts are actually pointer-sizedMichael Goulet-0/+67