about summary refs log tree commit diff
path: root/compiler
AgeCommit message (Collapse)AuthorLines
2023-01-27Fix def-use dominance checkTomasz Miąsko-11/+22
A definition does not dominate a use in the same statement. For example in MIR generated for compound assignment x += a (when overflow checks are disabled).
2023-01-26Auto merge of #107328 - matthiaskrgr:rollup-lfqwo0o, r=matthiaskrgrbors-383/+364
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 #107323 - JakobDegen:const-goto, r=tmiaskoMatthias Krüger-0/+9
Disable ConstGoto opt in cleanup blocks Fixes #107315 . There is probably a smaller hammer that we could use here, but none that is super obviously correct. We can always revisit this in the future. Could not add a test because custom mir does not support cleanup blocks. However, did check that the fallible_iterator crate no longer ICEs with the other PR cherry picked. r? `@tmiasko`
2023-01-26Rollup merge of #107322 - JakobDegen:custom-mir, r=tmiaskoMatthias Krüger-0/+14
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 #107189 - cjgillot:meta-adt, r=compiler-errorsMatthias Krüger-113/+45
Encode info for Adt in a single place. Split from https://github.com/rust-lang/rust/pull/98867
2023-01-26Rollup merge of #107168 - ↵Matthias Krüger-2/+1
Nilstrieb:if-a-tait-falls-in-the-forest,can-we-know-it-wasnt-revealed, r=oli-obk Use a type-alias-impl-trait in `ObligationForest`
2023-01-26Rollup merge of #107150 - Nilstrieb:thread-local-cleanups, r=cjgillotMatthias Krüger-178/+190
`ty::tls` cleanups Pull it out into a separate file, make the conditional compilation more obvious and give the internal functions better names. Pulled out of #106311 r? cjgillot
2023-01-26Rollup merge of #106978 - mejrs:mir_build3, r=davidtwcoMatthias Krüger-57/+86
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-15/+19
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-18/+0
Preserve split DWARF files when building archives. r? ```@davidtwco```
2023-01-26Auto merge of #106745 - m-ou-se:format-args-ast, r=oli-obkbors-394/+666
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-26Disable ConstGoto opt in cleanup blocksJakob Degen-0/+9
2023-01-26Custom mir: Add support for some remaining, easy to support constructsJakob Degen-0/+14
2023-01-26Auto merge of #107318 - matthiaskrgr:rollup-776kd81, r=matthiaskrgrbors-695/+735
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-645/+671
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-8/+44
Improve fn pointer notes continuation of #105552 r? `@compiler-errors`
2023-01-26Rollup merge of #107074 - lcnr:validate-dont-skip-opaque, r=compiler-errorsMatthias Krüger-6/+1
remove unnecessary check for opaque types this isn't needed and may hide some errors. after analysis there are no opaque types so it's a noop anyways before analysis there are opaque types but due to `Reveal::UserFacing` we don't reveal them. `is_subtype` simply discards the opaque type constraints as these will get checked again during mir borrowck. r? types want to land this after the beta-cutoff as mir validator changes are apparently pretty scary
2023-01-26Rollup merge of #106811 - khuey:dwp_extension, r=davidtwcoMatthias Krüger-1/+2
Append .dwp to the binary filename instead of replacing the existing extension. gdb et al. expect to find the dwp file at `<binary>`.dwp, even if <binary> already has an extension (e.g. libfoo.so's dwp is expected to be at libfoo.so.dwp).
2023-01-26Rollup merge of #106625 - Swatinem:ref/cov6, r=nagisaMatthias Krüger-35/+17
Remove backwards compat for LLVM 12 coverage format The minimum external LLVM was updated to 13 recently in https://github.com/rust-lang/rust/pull/100611, so this PR removes backwards compat with older coverage formats. I kept the version check and error message there, in accordance with this comment: https://github.com/rust-lang/rust/pull/91207#issuecomment-981121867
2023-01-26Auto merge of #107314 - matthiaskrgr:rollup-j40lnlj, r=matthiaskrgrbors-285/+850
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 #107286 - compiler-errors:new-solver-deny-infers, r=lcnrMatthias Krüger-22/+33
ICE in new solver if we see an inference variable By construction, we do not expect to see any `ty::Infer(ty::TyVar(_))` inference types in the solver (we treat this as ambiguous, since we need to be able to structurally resolve the self type at least one layer to assemble candidates for it). Additionally, since we're doing no freshening, we also don't expect to see any fresh vars of any kind in the solver. Let's make that an ICE so we can catch any mistakes. When #107282 lands, we should also ICE there too if we see a non-int/float infer. r? `@lcnr`
2023-01-26Rollup merge of #107285 - compiler-errors:new-solver-future-and-generator, ↵Matthias Krüger-11/+184
r=lcnr Implement `Generator` and `Future` in the new solver r? `@lcnr`
2023-01-26Rollup merge of #107272 - compiler-errors:new-solver-more-predicates, r=lcnrMatthias Krüger-6/+63
Implement ObjectSafe and WF in the new solver r? ``@lcnr``
2023-01-26Rollup merge of #107248 - erikdesjardins:addrspace, r=oli-obkMatthias Krüger-197/+204
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-5/+12
suggest qualifying bare associated constants Fixes #107199.
2023-01-26Rollup merge of #107175 - compiler-errors:bad-types-in-vec-push, r=estebankMatthias Krüger-18/+30
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/+6
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-20/+106
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-6/+212
Improve proc macro attribute diagnostics Closes https://github.com/rust-lang/rust/issues/102923
2023-01-26improve fn pointer notesMatthew J Perez-8/+44
- 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-26ICE in new solver if we see an inference variableMichael Goulet-22/+33
2023-01-26Implement Generator and FutureMichael Goulet-1/+127
2023-01-26Report the right fulfillment errorsMichael Goulet-10/+57
2023-01-26Auto merge of #105582 - saethlin:instcombine-assert-inhabited, r=cjgillotbors-16/+114
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-25Don't normalize obligations in WF goal for the new solverMichael Goulet-7/+31
2023-01-25Implement ObjectSafe and WF in the new solverMichael Goulet-4/+37
2023-01-25Rollup merge of #107282 - BoxyUwU:erica_builtin_pointee_impls, r=compiler-errorsMatthias Krüger-0/+105
erica solver: implement builtin `Pointee` trait impl candidates r? ```@compiler-errors```
2023-01-25Rollup merge of #107256 - JakobDegen:delete-sai, r=cjgillotMatthias Krüger-825/+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 #106897 - estebank:issue-99430, r=davidtwcoMatthias Krüger-6/+39
Tweak E0597 CC #99430
2023-01-25Rollup merge of #105345 - yanchen4791:issue-103582-fix, r=jackh726Matthias Krüger-19/+71
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-14/+17
This works correctly with inference variables.
2023-01-25Move `note_and_explain_type_err` from `rustc_middle` to `rustc_infer`Nilstrieb-634/+657
This way we can properly deal with the types.
2023-01-25Auto merge of #103902 - vincenzopalazzo:macros/obligation_rulesv2, r=oli-obkbors-277/+261
use `LocalDefId` instead of `HirId` in trait resolution to simplify the obligation clause resolution This commit introduces a refactoring suggested by `@lcnr` to simplify the obligation clause resolution. This is just the first PR that introduces a type of refactoring, but others PRs will follow this to introduce name changing to change from the variable name from `body_id` to something else. Fixes https://github.com/rust-lang/rust/issues/104827 Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com> `@rustbot` r? `@lcnr`
2023-01-25suggest qualifying bare associated constantsAndy Russell-5/+12
2023-01-25Rollup merge of #107227 - lcnr:solver-new-external-api, r=compiler-errorsDylan DPC-17/+32
`new_outside_solver` -> `evaluate_root_goal` r? ```@rust-lang/initiative-trait-system-refactor```
2023-01-25Rollup merge of #107213 - edward-shen:edward-shen/fix-accidental-let-else, ↵Dylan DPC-14/+31
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 #107166 - petrochenkov:nooptable, r=oli-obkDylan DPC-76/+64
rustc_metadata: Support non-`Option` nullable values in metadata tables This is a convenience feature for cases in which "no value in the table" and "default value in the table" are equivalent. Tables using `Table<DefIndex, ()>` are migrated in this PR, some other cases can be migrated later. This helps `DocFlags` in https://github.com/rust-lang/rust/pull/107136 in particular.
2023-01-25Rollup merge of #106767 - chbaker0:disable-unstable-features, r=Mark-SimulacrumDylan DPC-1/+2
Allow setting CFG_DISABLE_UNSTABLE_FEATURES to 0 Two locations check whether this build-time environment variable is defined. Allowing it to be explicitly disabled with a "0" value is useful, especially for integrating with external build systems.
2023-01-25Rollup merge of #106583 - estebank:suggest-result-coercion, r=compiler-errorsDylan DPC-1/+52
Suggest coercion of `Result` using `?` Fix #47560.
2023-01-25create and use GlobalAlloc::address_spaceErik Desjardins-19/+18