about summary refs log tree commit diff
path: root/compiler/rustc_middle/src
AgeCommit message (Collapse)AuthorLines
2024-05-10Auto merge of #124961 - matthiaskrgr:rollup-1jj65p6, r=matthiaskrgrbors-24/+3
Rollup of 7 pull requests Successful merges: - #124551 (Add benchmarks for `impl Debug for str`) - #124915 (`rustc_target` cleanups) - #124918 (Eliminate some `FIXME(lcnr)` comments) - #124927 (opt-dist: use xz2 instead of xz crate) - #124936 (analyse visitor: build proof tree in probe) - #124943 (always use `GenericArgsRef`) - #124955 (Use fewer origins when creating type variables.) r? `@ghost` `@rustbot` modify labels: rollup
2024-05-10Rollup merge of #124943 - lcnr:generic-args-ref, r=compiler-errorsMatthias Krüger-2/+2
always use `GenericArgsRef` r? ```@compiler-errors```
2024-05-10Rollup merge of #124918 - nnethercote:FIXME-lcnr, r=lcnrMatthias Krüger-22/+1
Eliminate some `FIXME(lcnr)` comments In some cases this involved changing code. In some cases the comment was able to removed or replaced. r? ``@lcnr``
2024-05-10Auto merge of #124953 - compiler-errors:own-params, r=lcnrbors-20/+20
Rename `Generics::params` to `Generics::own_params` I hope this makes it slightly more obvious that `generics.own_params` is insufficient when considering nested items. I didn't actually audit any of the usages, for the record. r? lcnr
2024-05-09Make builtin_deref just return a TyMichael Goulet-14/+8
2024-05-09Rename Generics::params to Generics::own_paramsMichael Goulet-20/+20
2024-05-10Remove `TyCtxt::try_normalize_erasing_late_bound_regions`.Nicholas Nethercote-22/+1
It's unused.
2024-05-09always use `GenericArgsRef`lcnr-2/+2
2024-05-09fix: Check whether next_node is else-less if in get_return_blockcardigan1008-3/+1
Fix #124819, where a if-less block causes a wrong output. It is caused by get_return_block in get_fn_decl. In get_return_block, when a else-less if expression is the tail expression, the check for next_node will keep iterating. So it is necessary to make a early return in the check.
2024-05-09Make `#![feature]` suggestion MaybeIncorrectAlex Macleod-1/+1
2024-05-09fix: Add if to check whether the previous node is Blockcardigan1008-0/+3
2024-05-09Auto merge of #124831 - nnethercote:rustc_data_structures-cleanups, ↵bors-9/+8
r=michaelwoerister `rustc_data_structures` cleanups Some improvements I found while looking through this code. r? `@michaelwoerister`
2024-05-09Remove `TinyList`.Nicholas Nethercote-9/+8
It is optimized for lists with a single element, avoiding the need for an allocation in that case. But `SmallVec<[T; 1]>` also avoids the allocation, and is better in general: more standard, log2 number of allocations if the list exceeds one item, and a much more capable API. This commit removes `TinyList` and converts the two uses to `SmallVec<[T; 1]>`. It also reorders the `use` items in the relevant file so they are in just two sections (`pub` and non-`pub`), ordered alphabetically, instead of many sections. (This is a relevant part of the change because I had to decide where to add a `use` item for `SmallVec`.)
2024-05-08Handle normalization failure in `struct_tail_erasing_lifetimes`Gurinder Singh-7/+8
Fixes an ICE that occurred when the struct in question has an error
2024-05-08Rollup merge of #124548 - gurry:113272-ice-failed-to-normalize, ↵Matthias Krüger-1/+16
r=compiler-errors Handle normalization failure in `struct_tail_erasing_lifetimes` Fixes #113272 The ICE occurred because the struct being normalized had an error. This PR adds some defensive code to guard against that.
2024-05-07Auto merge of #123332 - Nadrieril:testkind-never, r=matthewjasperbors-0/+17
never patterns: lower never patterns to `Unreachable` in MIR This lowers a `!` pattern to "goto Unreachable". Ideally I'd like to read from the place to make it clear that the UB is coming from an invalid value, but that's tricky so I'm leaving it for later. r? `@compiler-errors` how do you feel about a lil bit of MIR lowering
2024-05-06Record impl args in the InsepctCandiate rather than rematching during selectMichael Goulet-0/+5
2024-05-06Refactor float `Primitive`s to a separate `Float` typebeetrees-8/+26
2024-05-04Lower never patterns to Unreachable in mirNadrieril-0/+17
2024-05-03Rollup merge of #124418 - compiler-errors:better-cause, r=lcnrMichael Goulet-0/+3
Use a proof tree visitor to refine the `Obligation` for error reporting in new solver With the magic of `ProofTreeVisitor`, we can close the gap that we have on `ObligationCause`s being not as descriptive in the new trait solver. r? lcnr Needs some work and obviously documentation.
2024-05-04Auto merge of #124401 - oli-obk:some_hir_cleanups, r=cjgillotbors-2/+2
Some hir cleanups It seemed odd to not put `AnonConst` in the arena, compared with the other types that we did put into an arena. This way we can also give it a `Span` without growing a lot of other HIR data structures because of the extra field. r? compiler
2024-05-03Auto merge of #124675 - matthiaskrgr:rollup-x6n79ua, r=matthiaskrgrbors-1/+1
Rollup of 7 pull requests Successful merges: - #122492 (Implement ptr_as_ref_unchecked) - #123815 (Fix cannot usage in time.rs) - #124059 (default_alloc_error_hook: explain difference to default __rdl_oom in alloc) - #124510 (Add raw identifier in a typo suggestion) - #124555 (coverage: Clean up creation of MC/DC condition bitmaps) - #124593 (Describe and use CStr literals in CStr and CString docs) - #124630 (CI: remove `env-x86_64-apple-tests` YAML anchor) r? `@ghost` `@rustbot` modify labels: rollup
2024-05-03Rollup merge of #124555 - Zalathar:init-coverage, r=nnethercoteMatthias Krüger-1/+1
coverage: Clean up creation of MC/DC condition bitmaps This PR improves the code for creating and initializing [MC/DC](https://en.wikipedia.org/wiki/Modified_condition/decision_coverage) condition bitmap variables, as introduced by #123409 and modified by #124255. - The condition bitmap variables are now created eagerly at the start of per-function codegen, via a new `init_coverage` method in `CoverageInfoBuilderMethods`. This avoids having to retroactively create the bitmaps while doing codegen for an individual coverage statement. - As a result, we can now create and initialize those bitmaps using existing safe APIs, instead of having to perform our own unsafe call to `llvm::LLVMBuildAlloca`. - This PR also tweaks the way we count the number of condition bitmaps needed, by tracking the total number of bitmaps needed (max depth + 1), instead of only tracking the maximum depth. This reduces the potential for subtle off-by-one confusion.
2024-05-03Auto merge of #123441 - saethlin:fixed-len-file-names, r=oli-obkbors-6/+5
Stabilize the size of incr comp object file names The current implementation does not produce stable-length paths, and we create the paths in a way that makes our allocation behavior is nondeterministic. I think `@eddyb` fixed a number of other cases like this in the past, and this PR fixes another one. Whether that actually matters I have no idea, but we still have bimodal behavior in rustc-perf and the non-uniformity in `find` and `ls` was bothering me. I've also removed the truncation of the mangled CGU names. Before this PR incr comp paths look like this: ``` target/debug/incremental/scratch-38izrrq90cex7/s-gux6gz0ow8-1ph76gg-ewe1xj434l26w9up5bedsojpd/261xgo1oqnd90ry5.o ``` And after, they look like this: ``` target/debug/incremental/scratch-035omutqbfkbw/s-gux6borni0-16r3v1j-6n64tmwqzchtgqzwwim5amuga/55v2re42sztc8je9bva6g8ft3.o ``` On the one hand, I'm sure this will break some people's builds because they're on Windows and only a few bytes from the path length limit. But if we're that seriously worried about the length of our file names, I have some other ideas on how to make them smaller. And last time I deleted some hash truncations from the compiler, there was a huge drop in the number if incremental compilation ICEs that were reported: https://github.com/rust-lang/rust/pull/110367https://github.com/rust-lang/rust/pull/110367 --- Upon further reading, this PR actually fixes a bug. This comment says the CGU names are supposed to be a fixed-length hash, and before this PR they aren't: https://github.com/rust-lang/rust/blob/ca7d34efa94afe271accf2bd3d44152a5bd6fff1/compiler/rustc_monomorphize/src/partitioning.rs#L445-L448
2024-05-03Rollup merge of #124492 - Strophox:adjust-allocbytes, r=RalfJungMatthias Krüger-7/+5
Generalize `adjust_from_tcx` for `Allocation` Previously, `adjust_from_tcx` would take an `Allocation` and "adjust allocation from the ones in `tcx` to a custom Machine instance [...]". This PR generalizes this so the Machine instance can also determine the `Bytes` type of the output `Allocation`. r? `@RalfJung`
2024-05-03remove trait bounds on AllocBytesStrophox-3/+1
2024-05-03Cow::from(&*...) changed to Cow::Owned(Vec::from(...))Strophox-1/+1
2024-05-03generalize adjust_from_tcxStrophox-4/+4
2024-05-03Rollup merge of #124610 - nnethercote:typenum, r=lcnrMatthias Krüger-8/+4
Tweak `consts_may_unify` r? ````@lcnr````
2024-05-02Higher ranked goal source, do overflow handling less badlyMichael Goulet-0/+3
2024-05-03Tweak `consts_may_unify`.Nicholas Nethercote-8/+4
`ConstKind::Value` is the only variant where control flow leaves the first match on `impl_ct.kind()`, so there is no need for a second match on the same expression later on.
2024-05-02Rollup merge of #124624 - WaffleLapkin:old_unit, r=fmeaseMatthias Krüger-7/+2
Use `tcx.types.unit` instead of `Ty::new_unit(tcx)` I don't think there is any need for the function, given that we can just access the `.types`, similarly to all other primitives?
2024-05-02Inline & delete `Ty::new_unit`, since it's just a field accessWaffle Lapkin-7/+2
2024-05-01Step bootstrap cfgsMark Rousskov-4/+2
2024-05-01add fixmeklensy-0/+3
2024-05-01DependencyList: remove outdated commentklensy-3/+0
2024-05-01Handle normalization failure in `struct_tail_erasing_lifetimes`Gurinder Singh-1/+16
Fixes an ICE that occurred when the struct in question has an error
2024-05-01coverage: Replace `max_decision_depth` with `num_condition_bitmaps`Zalathar-1/+1
This clearly distinguishes individual decision-depth indices from the total number of condition bitmaps to allocate.
2024-04-30Give an item related to issue 27438 a more meaningful nameLeón Orell Valerian Liehr-8/+6
2024-04-30Give items related to issue 33140 a more meaningful nameLeón Orell Valerian Liehr-24/+25
2024-04-30Rollup merge of #124511 - nnethercote:rm-extern-crates, r=fee1-deadMatthias Krüger-53/+100
Remove many `#[macro_use] extern crate foo` items This requires the addition of more `use` items, which often make the code more verbose. But they also make the code easier to read, because `#[macro_use]` obscures where macros are defined. r? `@fee1-dead`
2024-04-29Take proof trees by value in inspect goalMichael Goulet-3/+3
2024-04-29Only register candidate if it is associated w a shallow certaintyMichael Goulet-4/+4
2024-04-29Actually use probes when needed and stop relying on existing outer probesMichael Goulet-6/+9
2024-04-29Auto merge of #124255 - RenjiSann:renji/mcdc-nested-expressions, r=Zalatharbors-11/+29
MCDC coverage: support nested decision coverage #123409 provided the initial MCDC coverage implementation. As referenced in #124144, it does not currently support "nested" decisions, like the following example : ```rust fn nested_if_in_condition(a: bool, b: bool, c: bool) { if a && if b || c { true } else { false } { say("yes"); } else { say("no"); } } ``` Note that there is an if-expression (`if b || c ...`) embedded inside a boolean expression in the decision of an outer if-expression. This PR proposes a workaround for this cases, by introducing a Decision context stack, and by handing several `temporary condition bitmaps` instead of just one. When instrumenting boolean expressions, if the current node is a leaf condition (i.e. not a `||`/`&&` logical operator nor a `!` not operator), we insert a new decision context, such that if there are more boolean expressions inside the condition, they are handled as separate expressions. On the codegen LLVM side, we allocate as many `temp_cond_bitmap`s as necessary to handle the maximum encountered decision depth.
2024-04-29Avoid some `def_span` query callsOli Scherer-1/+1
2024-04-29mcdc-coverage: Get decision_depth from THIR loweringDorian Péron-0/+3
Use decision context stack to handle nested decisions: - Introduce MCDCDecisionCtx - Use a stack of MCDCDecisionCtx to handle nested decisions
2024-04-29mcdc-coverage: Add decision_depth field in structsDorian Péron-11/+26
Add decision_depth field to TVBitmapUpdate/CondBitmapUpdate statements Add decision_depth field to BcbMappingKinds MCDCBranch and MCDCDecision Add decision_depth field to MCDCBranchSpan and MCDCDecisionSpan
2024-04-29Remove `extern crate smallvec` from a couple of crates.Nicholas Nethercote-6/+4
2024-04-29Remove `extern crate bitflags` from a couple of crates.Nicholas Nethercote-5/+3