about summary refs log tree commit diff
path: root/compiler
AgeCommit message (Collapse)AuthorLines
2025-03-21Cache current_dll_path outputbjorn3-56/+66
Computing the current dll path is somewhat expensive relative to other work when compiling `fn main() {}` as `dladdr` needs to iterate over the symbol table of librustc_driver.so until it finds a match.
2025-03-21coverage: Defer the filtering of hole spansZalathar-15/+15
2025-03-21coverage: Separate span-extraction from unexpansionZalathar-75/+66
2025-03-21remove `feature(inline_const_pat)`lcnr-29/+14
2025-03-21Address commentsJohn Kåre Alsaker-21/+33
2025-03-21Use hashbrown from crates.ioJohn Kåre Alsaker-4/+10
2025-03-21Optimize hash map operations in the query systemJohn Kåre Alsaker-35/+46
2025-03-21Update commentsJohn Kåre Alsaker-2/+8
2025-03-21Abort in deadlock handler if we fail to get a query mapJohn Kåre Alsaker-12/+25
2025-03-21Rollup merge of #138754 - oli-obk:push-vtqtnwluyxop, r=compiler-errorsMatthias Krüger-1/+22
Handle spans of `~const`, `const` and `async` trait bounds in macro expansion r? `@compiler-errors` `visit_span` is actually only used in one place (the `transcribe::Marker`), and all of this syntax is unstable, so while it would still be nice to write a test for it, I wager there's lots more interesting things in `transcribe::Marker` to write tests for. And the worst is some diagnostics being weird or incremental being not as incremental as it could be
2025-03-21Rollup merge of #138724 - fmease:list-stems-bear-no-name, r=nnethercoteMatthias Krüger-2/+1
Check attrs: Don't try to retrieve the name of list stems Fixes #138723. r? nnethercote or compiler
2025-03-21Rollup merge of #138713 - RalfJung:memory-hook-pointers, r=oli-obkMatthias Krüger-2/+23
interpret memory access hooks: also pass through the Pointer used for the access In some ongoing work on the Miri side, we need the absolute address that the memory access occurred at. That is non-trivial to obtain since we don't have an `ecx`. So pass through the `Pointer` used for the access, which contains the address, and which is available everywhere we are calling these hooks. r? `@oli-obk`
2025-03-20Auto merge of #138747 - matthiaskrgr:rollup-68x44rw, r=matthiaskrgrbors-171/+313
Rollup of 8 pull requests Successful merges: - #138435 (Add support for postfix yield expressions) - #138685 (Use `Option<Ident>` for lowered param names.) - #138700 (Suggest `-Whelp` when pass `--print lints` to rustc) - #138727 (Do not rely on `type_var_origin` in `OrphanCheckErr::NonLocalInputType`) - #138729 (Clean up `FnCtxt::resolve_coroutine_interiors`) - #138731 (coverage: Add LLVM plumbing for expansion regions) - #138732 (Use `def_path_str` for def id arg in `UnsupportedOpInfo`) - #138735 (Remove `llvm` and `llvms` triagebot ping aliases for `icebreakers-llvm` ping group) r? `@ghost` `@rustbot` modify labels: rollup
2025-03-20Auto merge of #138515 - petrochenkov:cfgtrace, r=nnethercotebors-18/+52
expand: Leave traces when expanding `cfg_attr` attributes Currently `cfg_trace` just disappears during expansion, but after this PR `#[cfg_attr(some tokens)]` will leave a `#[cfg_attr_trace(some tokens)]` attribute instead of itself in AST after expansion (the new attribute is built-in and inert, its inner tokens are the same as in the original attribute). This trace attribute can then be used by lints or other diagnostics, #133823 has some examples. Tokens in these trace attributes are set to an empty token stream, so the traces are non-existent for proc macros and cannot affect any user-observable behavior. This is also a weakness, because if a proc macro processes some code with the trace attributes, they will be lost, so the traces are best effort rather than precise. The next step is to do the same thing with `cfg` attributes (`#[cfg(TRUE)]` currently remains in both AST and tokens after expanding, it should be replaced with a trace instead). The idea belongs to `@estebank.`
2025-03-20Handle spans of `~const`, `const` and `async` trait bounds in macro expansionOli Scherer-1/+22
2025-03-20Make `crate_hash` not iterate over `hir_crate` owners anymoreOli Scherer-6/+5
2025-03-20Make dedicated recovery for missing braces on closure with returnMichael Goulet-6/+47
2025-03-20Fix diagnostic struct typo, make sure is_array_like_block checks that it's a ↵Michael Goulet-6/+8
block
2025-03-20interpret memory access hooks: also pass through the Pointer used for the accessRalf Jung-2/+23
2025-03-20Rollup merge of #138732 - compiler-errors:did, r=jieyouxuMatthias Krüger-5/+6
Use `def_path_str` for def id arg in `UnsupportedOpInfo` We could alternatively just omit the def path from the label, but I think it's fine to keep around Fixes #138730
2025-03-20Rollup merge of #138731 - Zalathar:llvm-expansion, r=jieyouxuMatthias Krüger-34/+97
coverage: Add LLVM plumbing for expansion regions This is currently unused, but paves the way for future work on expansion regions without having to worry about the FFI parts. The span conversion refactoring is only loosely related, but I've included it here because it would conflict with the main changes in `fill_region_tables`, and is pretty straightforward on its own.
2025-03-20Rollup merge of #138729 - compiler-errors:gen, r=lcnrMatthias Krüger-16/+19
Clean up `FnCtxt::resolve_coroutine_interiors` Random cleanups before I make a PR that stalls generator obligations. r? lcnr
2025-03-20Rollup merge of #138727 - compiler-errors:ty-var-origin, r=fmeaseMatthias Krüger-54/+27
Do not rely on `type_var_origin` in `OrphanCheckErr::NonLocalInputType` The ordering of ty var unification means that we may end up with a root variable whose ty var origin is from another item's params. Let's not rely on this by just unifying the infer vars with the params of the impl + resolving. It's kinda goofy but it's clearer IMO. Fixes #132826. r? `@fmease` or `@lcnr`
2025-03-20Rollup merge of #138700 - xizheyin:issue-138612, r=NadrierilMatthias Krüger-0/+6
Suggest `-Whelp` when pass `--print lints` to rustc Closes #138612
2025-03-20Rollup merge of #138685 - ↵Matthias Krüger-50/+83
nnethercote:use-Option-Ident-for-lowered-param-names, r=compiler-errors Use `Option<Ident>` for lowered param names. Parameter patterns are lowered to an `Ident` by `lower_fn_params_to_names`, which is used when lowering bare function types, trait methods, and foreign functions. Currently, there are two exceptional cases where the lowered param can become an empty `Ident`. - If the incoming pattern is an empty `Ident`. This occurs if the parameter is anonymous, e.g. in a bare function type. - If the incoming pattern is neither an ident nor an underscore. Any such parameter will have triggered a compile error (hence the `span_delayed_bug`), but lowering still occurs. This commit replaces these empty `Ident` results with `None`, which eliminates a number of `kw::Empty` uses, and makes it impossible to fail to check for these exceptional cases. Note: the `FIXME` comment in `is_unwrap_or_empty_symbol` is removed. It actually should have been removed in #138482, the precursor to this PR. That PR changed the lowering of wild patterns to `_` symbols instead of empty symbols, which made the mentioned underscore check load-bearing. r? ``@compiler-errors``
2025-03-20Rollup merge of #138435 - eholk:prefix-yield, r=oli-obkMatthias Krüger-12/+75
Add support for postfix yield expressions We've been having a discussion about whether we want postfix yield, or want to stick with prefix yield, or have both. I figured it's easy enough to support both for now and let us play around with them while the feature is still experimental. This PR treats `yield x` and `x.yield` as semantically equivalent. There was a suggestion to make `yield x` have a `()` type (so it only works in coroutines with `Resume = ()`. I think that'd be worth trying, either in a later PR, or before this one merges, depending on people's opinions. #43122
2025-03-20Auto merge of #133889 - compiler-errors:inh-unstable, r=Nadrierilbors-2/+22
Consider fields to be inhabited if they are unstable Fixes #133885 with a simple heuristic r? Nadrieril Not totally certain if this needs T-lang approval or a crater run.
2025-03-20rustc_target: Use zvl*b target features in vector ABI checkTaiki Endo-2/+14
2025-03-20rustc_target: Add more RISC-V vector-related featuresTaiki Endo-2/+40
2025-03-20Auto merge of #137930 - nnethercote:use-Wunused-crate-dependencies, ↵bors-41/+50
r=jieyouxu,Nadrieril Use `Wunused-crate-dependencies` for the compiler An implementation of https://github.com/rust-lang/compiler-team/issues/844. r? `@jieyouxu`
2025-03-19Lower to a memset(undef) when Rvalue::Repeat repeats uninitBen Kimock-4/+45
2025-03-20Use def_path_str for def id arg in UnsupportedOpInfoMichael Goulet-5/+6
2025-03-20coverage: Convert and check span coordinates without a local file IDZalathar-27/+40
For expansion region support, we will want to be able to convert and check spans before creating a corresponding local file ID. If we create local file IDs eagerly, but some expansion turns out to have no successfully-converted spans, LLVM will complain about that expansion's file ID having no regions.
2025-03-20Pre cleanupsMichael Goulet-16/+19
2025-03-20Do not rely on type_var_origin in OrphanCheckErr::NonLocalInputTypeMichael Goulet-54/+27
2025-03-20Add `#[repr(u128)]`/`#[repr(i128)]` enums to `improper_ctypes_definitions`beetrees-1/+11
2025-03-20coverage: Add LLVM plumbing for expansion regionsZalathar-7/+57
This is currently unused, but paves the way for future work on expansion regions without having to worry about the FFI parts.
2025-03-19Check attrs: Don't try to retrieve the name of list stemsLeón Orell Valerian Liehr-2/+1
2025-03-20Convert `rustc_serialize` integration tests to unit tests.Nicholas Nethercote-14/+16
Because (a) the vast majority of compiler tests are unit tests, and (b) this works better with `unused_crate_dependencies`.
2025-03-20Use `-Wunused_crate_dependencies` for compiler crates.Nicholas Nethercote-34/+41
It's very useful. There are some false positives involving integration tests in `rustc_pattern_analysis` and `rustc_serialize`. There is also a false positive involving `rustc_driver_impl`'s `rustc_randomized_layouts` feature. And I removed a `rustc_span` mention in a doc comment in `rustc_log` because it wasn't integral to the comment but caused a dev-dependency.
2025-03-19Auto merge of #138714 - matthiaskrgr:rollup-8uwbpwv, r=matthiaskrgrbors-179/+166
Rollup of 7 pull requests Successful merges: - #135394 (`MaybeUninit` inherent slice methods part 2) - #137051 (Implement default methods for `io::Empty` and `io::Sink`) - #138001 (mir_build: consider privacy when checking for irrefutable patterns) - #138540 (core/slice: Mark some `split_off` variants unstably const) - #138589 (If a label is placed on the block of a loop instead of the header, suggest moving it to the header.) - #138594 (Fix next solver handling of shallow trait impl check) - #138613 (Remove E0773 "A builtin-macro was defined more than once.") Failed merges: - #138602 (Slim `rustc_parse_format` dependencies down) r? `@ghost` `@rustbot` modify labels: rollup
2025-03-19Address review comments.Mara Bos-1/+4
2025-03-19Allow duplicates for side effect nodesJohn Kåre Alsaker-2/+5
2025-03-19Pass in dep kind names to the duplicate dep node checkJohn Kåre Alsaker-10/+38
2025-03-19Rename `intern_new_node` to `alloc_new_node`John Kåre Alsaker-4/+4
2025-03-19Use `ShardedHashMap` for `anon_node_to_index`John Kåre Alsaker-28/+9
2025-03-19Use `nodes_newly_allocated_in_current_session` to lookup forbidden readsJohn Kåre Alsaker-5/+18
2025-03-19Check for duplicate dep nodes when creating the indexJohn Kåre Alsaker-1/+8
2025-03-19Add fixmeJohn Kåre Alsaker-0/+1
2025-03-19Outline some cold code and turn on hash collision detection with ↵John Kåre Alsaker-16/+21
debug_assertions