about summary refs log tree commit diff
path: root/compiler
AgeCommit message (Collapse)AuthorLines
2024-04-21also remap RPITITs nested in other types back to their opaquesLukas Markeffsky-2/+2
2024-04-21cleanup: unnecessary clone during lower generics argsbohan-2/+2
2024-04-21Rollup merge of #124198 - compiler-errors:improve-ty-ct-param-span, r=NadrierilGuillaume Gomez-21/+50
Flip spans for precise capturing syntax not capturing a ty/const param, and for implicit captures of lifetime params Make the primary span point to the opaque, rather than the param which might be very far away (e.g. in an impl header hundreds of lines above).
2024-04-21Miri: detect wrong vtables in wide pointersRalf Jung-54/+148
2024-04-21Fix ICE when there is a non-Unicode entry in the incremental crate directorybeetrees-17/+19
2024-04-21Move "elided lifetime in path" to subdiagnostic structXiretza-34/+41
This requires nested subdiagnostics.
2024-04-21Fix source ordering of IntoDiagArg implsXiretza-30/+30
2024-04-21Allow nesting subdiagnosticsXiretza-12/+26
2024-04-21Pass translation closure to add_to_diag_with() as referenceXiretza-39/+39
2024-04-21Auto merge of #117457 - daxpedda:wasm-nontrapping-fptoint, r=wesleywiserbors-4/+5
Stabilize Wasm target features that are in phase 4 and 5 This stabilizes the Wasm target features that are known to be working and in [phase 4 and 5](https://github.com/WebAssembly/proposals/tree/04fa8c810e1dc99ab399e41052a6e427ee988180). Feature stabilized: - [Non-trapping float-to-int conversions](https://github.com/WebAssembly/nontrapping-float-to-int-conversions) - [Import/Export of Mutable Globals](https://github.com/WebAssembly/mutable-global) - [Sign-extension operators](https://github.com/WebAssembly/sign-extension-ops) - [Bulk memory operations](https://github.com/WebAssembly/bulk-memory-operations) - [Extended Constant Expressions](https://github.com/WebAssembly/extended-const) Features not stabilized: - [Multi-value](https://github.com/WebAssembly/multi-value): requires rebuilding `std` #73755. - [Reference Types](https://github.com/WebAssembly/reference-types): no point stabilizing without #103516. - [Threads](https://github.com/webassembly/threads): requires rebuilding `std` #77839. - [Relaxed SIMD](https://github.com/WebAssembly/relaxed-simd): separate PR #117468. - [Multi Memory](https://github.com/WebAssembly/multi-memory): not implemented. See https://github.com/rust-lang/rust/pull/117457#issuecomment-1787648070 for more context. Documentation: https://github.com/rust-lang/reference/pull/1420 Tracking issue: https://github.com/rust-lang/rust/issues/44839
2024-04-20Rollup merge of #124191 - dtolnay:fixup, r=compiler-errors许杰友 Jieyou Xu (Joe)-224/+178
Give a name to each distinct manipulation of pretty-printer FixupContext There are only 7 distinct ways that the AST pretty-printer interacts with FixupContext: 3 constructors (including Default), 2 transformations, and 2 queries. This PR turns these into associated functions which can be documented with examples. This PR unblocks https://github.com/rust-lang/rust/pull/119427#discussion_r1439481201. In order to improve the pretty-printer's behavior regarding parenthesization of braced macro calls in match arms, which have different grammar than macro calls in statements, FixupContext needs to be extended with 2 new fields. In the previous approach, that would be onerous. In the new approach, all it entails is 1 new constructor (`FixupContext::new_match_arm()`).
2024-04-20Rollup merge of #124132 - RalfJung:OpBundlesIndirect, r=Mark-Simulacrum许杰友 Jieyou Xu (Joe)-0/+3
llvm RustWrapper: explain OpBundlesIndirect argument type Follow-up to https://github.com/rust-lang/rust/pull/123941 r? ``@Mark-Simulacrum``
2024-04-20Rollup merge of #123967 - RalfJung:static_mut_refs, r=Nilstrieb许杰友 Jieyou Xu (Joe)-8/+13
static_mut_refs: use raw pointers to remove the remaining FIXME Using `SyncUnsafeCell` would not make a lot of sense IMO.
2024-04-20Rollup merge of #123379 - wutchzone:119266, r=compiler-errors许杰友 Jieyou Xu (Joe)-2/+19
Print note with closure signature on type mismatch Fixes #119266 r? Nilstrieb
2024-04-20merge two impl blocksLukas Markeffsky-2/+0
2024-04-20Explicitly mention `Self`Michael Goulet-7/+29
2024-04-20remove `InferCtxt::clear_caches`Lukas Markeffsky-12/+0
2024-04-20include ParamEnv in projection cache keyLukas Markeffsky-13/+19
2024-04-20Flip spans for precise capturing syntax not capturing a ty/ct paramMichael Goulet-14/+21
2024-04-20Fix documentation of `BorrowKind::Fake`Nadrieril-3/+3
2024-04-20Use deep fake borrows for deref patternsNadrieril-28/+30
2024-04-20Add a non-shallow fake borrowNadrieril-70/+166
2024-04-20Rework fake borrow calculationNadrieril-117/+144
2024-04-20Address closure-related reviewNadrieril-1/+14
2024-04-20Allow mutable bindings inside deref patternsNadrieril-15/+33
2024-04-20Track mutability of deref patternsNadrieril-7/+10
2024-04-20Don't fake borrow inside a deref patternNadrieril-2/+12
2024-04-20Lower deref patterns to MIRNadrieril-33/+85
This handles using deref patterns to choose the correct match arm. This does not handle bindings or guards. Co-authored-by: Deadbeef <ent3rm4n@gmail.com>
2024-04-20Print note with closure signature on type mismatchDaniel Sedlak-2/+19
2024-04-20Auto merge of #124190 - RalfJung:pat-compare-with-fast-path, r=Nadrierilbors-5/+8
PatRangeBoundary::compare_with: als add a fast-path for signed integers Not sure if we have a benchmark that hits this... but it seems odd to only do this for unsigned integers.
2024-04-20Fixup `rustc_codegen_gcc` test signatureMaybe Waffle-4/+5
2024-04-20Auto merge of #124194 - matthiaskrgr:rollup-40s0c4q, r=matthiaskrgrbors-62/+1079
Rollup of 3 pull requests Successful merges: - #123409 (Implement Modified Condition/Decision Coverage) - #124104 (Fix capturing duplicated lifetimes via parent in `precise_captures` (`impl use<'...>`)) - #124137 (Match hyphen in multi-revision comment matchers) r? `@ghost` `@rustbot` modify labels: rollup
2024-04-20Rollup merge of #124104 - compiler-errors:parent-generic-use, r=oli-obkMatthias Krüger-7/+30
Fix capturing duplicated lifetimes via parent in `precise_captures` (`impl use<'...>`) For technical reasons related to the way that `Self` and `T::Assoc` are lowered from HIR -> `rustc_middle::ty`, an opaque may mention in its bounds both the original early-bound lifetime from the parent `impl`/`fn`, *and* the *duplicated* early-bound lifetime on the opaque. This is fine -- and has been fine since `@cjgillot` rewrote the way we handled opaque lifetime captures, and we went further to allow this behavior explicitly in https://github.com/rust-lang/rust/pull/115659. It's worthwhile to read this PR's technical section to recall how this duplication works and when it acts surprisingly. The problem here is that the check that make sure that `impl use<'a, 'b>` lists all of the opaque's captured lifetimes wasn't smart enough to consider both these captured lifetimes and the original lifetimes they're duplicated from to be equal. This PR fixes that. r? oli-obk
2024-04-20Rollup merge of #123409 - ZhuUx:master, r=oli-obkMatthias Krüger-55/+1049
Implement Modified Condition/Decision Coverage This is an implementation based on llvm backend support (>= 18) by `@evodius96` and branch coverage support by `@Zalathar.` ### Major changes: * Add -Zcoverage-options=mcdc as switch. Now coverage options accept either `no-branch`, `branch`, or `mcdc`. `mcdc` also enables `branch` because it is essential to work. * Add coverage mapping for MCDCBranch and MCDCDecision. Note that MCDCParameter evolves from llvm 18 to llvm 19. The mapping in rust side mainly references to 19 and is casted to 18 types in llvm wrapper. * Add wrapper for mcdc instrinc functions from llvm. And inject associated statements to mir. * Add BcbMappingKind::Decision, I'm not sure is it proper but can't find a better way temporarily. * Let coverage-dump support parsing MCDCBranch and MCDCDecision from llvm ir. * Add simple tests to check whether mcdc works. * Same as clang, currently rustc does not generate instrument for decision with more than 6 condtions or only 1 condition due to considerations of resource. ### Implementation Details 1. To get information about conditions and decisions, `MCDCState` in `BranchInfoBuilder` is used during hir lowering to mir. For expressions with logical op we call `Builder::visit_coverage_branch_operation` to record its sub conditions, generate condition ids for them and save their spans (to construct the span of whole decision). This process mainly references to the implementation in clang and is described in comments over `MCDCState::record_conditions`. Also true marks and false marks introduced by branch coverage are used to detect where the decision evaluation ends: the next id of the condition == 0. 2. Once the `MCDCState::decision_stack` popped all recorded conditions, we can ensure that the decision is checked over and push it into `decision_spans`. We do not manually insert decision span to avoid complexity from then_else_break in nested if scopes. 3. When constructing CoverageSpans, add condition info to BcbMappingKind::Branch and decision info to BcbMappingKind::Decision. If the branch mapping has non-zero condition id it will be transformed to MCDCBranch mapping and insert `CondBitmapUpdate` statements to its evaluated blocks. While decision bcb mapping will insert `TestVectorBitmapUpdate` in all its end blocks. ### Usage ```bash echo "[build]\nprofiler=true" >> config.toml ./x build --stage 1 ./x test tests/coverage/mcdc_if.rs ``` to build the compiler and run tests. ```shell export PATH=path/to/llvm-build:$PATH rustup toolchain link mcdc build/host/stage1 cargo +mcdc rustc --bin foo -- -Cinstrument-coverage -Zcoverage-options=mcdc cd target/debug LLVM_PROFILE_FILE="foo.profraw" ./foo llvm-profdata merge -sparse foo.profraw -o foo.profdata llvm-cov show ./foo -instr-profile=foo.profdata --show-mcdc ``` to check "foo" code. ### Problems to solve For now decision mapping will insert statements to its all end blocks, which may be optimized by inserting a final block of the decision. To do this we must also trace the evaluated value at each end of the decision and join them separately. This implementation is not heavily tested so there should be some unrevealed issues. We are going to check our rust products in the next. Please let me know if you had any suggestions or comments.
2024-04-20Auto merge of #124156 - DianQK:disable-match_branches, r=RalfJungbors-1/+4
Disable SimplifyToExp in MatchBranchSimplification Due to the miscompilation mentioned in #124150, We need to disable MatchBranchSimplification temporarily. To fully resolve this issue, my plan is: 1. Disable SimplifyToExp in MatchBranchSimplification (this PR). 2. Remove all potentially unclear transforms in #124122. 3. Gradually add back the removed transforms (possibly multiple PRs). r? `@Nilstrieb` or `@oli-obk`
2024-04-19Give a name to each distinct manipulation of pretty-printer FixupContextDavid Tolnay-153/+106
2024-04-19Move pretty-printer FixupContext to a moduleDavid Tolnay-74/+75
Required for being able to make the fields private and force the use of accessor methods, which will be added in the next commit.
2024-04-20PatRangeBoundary::compare_with: als add a fast-path for signed integersRalf Jung-5/+8
2024-04-19Stop taking ParamTy/ParamConst/EarlyParamRegion/AliasTy by refMichael Goulet-38/+38
2024-04-20Auto merge of #124166 - oli-obk:define_opaque_types11, r=compiler-errorsbors-1/+1
Let inherent associated types constrain opaque types during projection r? `@compiler-errors` The same test ICEs on master: https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=f4ff62663a5a3a0e16d00953ee7414d5
2024-04-20Disable SimplifyToExp in MatchBranchSimplificationDianQK-1/+4
2024-04-19Prevent creating the same `Instance::mono` multiple timesGuillaume Gomez-3/+4
2024-04-19Auto merge of #124170 - matthiaskrgr:rollup-ldopl64, r=matthiaskrgrbors-16/+32
Rollup of 5 pull requests Successful merges: - #123571 (Correctly change type when adding adjustments on top of `NeverToAny`) - #123729 (run-make: refactor out command wrappers for `clang` and `llvm-readobj`) - #124106 (Don't repeatedly duplicate TAIT lifetimes for each subsequently nested TAIT) - #124149 (rustdoc-search: fix description on aliases in results) - #124155 (bootstrap: don't use rayon for sysinfo) r? `@ghost` `@rustbot` modify labels: rollup
2024-04-19Do intrinsic changes in `rustc_codegen_cranelift`Maybe Waffle-5/+9
2024-04-19Fix capturing duplicated lifetimes via parentMichael Goulet-7/+30
2024-04-19Rollup merge of #124106 - compiler-errors:tait-lifetime-dedup, r=oli-obkMatthias Krüger-6/+9
Don't repeatedly duplicate TAIT lifetimes for each subsequently nested TAIT Make it so that nested TAITs inherit the lifetimes from their parent item, not their parent TAIT. This is because we don't need to re-duplicate lifetimes for nested TAITs over and over, since the only lifetimes they can capture are from the parent item anyways. This mirrors how RPITs work. This is **not** a functional change that should be observable, since the whole point of duplicating lifetimes and marking the shadowed ones (and uncaptured ones) as bivariant is designed to *not* be observable. r? oli-obk
2024-04-19Don't fatal when calling expect_one_of when recovering arg in parse_seqMichael Goulet-0/+1
2024-04-19Auto merge of #124113 - RalfJung:interpret-scalar-ops, r=oli-obkbors-152/+211
interpret: use ScalarInt for bin-ops; avoid PartialOrd for ScalarInt Best reviewed commit-by-commit r? `@oli-obk`
2024-04-20coverage. Lowering MC/DC statements to llvm-irzhuyunxing-3/+240
2024-04-19Let inherent associated types constrain opaque types during projectionOli Scherer-1/+1