about summary refs log tree commit diff
path: root/src/test/ui
AgeCommit message (Collapse)AuthorLines
2022-11-21Add more regression testsOli Scherer-0/+117
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-21Test generalization during coherenceOli Scherer-0/+13
2022-11-21nit treat different opaque typesOli Scherer-2/+1
2022-11-21Treat different opaque types of the same def id as equal during coherenceOli Scherer-0/+64
2022-11-21Allow opaque types in trait impl headers and rely on coherence to reject ↵Oli Scherer-160/+216
unsound cases
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-20Update VecDeque implementationMarkus Everling-1/+1
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-19Use `type_ascribe!` in many UI testsNilstrieb-224/+198
Use it in all UI tests that are about the semantics and not the syntax of type ascription.
2022-11-19fix test errouz-a-3/+4
2022-11-19re-add test and blessouz-a-1/+31
2022-11-19revert-overflowouz-a-39/+8
2022-11-19Refactor `must_use` lint into two partsNilstrieb-33/+56
Before, the lint did the checking for `must_use` and pretty printing the types in a special format in one pass, causing quite complex and untranslatable code. Now the collection and printing is split in two. That should also make it easier to translate or extract the type pretty printing in the future. Also fixes an integer overflow in the array length pluralization calculation.
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-18rustc_codegen_ssa: Fix for codegen_get_discrMichael Benfield-0/+36
When doing the optimized implementation of getting the discriminant, the arithmetic needs to be done in the tag type so wrapping behavior works correctly. Fixes #104519
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
2022-11-18Add testMichael Goulet-0/+47
2022-11-18diagnostics: only show one suggestion for method -> assoc fnMichael Howell-9/+4
Fixes #102354