about summary refs log tree commit diff
path: root/compiler
AgeCommit message (Collapse)AuthorLines
2023-10-19Rollup merge of #116906 - compiler-errors:version-0, r=oli-obkMatthias Krüger-5/+5
Use v0.0.0 in compiler crates I may be totally off base here, but my understanding is that it's conventional to use v0.0.0 to reflect the unversioned nature of the compiler crates. Fix that for some of the compiler crates that were created recently.
2023-10-19Rollup merge of #116896 - cjgillot:single-inline, r=oli-obkMatthias Krüger-13/+22
Only check in a single place if a pass is enabled. Fixes https://github.com/rust-lang/rust/issues/116294
2023-10-19Rollup merge of #116650 - RalfJung:miri-intptrcast, r=oli-obkMatthias Krüger-0/+10
add some comments and some cleanup around Miri intptrcast `@saethlin` maybe this helps a bit?
2023-10-19Rollup merge of #116912 - compiler-errors:rustc_type_ir-bikeshedding, r=jackh726León Orell Valerian Liehr-57/+61
Some renaming nits for `rustc_type_ir` tl;dr: * `ListTy` -> `Tys` * `PlaceholderType` -> `PlaceholderTy` * `RegionVid` -> `InferRegion` * `ListBinderExistentialPredicate` -> `BoundExistentialPredicates` * `GenericArgsRef` -> `GenericArgs` r? jackh726
2023-10-19Rollup merge of #116908 - estebank:issue-78206, r=compiler-errorsLeón Orell Valerian Liehr-4/+19
Tweak wording of type errors involving type params Fix #78206.
2023-10-19Rollup merge of #116829 - fmease:rust-aint-c, r=compiler-errorsLeón Orell Valerian Liehr-4/+18
Make `#[repr(Rust)]` incompatible with other (non-modifier) representation hints like `C` and `simd` Read more about this change here: https://github.com/rust-lang/rust/pull/116829#issuecomment-1768618240. Fixes [after backport] #116825.
2023-10-19Rollup merge of #116663 - compiler-errors:resolve-regions, r=lcnrLeón Orell Valerian Liehr-8/+20
Don't ICE when encountering unresolved regions in `fully_resolve` We can encounter unresolved regions due to unconstrained impl lifetime arguments because `collect_return_position_impl_trait_in_trait_tys` runs before WF actually checks that the impl is well-formed. Fixes #116525
2023-10-18Tweak wording of type errors involving type paramsEsteban Küber-4/+19
Fix #78206.
2023-10-18Some renaming nits for rustc_type_irMichael Goulet-52/+61
2023-10-18Remove unused variant BinderListTyMichael Goulet-5/+0
2023-10-18Use v0.0.0 in compiler cratesMichael Goulet-5/+5
2023-10-18Auto merge of #116493 - compiler-errors:coinductive-cycle-lint, r=lcnrbors-2/+2
Bump `COINDUCTIVE_OVERLAP_IN_COHERENCE` to deny + warn in deps 1.73 is the first place this shows up in stable (recall that there was only 1 regression), so let's bump this to deny on nightly. r? lcnr
2023-10-18Don't ICE when encountering unresolved regions in fully_resolveMichael Goulet-8/+20
2023-10-18Bump COINDUCTIVE_OVERLAP_IN_COHERENCEMichael Goulet-2/+2
2023-10-18Auto merge of #116046 - Zalathar:fn-cov-info, r=cjgillotbors-636/+435
coverage: Move most per-function coverage info into `mir::Body` Currently, all of the coverage information collected by the `InstrumentCoverage` pass is smuggled through MIR in the form of individual `StatementKind::Coverage` statements, which must then be reassembled by coverage codegen. That's awkward for a number of reasons: - While some of the coverage statements do care about their specific position in the MIR control-flow graph, many of them don't, and are just tacked onto the function's first BB as metadata carriers. - MIR inlining can result in coverage statements being duplicated, so coverage codegen has to jump through hoops to avoid emitting duplicate mappings. - MIR optimizations that would delete coverage statements need to carefully copy them into the function's first BB so as not to omit them from coverage reports. - The order in which coverage codegen sees coverage statements is dependent on MIR optimizations/inlining, which can cause unnecessary churn in the emitted coverage mappings. - We don't have a good way to annotate MIR-level functions with extra coverage info that doesn't belong in a statement. --- This PR therefore takes most of the per-function coverage info and stores it in a field in `mir::Body` as `Option<Box<FunctionCoverageInfo>>`. (This adds one pointer to the size of `mir::Body`, even when coverage is not enabled.) Coverage statements still need to be injected into MIR in some cases, but only when they actually affect codegen (counters) or are needed to detect code that has been optimized away as unreachable (counters/expressions). --- By the end of this PR, the information stored in `FunctionCoverageInfo` is: - A hash of the function's source code (needed by LLVM's coverage map format) - The number of coverage counters added by coverage instrumentation - A table of coverage expressions, associating each expression ID with its operator (add or subtract) and its two operands - The list of mappings, associating each covered code region with a counter/expression/zero value --- ~~This is built on top of #115301, so I'll rebase and roll a reviewer once that lands.~~ r? `@ghost` `@rustbot` label +A-code-coverage
2023-10-18Only check in a single place if a pass is enabled.Camille GILLOT-13/+22
2023-10-18Make `#[repr(Rust)]` and `#[repr(C)]` incompatible with one anotherLeón Orell Valerian Liehr-4/+18
2023-10-18Auto merge of #116887 - lcnr:alias-ty-constructor, r=compiler-errorsbors-38/+45
`TyCtxt::mk_alias_ty` -> `AliasTy::new`
2023-10-18coverage: Explicitly note that counter/expression IDs are function-localZalathar-0/+17
2023-10-18coverage: Update docs for `StatementKind::Coverage`Zalathar-5/+10
This new description reflects the changes made in this PR, and should hopefully be more useful to non-coverage developers who need to care about coverage statements.
2023-10-18coverage: Store expression data in function coverage infoZalathar-171/+86
Even though expression details are now stored in the info structure, we still need to inject `ExpressionUsed` statements into MIR, because if one is missing during codegen then we know that it was optimized out and we can remap all of its associated code regions to zero.
2023-10-18Remove unused `TyCtxt` from `remove_dead_blocks`Zalathar-9/+9
This context was only needed by code for processing coverage statements, which has been removed.
2023-10-18coverage: Store all of a function's mappings in function coverage infoZalathar-239/+86
Previously, mappings were attached to individual coverage statements in MIR. That necessitated special handling in MIR optimizations to avoid deleting those statements, since otherwise codegen would be unable to reassemble the original list of mappings. With this change, a function's list of mappings is now attached to its MIR body, and survives intact even if individual statements are deleted by optimizations.
2023-10-18AliasTy::new instead of tcx methodlcnr-38/+45
2023-10-18Auto merge of #116885 - aliemjay:rollup-plbeppt, r=aliemjaybors-136/+91
Rollup of 5 pull requests Successful merges: - #116812 (Disable missing_copy_implementations lint on non_exhaustive types) - #116856 (Disable effects in libcore again) - #116865 (Suggest constraining assoc types in more cases) - #116870 (Don't compare host param by name) - #116879 (revert #114586) r? `@ghost` `@rustbot` modify labels: rollup
2023-10-18coverage: Make expression simplification non-destructiveZalathar-22/+58
Instead of modifying the accumulated expressions in-place, we now build a set of expressions that are known to be zero, and then consult that set on the fly when converting the expression data for FFI. This will be necessary when moving mappings and expression data into function coverage info, which can't be mutated during codegen.
2023-10-18Rollup merge of #116879 - aliemjay:revert-opaque-bubble, r=oli-obkAli MJ Al-Nasrawy-81/+18
revert #114586 Reverts #114586. cc #116877 (not closing until this gets a beta backport) fixes #116684 fixes https://github.com/rust-lang/rust/pull/114586#issuecomment-1751967321 r? `@oli-obk` or `@lcnr`
2023-10-18Rollup merge of #116870 - compiler-errors:host-param-by-name, r=fee1-deadAli MJ Al-Nasrawy-11/+10
Don't compare host param by name Seems sketchy to be searching for `sym::host` by name, especially when we can get the actual index with not very much work. r? fee1-dead
2023-10-18Rollup merge of #116865 - estebank:issue-46969, r=compiler-errorsAli MJ Al-Nasrawy-44/+58
Suggest constraining assoc types in more cases Fix #46969. ``` error[E0308]: mismatched types --> $DIR/suggest-contraining-assoc-type-because-of-assoc-const.rs:12:21 | LL | const N: C::M = 4u8; | ^^^ expected associated type, found `u8` | = note: expected associated type `<C as O>::M` found type `u8` help: consider constraining the associated type `<C as O>::M` to `u8` | LL | impl<C: O<M = u8>> U<C> for u16 { | ++++++++ ```
2023-10-18Rollup merge of #116812 - ↵Ali MJ Al-Nasrawy-0/+5
rmehri01:missing_copy_implementations_non_exhaustive, r=petrochenkov Disable missing_copy_implementations lint on non_exhaustive types Fixes #116766
2023-10-18coverage: Collect a function's coverage mappings into a single listZalathar-75/+65
This is an intermediate step towards being able to store all of a function's mappings in function coverage info.
2023-10-18coverage: Rename `Operand` to `CovTerm`Zalathar-49/+51
Later patches in this PR will use `CovTerm` to represent things that are not expression operands.
2023-10-18coverage: Store the number of counters/expressions in function coverage infoZalathar-102/+69
Coverage codegen can now allocate arrays based on the number of counters/expressions originally used by the instrumentor. The existing query that inspects coverage statements is still used for determining the number of counters passed to `llvm.instrprof.increment`. If some high-numbered counters were removed by MIR optimizations, the instrumented binary can potentially use less memory and disk space at runtime.
2023-10-18coverage: Attach an optional `FunctionCoverageInfo` to `mir::Body`Zalathar-54/+74
This allows coverage information to be attached to the function as a whole when appropriate, instead of being smuggled through coverage statements in the function's basic blocks. As an example, this patch moves the `function_source_hash` value out of individual `CoverageKind::Counter` statements and into the per-function info. When synthesizing unused functions for coverage purposes, the absence of this info is taken to indicate that a function was not eligible for coverage and should not be synthesized.
2023-10-18Auto merge of #116815 - Nilstrieb:more-funny-pretty-printers, r=compiler-errorsbors-310/+214
Remove lots of generics from `ty::print` All of these generics mostly resolve to the same thing, which means we can remove them, greatly simplifying the types involved in pretty printing and unlocking another simplification (that is not performed in this PR): Using `&mut self` instead of passing `self` through the return type. cc `@eddyb` you probably know why it's like this, just checking in and making sure I didn't do anything bad r? oli-obk
2023-10-18Auto merge of #116814 - estebank:windows-ice-path, r=petrochenkovbors-3/+8
Use `YYYY-MM-DDTHH_MM_SS` as datetime format for ICE dump files Windows paths do not support `:`, so use a datetime format in ICE dump paths that Windows will accept. CC #116809, fix #115180.
2023-10-18revert rust-lang/rust#114586Ali MJ Al-Nasrawy-81/+18
2023-10-18Auto merge of #116713 - estebank:issue-116703, r=compiler-errorsbors-46/+60
Properly account for self ty in method disambiguation suggestion Fix #116703.
2023-10-18Auto merge of #116830 - nnethercote:rustc_type_ir, r=compiler-errorsbors-128/+41
Remove `IdFunctor` trait. It's defined in `rustc_data_structures` but is only used in `rustc_type_ir`. The code is shorter and easier to read if we remove this layer of abstraction and just do the things directly where they are needed. r? `@BoxyUwU`
2023-10-18Don't compare host param by nameMichael Goulet-11/+10
2023-10-17Automatically enable cross-crate inlining for small functionsBen Kimock-69/+184
2023-10-17Suggest constraining assoc types in more casesEsteban Küber-44/+58
Fix #46969.
2023-10-17Unify suggestion wordingEsteban Küber-45/+55
2023-10-17review comments + more testsEsteban Küber-8/+9
2023-10-17Properly account for self ty in method disambiguation suggestionEsteban Küber-3/+6
Fix #116703.
2023-10-17Use `YYYY-MM-DDTHH_MM_SS` as datetime format for ICE dump filesEsteban Küber-3/+8
Windows paths do not support `:`, so use a datetime format in ICE dump paths that Windows will accept. Fix #116809, fix #115180.
2023-10-17Rollup merge of #116827 - nnethercote:pub-handle_options, r=compiler-errorsMatthias Krüger-1/+5
Make `handle_options` public again. r? ``@compiler-errors``
2023-10-17Rollup merge of #116787 - a-lafrance:span-internal-lint, r=oli-obkMatthias Krüger-5/+46
Implement an internal lint encouraging use of `Span::eq_ctxt` Adds a new Rustc internal lint that forbids use of `.ctxt() == .ctxt()` for spans, encouraging use of `.eq_ctxt()` instead (see https://github.com/rust-lang/rust/issues/49509). Also fixed a few violations of the lint in the Rustc codebase (a fun additional way I could test my code). Edit: MIR opt folks I believe that's why you're CC'ed, just a heads up. Two things I'm not sure about: 1. The way I chose to detect calls to `Span::ctxt`. I know adding diagnostic items to methods is generally discouraged, but after some searching and experimenting I couldn't find anything else that worked, so I went with it. That said, I'm happy to implement something different if there's a better way out there. (For what it's worth, if there is a better way, it might be worth documenting in the rustc-dev-guide, which I'm happy to take care of) 2. The error message for the lint. Ideally it would probably be good to give some context as to why the suggestion is made (e.g. `rustc::default_hash_types` tells the user that it's because of performance), but I don't have that context so I couldn't put it in the error message. Happy to iterate on the error message based on feedback during review. r? ``@oli-obk``
2023-10-17Rollup merge of #116719 - celinval:smir-mono, r=oli-obkMatthias Krüger-45/+310
Add MonoItems and Instance to stable_mir Also add a few methods to instantiate instances and get an instance definition. We're still missing support to actually monomorphize the instance body. This is related to https://github.com/rust-lang/project-stable-mir/issues/36 r? ``@oli-obk`` ``@oli-obk`` is that what you were thinking? I incorporated ``@bjorn3`` idea of just adding a Shim instance definition in https://github.com/rust-lang/rust/pull/116465.
2023-10-17Rollup merge of #116717 - estebank:issue-9082, r=oli-obkMatthias Krüger-1/+126
Special case iterator chain checks for suggestion When encountering method call chains of `Iterator`, check for trailing `;` in the body of closures passed into `Iterator::map`, as well as calls to `<T as Clone>::clone` when `T` is a type param and `T: !Clone`. Fix #9082.