about summary refs log tree commit diff
path: root/tests
AgeCommit message (Collapse)AuthorLines
2023-01-26Auto merge of #107328 - matthiaskrgr:rollup-lfqwo0o, r=matthiaskrgrbors-226/+269
Rollup of 8 pull requests Successful merges: - #106904 (Preserve split DWARF files when building archives.) - #106971 (Handle diagnostics customization on the fluent side (for one specific diagnostic)) - #106978 (Migrate mir_build's borrow conflicts) - #107150 (`ty::tls` cleanups) - #107168 (Use a type-alias-impl-trait in `ObligationForest`) - #107189 (Encode info for Adt in a single place.) - #107322 (Custom mir: Add support for some remaining, easy to support constructs) - #107323 (Disable ConstGoto opt in cleanup blocks) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2023-01-26Rollup merge of #107322 - JakobDegen:custom-mir, r=tmiaskoMatthias Krüger-4/+46
Custom mir: Add support for some remaining, easy to support constructs Some documentation for previous changes and support for `Deinit`, checked binops, len, and array repetition r? ```@oli-obk``` or ```@tmiasko```
2023-01-26Rollup merge of #106978 - mejrs:mir_build3, r=davidtwcoMatthias Krüger-216/+216
Migrate mir_build's borrow conflicts This also changes the error message slightly, for two reasons: - I'm not a fan of saying "value borrowed, by `x`, here" - it simplifies the error implementation significantly.
2023-01-26Rollup merge of #106971 - oli-obk:tait_error, r=davidtwcoMatthias Krüger-4/+5
Handle diagnostics customization on the fluent side (for one specific diagnostic) r? ```@davidtwco```
2023-01-26Rollup merge of #106904 - khuey:preserve_debuginfo_for_rlibs, r=davidtwcoMatthias Krüger-2/+2
Preserve split DWARF files when building archives. r? ```@davidtwco```
2023-01-26Auto merge of #106745 - m-ou-se:format-args-ast, r=oli-obkbors-28/+21
Move format_args!() into AST (and expand it during AST lowering) Implements https://github.com/rust-lang/compiler-team/issues/541 This moves FormatArgs from rustc_builtin_macros to rustc_ast_lowering. For now, the end result is the same. But this allows for future changes to do smarter things with format_args!(). It also allows Clippy to directly access the ast::FormatArgs, making things a lot easier. This change turns the format args types into lang items. The builtin macro used to refer to them by their path. After this change, the path is no longer relevant, making it easier to make changes in `core`. This updates clippy to use the new language items, but this doesn't yet make clippy use the ast::FormatArgs structure that's now available. That should be done after this is merged.
2023-01-26Custom mir: Add support for some remaining, easy to support constructsJakob Degen-4/+46
2023-01-26Auto merge of #107318 - matthiaskrgr:rollup-776kd81, r=matthiaskrgrbors-4/+164
Rollup of 9 pull requests Successful merges: - #97373 (impl DispatchFromDyn for Cell and UnsafeCell) - #106625 (Remove backwards compat for LLVM 12 coverage format) - #106779 (Avoid __cxa_thread_atexit_impl on Emscripten) - #106811 (Append .dwp to the binary filename instead of replacing the existing extension.) - #106836 (Remove optimistic spinning from `mpsc::SyncSender`) - #106946 (implement Hash for proc_macro::LineColumn) - #107074 (remove unnecessary check for opaque types) - #107287 (Improve fn pointer notes) - #107304 (Use `can_eq` to compare types for default assoc type error) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2023-01-26Rollup merge of #107304 - ↵Matthias Krüger-3/+32
Nilstrieb:ᐸTy as PartialEqᐳ::eq because what else are we gonna use in rustc_middle, r=compiler-errors Use `can_eq` to compare types for default assoc type error This correctly handles inference variables like `{integer}`. I had to move all of this `note_and_explain` code to `rustc_infer`, it made no sense for it to be in `rustc_middle` anyways. The commits are reviewed separately. Fixes #106968
2023-01-26Rollup merge of #107287 - mattjperez:improve-fn-pointer-notes, r=compiler-errorsMatthias Krüger-1/+9
Improve fn pointer notes continuation of #105552 r? `@compiler-errors`
2023-01-26Rollup merge of #97373 - dimpolo:cell_dispatch_from_dyn, r=dtolnayMatthias Krüger-0/+123
impl DispatchFromDyn for Cell and UnsafeCell After some fruitful discussion on [Internals](https://internals.rust-lang.org/t/impl-dispatchfromdyn-for-cell-2/16520) here's my first PR to rust-lang/rust 🎉 Please let me know if there's something I missed. This adds `DispatchFromDyn` impls for `Cell`, `UnsafeCell` and `SyncUnsafeCell`. An existing test is also expanded to test the `Cell` impl (which requires the `UnsafeCell` impl) The different `RefCell` types can not implement `DispatchFromDyn` since they have more than one (non ZST) field. &nbsp; **Edit:** ### What: These changes allow one to make types like `MyRc`(code below), to be object safe method receivers after implementing `DispatchFromDyn` and `Deref` for them. This allows for code like this: ```rust struct MyRc<T: ?Sized>(Cell<NonNull<RcBox<T>>>); /* impls for DispatchFromDyn, CoerceUnsized and Deref for MyRc*/ trait Trait { fn foo(self: MyRc<Self>); } let impls_trait = ...; let rc = MyRc::new(impls_trait) as MyRc<dyn Trait>; rc.foo(); ``` Note: `Cell` and `UnsafeCell` won't directly become valid method receivers since they don't implement `Deref`. Making use of these changes requires a wrapper type and nightly features. ### Why: A custom pointer type with interior mutability allows one to store extra information in the pointer itself. These changes allow for such a type to be a method receiver. ### Examples: My use case is a cycle aware custom `Rc` implementation that when dropping a cycle marks some references dangling. On the [forum](https://internals.rust-lang.org/t/impl-dispatchfromdyn-for-cell/14762/8) andersk mentioned that they track if a `Gc` reference is rooted with an extra bit in the reference itself.
2023-01-26Auto merge of #107314 - matthiaskrgr:rollup-j40lnlj, r=matthiaskrgrbors-43/+774
Rollup of 11 pull requests Successful merges: - #106407 (Improve proc macro attribute diagnostics) - #106960 (Teach parser to understand fake anonymous enum syntax) - #107085 (Custom MIR: Support binary and unary operations) - #107086 (Print PID holding bootstrap build lock on Linux) - #107175 (Fix escaping inference var ICE in `point_at_expr_source_of_inferred_type`) - #107204 (suggest qualifying bare associated constants) - #107248 (abi: add AddressSpace field to Primitive::Pointer ) - #107272 (Implement ObjectSafe and WF in the new solver) - #107285 (Implement `Generator` and `Future` in the new solver) - #107286 (ICE in new solver if we see an inference variable) - #107313 (Add Style Team Triagebot config) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2023-01-26Rollup merge of #107285 - compiler-errors:new-solver-future-and-generator, ↵Matthias Krüger-0/+132
r=lcnr Implement `Generator` and `Future` in the new solver r? `@lcnr`
2023-01-26Rollup merge of #107248 - erikdesjardins:addrspace, r=oli-obkMatthias Krüger-0/+25
abi: add AddressSpace field to Primitive::Pointer ...and remove it from `PointeeInfo`, which isn't meant for this. There are still various places (marked with FIXMEs) that assume all pointers have the same size and alignment. Fixing this requires parsing non-default address spaces in the data layout string (and various other changes), which will be done in a followup. (That is, if it's actually worth it to support multiple different pointer sizes. There is a lot of code that would be affected by that.) Fixes #106367 r? ``@oli-obk`` cc ``@Patryk27``
2023-01-26Rollup merge of #107204 - euclio:assoc-const-suggestion, r=petrochenkovMatthias Krüger-0/+25
suggest qualifying bare associated constants Fixes #107199.
2023-01-26Rollup merge of #107175 - compiler-errors:bad-types-in-vec-push, r=estebankMatthias Krüger-0/+49
Fix escaping inference var ICE in `point_at_expr_source_of_inferred_type` Fixes #107158 `point_at_expr_source_of_inferred_type` uses `lookup_probe` to adjust the self type of a method receiver -- but that method returns inference variables from inside a probe. That means that the ty vars are no longer valid, so we can't use any infcx methods on them. Also, pass some extra span info to hack a quick solution to bad labels, resulting in this diagnostic improvement: ```rust fn example2() { let mut x = vec![1]; x.push(""); } ``` ```diff error[E0308]: mismatched types --> src/main.rs:5:12 | 5 | x.push(""); | ---- ^^ | | | | | expected integer, found `&str` - | | this is of type `&'static str`, which causes `x` to be inferred as `Vec<{integer}>` | arguments to this method are incorrect ``` (since that "which causes `x` to be inferred as `Vec<{integer}>` part is wrong) r? `@estebank` (we really should make this code better in general, cc #106590, but that's a bit bigger issue that needs some more thinking about)
2023-01-26Rollup merge of #107085 - tmiasko:custom-mir-operators, r=oli-obkMatthias Krüger-0/+54
Custom MIR: Support binary and unary operations Lower binary and unary operations directly to corresponding unchecked MIR operations. Ultimately this might not be syntax we want, but it allows for experimentation in the meantime. r? ````@oli-obk```` ````@JakobDegen````
2023-01-26Rollup merge of #106960 - estebank:parse-anon-enums, r=cjgillotMatthias Krüger-27/+160
Teach parser to understand fake anonymous enum syntax Parse `Ty | OtherTy` in function argument and return types. Parse type ascription in top level patterns. Minimally address #100741.
2023-01-26Rollup merge of #106407 - mejrs:attr_check, r=compiler-errorsMatthias Krüger-16/+329
Improve proc macro attribute diagnostics Closes https://github.com/rust-lang/rust/issues/102923
2023-01-26improve fn pointer notesMatthew J Perez-1/+9
- add note and suggestion for casting both expected and found fn items to fn pointers - add note for casting expected fn item to fn pointer
2023-01-26Implement Generator and FutureMichael Goulet-0/+132
2023-01-26Auto merge of #105582 - saethlin:instcombine-assert-inhabited, r=cjgillotbors-0/+162
InstCombine away intrinsic validity assertions This optimization (currently) fires 246 times on the standard library. It seems to fire hardly at all on the big crates in the benchmark suite. Interesting.
2023-01-25Rollup merge of #107282 - BoxyUwU:erica_builtin_pointee_impls, r=compiler-errorsMatthias Krüger-0/+23
erica solver: implement builtin `Pointee` trait impl candidates r? ```@compiler-errors```
2023-01-25Rollup merge of #107256 - JakobDegen:delete-sai, r=cjgillotMatthias Krüger-216/+0
Delete `SimplifyArmIdentity` and `SimplifyBranchSame` mir opts I had attempted to fix the first of these opts in #94177 . However, despite that PR already being a full re-write, it still did not fix some of the core soundness issues. The optimizations that are attempted here are likely to be desirable, but I do not expect any of the currently written code to survive into a sound implementation. Deleting the code keeps us from having to maintain the passes in the meantime. Closes #77359 , closes #72800 , closes #78628 r? ```@cjgillot```
2023-01-25Rollup merge of #107255 - lcnr:implied-b-hr, r=oli-obkMatthias Krüger-0/+35
add test where we ignore hr implied bounds r? types
2023-01-25Rollup merge of #107244 - notriddle:notriddle/primitive-reference-link, ↵Matthias Krüger-4/+4
r=GuillaumeGomez rustdoc: rearrange HTML in primitive reference links This patch avoids hard-to-click single character links by making the generic part of the link: Before: <a href="#">&</a>T After: <a href="#">&T</a>
2023-01-25Rollup merge of #106944 - Nilstrieb:there-once-was-a-diagnostic, r=WaffleLapkinMatthias Krüger-5/+173
Suggest using a lock for `*Cell: Sync` bounds I mostly did this for `OnceCell<T>` at first because users will be confused to see that the `OnceCell<T>` in `std` isn't `Sync` but then extended it to `Cell<T>` and `RefCell<T>` as well.
2023-01-25Rollup merge of #106897 - estebank:issue-99430, r=davidtwcoMatthias Krüger-348/+814
Tweak E0597 CC #99430
2023-01-25Rollup merge of #105345 - yanchen4791:issue-103582-fix, r=jackh726Matthias Krüger-0/+105
Add hint for missing lifetime bound on trait object when type alias is used Fix issue #103582. The problem: When a type alias is used to specify the return type of the method in a trait impl, the suggestion for fixing the problem of "missing lifetime bound on trait object" of the trait impl will not be created. The issue caused by the code which searches for the return trait objects when constructing the hint suggestion is not able to find the trait objects since they are specified in the type alias path instead of the return path of the trait impl. The solution: Trace the trait objects in the type alias path and provide them along with the alias span to generate the suggestion in case the type alias is used in return type of the method in the trait impl.
2023-01-25Use `can_eq` to compare types for default assoc type errorNilstrieb-3/+32
This works correctly with inference variables.
2023-01-25suggest qualifying bare associated constantsAndy Russell-0/+25
2023-01-25Rollup merge of #107232 - notriddle:notriddle/settings-choice, r=GuillaumeGomezDylan DPC-27/+27
rustdoc: simplify settings popover DOM, CSS, JS * Change the class names so that they all start with `setting-`. That should make it harder to accidentally use a setting class outside the settings popover, where loading the CSS might accidentally change the styles of something unrelated. * Get rid of an unnecessary wrapper DIV around the radio button line. * Simplify CSS selectors by making the DOM easier and more intuitive to target. * Remove dead settings JS for obsolete select-wrapper
2023-01-25Rollup merge of #107213 - edward-shen:edward-shen/fix-accidental-let-else, ↵Dylan DPC-0/+30
r=compiler-errors Add suggestion to remove if in let..else block Adds an additional hint to failures where we encounter an else keyword while we're parsing an if-let expression. This is likely that the user has accidentally mixed if-let and let..else together. Fixes #103791.
2023-01-25Rollup merge of #106583 - estebank:suggest-result-coercion, r=compiler-errorsDylan DPC-0/+184
Suggest coercion of `Result` using `?` Fix #47560.
2023-01-24implement builtin candidateBoxy-0/+23
2023-01-24Add suggestions for function pointersMatthew J Perez-56/+192
- On compiler-error's suggestion of moving this lower down the stack, along the path of `report_mismatched_types()`, which is used by `rustc_hir_analysis` and `rustc_hir_typeck`. - update ui tests, add test - add suggestions for references to fn pointers - modify `TypeErrCtxt::same_type_modulo_infer` to take `T: relate::Relate` instead of `Ty`
2023-01-24add feature gate tests for DispatchFromDyndimi-0/+101
2023-01-24Delete `SimplifyArmIdentity` and `SimplifyBranchSame` mir optsJakob Degen-216/+0
2023-01-24add test where we ignore hr implied boundslcnr-0/+35
2023-01-24impl DispatchFromDyn for Cell and UnsafeCelldimi-0/+22
2023-01-23Add suggestion to remove if in let...else blockEdward Shen-0/+30
Adds an additional hint to failures where we encounter an else keyword while we're parsing an if-let block. This is likely that the user has accidentally mixed if-let and let...else together.
2023-01-23rustdoc: rearrange HTML in primitive reference linksMichael Howell-4/+4
This patch avoids hard-to-click single character links by making the generic part of the link: Before: <a href="#">&</a>T After: <a href="#">&T</a>
2023-01-23rustdoc: simplify settings popover DOMMichael Howell-27/+27
* Changes the class names so that they all start with `setting-`. That should make it harder to accidentally use a setting class outside the settings popover, where loading the CSS might accidentally change the styles of something unrelated. * Get rid of an unnecessary wrapper DIV around the radio button line. * Simplify CSS selectors by making the DOM easier and more intuitive to target.
2023-01-23Add hint for missing lifetime bound on trait object when type alias is usedyanchen4791-0/+105
2023-01-23Hack to suppress bad labels in type mismatch inference deduction codeMichael Goulet-5/+20
2023-01-23Don't resolve type var roots in point_at_expr_source_of_inferred_typeMichael Goulet-0/+34
2023-01-23tweak wordingEsteban Küber-6/+6
2023-01-23Ensure suggestion correctnessEsteban Küber-1/+120
2023-01-23Suggest coercion of `Result` using `?`Esteban Küber-0/+65
Fix #47560.
2023-01-23Rollup merge of #107148 - Ezrashaw:uncode-e0789, ↵Yuki Okushi-0/+27
r=compiler-errors,GuillaumeGomez remove error code from `E0789`, add UI test/docs `E0789` shouldn't have an error code, it's explicitly internal-only and is tiny in scope. (I wonder if we can tighten the standard for this in the RFC?) I also added a UI test and error docs (done like `E0208`, they are "no longer emitted"). r? `@GuillaumeGomez` (shouldn't need a compiler review, it's pretty minor)