about summary refs log tree commit diff
path: root/compiler
AgeCommit message (Collapse)AuthorLines
2024-05-05Auto merge of #124606 - scottmcm:less-expect, r=cjgillotbors-2/+2
Stop `llvm.expect`ing assert terminators We're putting `llvm.expect` calls before the <https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/mir/enum.TerminatorKind.html#variant.Assert> terminators. But we don't need them. One of the arms is always to a panic function that's marked `#[cold]`, which is `cold` <https://llvm.org/docs/LangRef.html#function-attributes> in LLVM, which > When computing edge weights, basic blocks post-dominated by a cold function call are also considered to be cold; and, thus, given low weight. So even without us emitting the extra intrinsic call, LLVM knows what to expect for the `br`. Thus we can save the (small) effort of emitting it and then LLVM optimizing it out. r? compiler
2024-05-04Rollup merge of #124720 - RalfJung:interpret-drop, r=compiler-errorsMatthias Krüger-8/+11
interpret: Drop: always evaluate place That way we can also avoid dealing with `instantiate_from_frame_and_normalize_erasing_regions`.
2024-05-04Rollup merge of #124718 - compiler-errors:record-impl-args, r=lcnrMatthias Krüger-2/+6
Record impl args in the proof tree Weren't recording these since they went through a different infcx method r? lcnr
2024-05-04Rollup merge of #124717 - compiler-errors:do-not-recomment-next-solver, r=lcnrMatthias Krüger-1/+10
Implement `do_not_recommend` in the new solver Put the test into `diagnostic_namespace` test folder even though it's not in the diagnostic namespace, because it should be soon. r? lcnr cc `@weiznich`
2024-05-04Rollup merge of #124713 - Urgau:check-cfg-update-cargo-diagnostics, r=jieyouxuMatthias Krüger-4/+4
Update Cargo specific diagnostics in check-cfg This PR updates the Cargo specific diagnostics for check-cfg/`unexpected_cfgs` lint. Specifically it update to new url and use the double-column (instead of one) in the Cargo directive suggestion. `@rustbot` label +F-check-cfg cc `@weihanglo`
2024-05-04Rollup merge of #124690 - compiler-errors:only-ambig-if-ambig, r=lcnrMatthias Krüger-9/+11
Only consider ambiguous goals when finding best obligation for ambiguities We don't care about ambiguous goals when reporting true errors, and vice versa for ambiguities. r? lcnr
2024-05-04some comments or dynamic drop handlingRalf Jung-2/+8
2024-05-04interpret: Drop: always evaluate placeRalf Jung-6/+3
2024-05-04Record impl args in the proof treeMichael Goulet-2/+6
2024-05-04Implement do_not_recommend in the new solverMichael Goulet-1/+10
2024-05-04Rollup merge of #124715 - RalfJung:interpret-noreturn, r=compiler-errorsMatthias Krüger-20/+5
interpret, miri: uniform treatments of intrinsics/functions with and without return block A long time ago we didn't have a `dest: &MPlaceTy<'tcx, Self::Provenance>` for diverging functions, and since `dest` is used so often we special-cased these non-returning intrinsics and functions so that we'd have `dest` available everywhere else. But this has changed a while ago, now only the return block `ret` is optional, and there's a convenient `return_to_block` function for dealing with the `None` case. So there no longer is any reason to treat diverging intrinsics/functions any different from those that do return.
2024-05-04Rollup merge of #124584 - Nilstrieb:entrypointy, r=fee1-deadMatthias Krüger-43/+49
Various improvements to entrypoint code This moves some code around and adds some documentation comments to make it easier to understand what's going on with the entrypoint logic, which is a bit complicated. The only change in behavior is consolidating the error messages for unix_sigpipe to make the code slightly simpler.
2024-05-04Only consider ambiguous goals when finding best obligation for ambiguitiesMichael Goulet-9/+11
2024-05-04interpret, miri: uniform treatments of intrinsics/functions with and without ↵Ralf Jung-20/+5
return block
2024-05-04Update Cargo diagnostics in check-cfgUrgau-4/+4
2024-05-04Various improvements to entrypoint codeNilstrieb-43/+49
This moves some code around and adds some documentation comments to make it easier to understand what's going on with the entrypoint logic, which is a bit complicated. The only change in behavior is consolidating the error messages for unix_sigpipe to make the code slightly simpler.
2024-05-04Rollup merge of #124677 - djkoloski:set_fuchsia_frame_pointer, r=tmandryMatthias Krüger-1/+4
Set non-leaf frame pointers on Fuchsia targets This is part of our work to enable shadow call stack sanitization on Fuchsia, see [this Fuchsia issue](https://g-issues.fuchsia.dev/issues/327643884). r? ``@tmandry``
2024-05-04Rollup merge of #124293 - oli-obk:miri_intrinsic_fallback_body, r=RalfJungMatthias Krüger-13/+47
Let miri and const eval execute intrinsics' fallback bodies fixes https://github.com/rust-lang/miri/issues/3397 r? ``@RalfJung``
2024-05-03Rollup merge of #124687 - fee1-dead-contrib:private-clauses, r=compiler-errorsMichael Goulet-1/+1
Make `Bounds.clauses` private Construct it through `Bounds::default()`, then consume the clauses via the method `Bounds::clauses()`. This helps with effects desugaring where `clauses()` is not only the clauses within the `clauses` field.
2024-05-03Rollup merge of #124648 - nnethercote:trim-crate-graph, r=jackh726Michael Goulet-22/+13
Trim crate graph This PR removes some unnecessary `Cargo.toml` entries, and makes some other small related cleanups that I found while looking at this stuff. r? ```@pnkfelix```
2024-05-03Rollup merge of #124480 - Enselic:on-broken-pipe, r=jieyouxuMichael Goulet-58/+40
Change `SIGPIPE` ui from `#[unix_sigpipe = "..."]` to `-Zon-broken-pipe=...` In the stabilization [attempt](https://github.com/rust-lang/rust/pull/120832) of `#[unix_sigpipe = "sig_dfl"]`, a concern was [raised ](https://github.com/rust-lang/rust/pull/120832#issuecomment-2007394609) related to using a language attribute for the feature: Long term, we want `fn lang_start()` to be definable by any crate, not just libstd. Having a special language attribute in that case becomes awkward. So as a first step towards the next stabilization attempt, this PR changes the `#[unix_sigpipe = "..."]` attribute to a compiler flag `-Zon-broken-pipe=...` to remove that concern, since now the language is not "contaminated" by this feature. Another point was [also raised](https://github.com/rust-lang/rust/pull/120832#issuecomment-1987023484), namely that the ui should not leak **how** it does things, but rather what the **end effect** is. The new flag uses the proposed naming. This is of course something that can be iterated on further before stabilization. Tracking issue: https://github.com/rust-lang/rust/issues/97889
2024-05-03Rollup merge of #124418 - compiler-errors:better-cause, r=lcnrMichael Goulet-40/+203
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-04Make `Bounds.clauses` privateDeadbeef-1/+1
2024-05-04Auto merge of #124401 - oli-obk:some_hir_cleanups, r=cjgillotbors-70/+69
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 #123602 - cjgillot:gvn-borrowed, r=oli-obkbors-42/+78
Account for immutably borrowed locals in MIR copy-prop and GVN For the most part, we consider that immutably borrowed `Freeze` locals still fulfill SSA conditions. As the borrow is immutable, any use of the local will have the value given by the single assignment, and there can be no surprise. This allows copy-prop to merge a non-borrowed local with a borrowed local. We chose to keep copy-classes heads unborrowed, as those may be easier to optimize in later passes. This also allows to GVN the value behind an immutable borrow. If a SSA local is borrowed, dereferencing that borrow is equivalent to copying the local's value: re-executing the assignment between the borrow and the dereference would be UB. r? `@ghost` for perf
2024-05-03Auto merge of #124675 - matthiaskrgr:rollup-x6n79ua, r=matthiaskrgrbors-57/+73
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-03Set non-leaf frame pointers on Fuchsia targetsDavid Koloski-1/+4
2024-05-03Rollup merge of #124555 - Zalathar:init-coverage, r=nnethercoteMatthias Krüger-56/+72
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-03Rollup merge of #124510 - linyihai:raw-ident-in-typo-suggestion, r=fmeaseMatthias Krüger-1/+1
Add raw identifier in a typo suggestion Fixes #68962
2024-05-03Auto merge of #123441 - saethlin:fixed-len-file-names, r=oli-obkbors-70/+145
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 #124588 - compiler-errors:ocx, r=lcnrMatthias Krüger-112/+148
Use `ObligationCtxt` in favor of `TraitEngine` in many more places r? lcnr
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-03Ensure miri only uses fallback bodies that have manually been vetted to ↵Oli Scherer-2/+3
preserve all UB that the native intrinsic would have
2024-05-03Let miri and const eval execute intrinsics' fallback bodiesOli Scherer-12/+45
2024-05-03Fix `Cargo.toml` whitespace.Nicholas Nethercote-1/+1
2024-05-03Use `parse` renaming of `rustc_parse_format`.Nicholas Nethercote-2/+2
This is a case where `rustc_parse_format` is renamed as `parse` but a couple of places don't take advantage.
2024-05-03Remove some low-value `use` renamings.Nicholas Nethercote-15/+10
There are a few common abbreviations like `use rustc_ast as ast` and `use rust_hir as hir` for names that are used a lot. But there are also some cases where a crate is renamed just once in the whole codebase, and that ends up making things harder to read rather than easier. This commit removes them.
2024-05-03Remove some unneeded `Cargo.toml` dependencies.Nicholas Nethercote-4/+0
I found these with a hacky shell script.
2024-05-03Rollup merge of #124637 - fmease:ast-pretty-ty-asc-builtin-syn, ↵Matthias Krüger-11/+19
r=compiler-errors AST pretty: Use `builtin_syntax` for type ascription Follow-up to #122806. CC #124619.
2024-05-03Rollup merge of #124610 - nnethercote:typenum, r=lcnrMatthias Krüger-8/+4
Tweak `consts_may_unify` r? ````@lcnr````
2024-05-02Take ocx by move for pending obligationsMichael Goulet-4/+11
2024-05-02Use ObligationCtxt in favor of TraitEngine in many placesMichael Goulet-112/+141
2024-05-02Higher ranked goal source, do overflow handling less badlyMichael Goulet-80/+90
2024-05-02Use a proof tree visitor to refine the Obligation for error reportingMichael Goulet-10/+147
2024-05-02Record more kinds of things as impl where boundsMichael Goulet-12/+13
2024-05-02Store goal source in InspectGoalMichael Goulet-12/+27
2024-05-02Record certainty before evaluating nesteds, so we make candidatesMichael Goulet-2/+2