about summary refs log tree commit diff
path: root/src/tools
AgeCommit message (Collapse)AuthorLines
2024-09-11Auto merge of #18078 - cuishuang:master, r=Veykrilbors-3/+5
Remove unnecessary symbols and add missing symbols
2024-09-11Auto merge of #18057 - alibektas:better_ratoml_testing, r=Veykrilbors-103/+228
internal: Better testing infra for ratoml This PR makes some improvements on how we test configs that come from `rust-analyzer.toml` files. It was primarily used to solve #18021 but along the way I could not really determine the cause of the said issue which makes me think that it may not be related to the changes that I made earlier to the ratoml infra. In either way `custom_snippets` are now made `global` because we still don't have a tree that maps a `SourceRootId` to a set of `Snippet`s.
2024-09-11Auto merge of #18052 - Coekjan:fix-inline-const, r=Veykrilbors-4/+14
fix: Fix `inline_const_as_literal` error when the number >= 10 ## Description ### The Bug This PR fixes a small bug in the IDE assistence (`inline_const_as_literal`). When the being-inlined constant is a number and it is greater than or equal to 10, the assistence inserts unexpected string `(0x...)` after the number itself. A simple example is followed: Current `inline_const_as_literal` changes ```rs const A: usize = 16; fn f() -> usize { A // inline the constant } ``` into ```rs const A: usize = 16; fn f() -> usize { 16 (0x10) } ``` The bug originates from #14925 & #15306 . #14925 added some unittests, but it just tested the number-inlining behavior when the number is `0`. https://github.com/rust-lang/rust-analyzer/blob/50882fbfa204027c84753e6d51a1a12884dc1b19/crates/ide-assists/src/handlers/inline_const_as_literal.rs#L124-L138 And #15306 modified the behavior of `Const::render_eval` and added the `(0x...)` part after the number (if the number >= `10`). Because of insufficient unittests in #14925, changes about `Const::render_eval` in #15306 introduced this bug with no CI failure. ### The Fix I think `Const::render_eval` is intended for user-facing value displaying (e.g. hover) and not designed for `inline_const_as_literal`. To fix the bug, I defined a new function named `Const::eval`, which evaluates the value itself faithfully and simply and does nothing else. ## Thanks Thanks `@roife` for your kind help. Your guidance helped me better understand the code.
2024-09-11Auto merge of #18018 - ChayimFriedman2:unit-ret-complete-semi, r=Veykrilbors-40/+217
feat: Automatically add semicolon when completing unit-returning functions But provide a config to suppress that. I didn't check whether we are in statement expression position, because this is hard in completion (due to the natural incompleteness of source code when completion is invoked), and anyway using function returning unit as an argument to something seems... dubious. Fixes #17263.
2024-09-11Properly set the working directory for proc-macro executionLukas Wirth-5/+29
2024-09-11Auto merge of #17904 - darichey:unresolved-references, r=Veykrilbors-0/+200
Add command to report unresolved references Adds `rust-analyzer unresolved-references` which reports unresolved references. This is useful for debugging and regression testing for both rust-analyzer and project generators like Buck's rust-project. As discussed: https://rust-lang.zulipchat.com/#narrow/stream/185405-t-compiler.2Frust-analyzer/topic/Command.20to.20report.20unresolved.20references
2024-09-11Lift out workspace related data into a separate query to preserve crategraph ↵Lukas Wirth-97/+98
deduplication
2024-09-11Auto merge of #18050 - rust-lang:davidbarsky/push-uyvtlsvoqrxw, r=Veykrilbors-9/+25
assist: ensure `replace_qualified_name_with_use` applies to the first path segment This change helps a bit with the discoverability of `replace_qualified_name_with_use`. Specifically, it ensures that a cursor on the first path segment (e.g., `$0std::fmt::Debug`, where `$0` is the cursor) would result in an import along the lines of `use std::fmt;` and `fmt::Debug;` at the usage sites.
2024-09-11Remove crate graph deduplication logicLukas Wirth-19658/+6
2024-09-11miri: support vector index arguments in simd_shuffleRalf Jung-9/+14
2024-09-11also allow illumos to use mmap for its stack guardRalf Jung-2/+2
2024-09-11Auto merge of #18093 - ShoyuVanilla:skip-dyn-trait-cast-check, r=Veykrilbors-0/+139
Skip checks for cast to dyn traits It seems that chalk fails to solve some obvious goals when there are some recursiveness in trait environments. And it doesn't support trait upcasting yet. rust-lang/chalk#796 This PR just skips for casting into types containing `dyn Trait` to prevent false positive diagnostics like #18047 and #18083
2024-09-11document the new git logic in more detailonur-ozkan-5/+18
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2024-09-11Merge from rustcThe Miri Cronjob Bot-33/+46
2024-09-11Preparing for merge from rustcThe Miri Cronjob Bot-1/+1
2024-09-10rustdoc: redesign toolbar and disclosure widgetsMichael Howell-2/+2
This adds labels to the icons and moves them away from the search box. These changes are made together, because they work together, but are based on several complaints: * The [+/-] thing are a Reddit-ism. They don't look like buttons, but look like syntax <https://rust-lang.zulipchat.com/#narrow/stream/266220-t-rustdoc/topic/More.20visual.20difference.20for.20the.20.2B.2F-.20.20Icons>, <https://github.com/rust-lang/rust/issues/59851> (some of these are laundry lists with more suggestions, but they all mention [+/-] looking wrong) * The settings, help, and summary buttons are also too hard to recognize <https://lwn.net/Articles/987070/>, <https://github.com/rust-lang/rust/issues/90310>, <https://github.com/rust-lang/rust/issues/14475#issuecomment-274241997>, <https://internals.rust-lang.org/t/improve-rustdoc-design/12758> ("Not all functionality is self-explanatory, for example the [+] button in the top right corner, the theme picker or the settings button.") The toggle-all and toggle-individual buttons both need done at once, since we want them to look like they go together. This changes them from both being [+/-] to both being arrows. Settings and Help are also migrated, so that the whole group can benefit from being described using actual words. Additionally, the Help button is only shown on SERPs, not all the time. This is done for two major reasons: * Most of what's in there is search-related. The things that aren't are keyboard commands, and the search box tells you about that anyway. Pressing <kbd>?</kbd> will temporarily show the button and its popover. * I'm trading it off by showing the help button, even on mobile. It's useful since you can use the search engine suggestions there. * The three buttons were causing line wrapping on too many desktop layouts.
2024-09-10Auto merge of #129403 - scottmcm:only-array-simd, r=compiler-errorsbors-30/+30
Ban non-array SIMD Nearing the end of https://github.com/rust-lang/compiler-team/issues/621 ! Currently blocked on ~~https://github.com/rust-lang/compiler-builtins/pull/673~~ ~~https://github.com/rust-lang/compiler-builtins/pull/674~~ ~~https://github.com/rust-lang/rust/pull/129400~~ ~~https://github.com/rust-lang/rust/pull/129481~~ for windows.
2024-09-10handle `GitConfig` for `tools/compiletest`onur-ozkan-2/+10
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2024-09-11Skip checks for cast to dyn traitsShoyu Vanilla-0/+139
2024-09-10Correctly escape strings in our quote macroChayim Refael Friedman-6/+25
This is a small change, but it was the cause of 90% of the errors in `rust-analyzer diagnostics .` 🫢 With this change and #18085 together, all remaining errors are type errors. This may mean we can enable more errors, but this is out of scope for this PR.
2024-09-10Add test for S_OBJNAME and update test for LF_BUILDINFO cl and cmd forFlorian Schmiderer-0/+6
pdb files.
2024-09-10Auto merge of #18032 - DropDemBits:sed-tree-edits, r=davidbarskybors-0/+1251
internal: Add preliminary `SyntaxEditor` functionality Related to #15710 Implements a `SyntaxEditor` interface to abstract over the details of modifying syntax trees, to both simplify creating new code fixes and code actions, as well as start on the path of getting rid of mutable syntax nodes. `SyntaxEditor` relies on `SyntaxMappingBuilder`s to feed in the correct information to map AST nodes created by `make` constructors, as `make` constructors do not guarantee that node identity is preserved. This is to paper over the fact that `make` constructors simply re-parse text input instead of building AST nodes from the ground up and re-using the provided syntax nodes. `SyntaxAnnotation`s are used to find where syntax elements have ended up after edits are applied. This is primarily useful for the `add_{placeholder,tabstop}` set of methods on `SourceChangeBuilder`, as that currently relies on the nodes provided being in the final syntax tree. Eventually, the goal should be to move this into the `rowan` crate when we move away from mutable syntax nodes, but for now it'll stay in the `syntax` crate. --- Closes #14921 as `SyntaxEditor` ensures that all replace changes are disjoint Closes #9649 by implementing `SyntaxAnnotation`s
2024-09-10miri: treat non-memory local variables properly for data race detectionRalf Jung-7/+382
2024-09-10fmtRalf Jung-48/+62
2024-09-10Merge from rustcRalf Jung-128/+906
2024-09-10Preparing for merge from rustcRalf Jung-1/+1
2024-09-10Auto merge of #130179 - workingjubilee:rollup-l78cv44, r=workingjubileebors-3/+16
Rollup of 11 pull requests Successful merges: - #128316 (Stabilize most of `io_error_more`) - #129473 (use `download-ci-llvm=true` in the default compiler config) - #129529 (Add test to build crates used by r-a on stable) - #129981 (Remove `serialized_bitcode` from `LtoModuleCodegen`.) - #130094 (Inform the solver if evaluation is concurrent) - #130132 ([illumos] enable SIGSEGV handler to detect stack overflows) - #130146 (bootstrap `naked_asm!` for `compiler-builtins`) - #130149 (Helper function for formatting with `LifetimeSuggestionPosition`) - #130152 (adapt a test for llvm 20) - #130162 (bump download-ci-llvm-stamp) - #130164 (move some const fn out of the const_ptr_as_ref feature) r? `@ghost` `@rustbot` modify labels: rollup
2024-09-09Update the MIRI testsScott McMurray-30/+30
2024-09-09Rollup merge of #129529 - lqd:stable-new-solver, r=KobzolJubilee-3/+16
Add test to build crates used by r-a on stable r? ````````@Kobzol```````` I've opened other PRs for this one to work and they've landed already. I cherry-picked your commit, and added the last remaining pieces we needed I think.
2024-09-10Auto merge of #129778 - RalfJung:interp-lossy-typed-copy, r=saethlinbors-12/+503
interpret: make typed copies lossy wrt provenance and padding A "typed copy" in Rust can be a lossy process: when copying at type `usize` (or any other non-pointer type), if the original memory had any provenance, that provenance is lost. When copying at pointer type, if the original memory had partial provenance (i.e., not the same provenance for all bytes), that provenance is lost. When copying any type with padding, the contents of padding are lost. This PR equips our validity-checking pass with the ability to reset provenance and padding according to those rules. Can be reviewed commit-by-commit. The first three commits are just preparation without any functional change. Fixes https://github.com/rust-lang/miri/issues/845 Fixes https://github.com/rust-lang/miri/issues/2182
2024-09-09Rollup merge of #130131 - Zalathar:up-to-date, r=KobzolMatthias Krüger-2/+6
Print a helpful message if any tests were skipped for being up-to-date When running tests without the `--force-rerun` flag, compiletest will automatically skip any tests that (in its judgement) don't need to be run again since the last time they were run. This is normally very useful, but can occasionally be confusing, especially in edge-cases where up-to-date checking is not completely accurate (or the test is flaky). This PR makes bootstrap count the number of tests that were ignored for being up-to-date (via a hard-coded check on the ignore reason), and prints a helpful message when that number is nonzero. --- Sample output: ```text test result: ok. 4 passed; 0 failed; 17578 ignored; 0 measured; 0 filtered out; finished in 463.79ms help: ignored 17295 up-to-date tests; use `--force-rerun` to prevent this Build completed successfully in 0:00:07 ```
2024-09-09handle `GitConfig` for `tools/suggest-tests`onur-ozkan-0/+1
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2024-09-09implement `build_helper::git::get_closest_merge_commit`onur-ozkan-6/+34
Compare to `get_git_merge_base`, this doesn't require configuring the upstream remote. Signed-off-by: onur-ozkan <work@onurozkan.dev>
2024-09-09add `git_merge_commit_email` into `GitConfig`onur-ozkan-0/+1
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2024-09-09sync: store extra sync primitive data in a Box<dyn Any> so the type can be ↵Ralf Jung-66/+59
kept local
2024-09-09sync methods: pass around places, not pointer-typed operandsRalf Jung-95/+69
2024-09-09Auto merge of #3871 - Mandragorian:detect_rwlock_move, r=RalfJungbors-5/+68
detect when pthread_rwlock_t is moved For some implementations of pthreads, the address of pthread_rwlock_t (or its fields) is used to identify the lock. That means that if the contents of a pthread_rwlock_t are moved in memory, effectively a new lock object is created, which is completely independted from the original. Thus we want to detect when when such objects are moved and show an error. see also #3749 for more context
2024-09-10feat: generate names for tuple-struct in add-missing-match-armsroife-24/+106
2024-09-10refactor: introduce NameGenerator in suggest_nameroife-81/+192
2024-09-09feat: use shorthand when pretty-print record patroife-6/+79
2024-09-09Auto merge of #3872 - trivikr:actions-checkout-v4, r=RalfJungbors-2/+2
ci: bump actions/checkout to v4 Required for using Node.js 20.x in CI * Changelog for actions/checkout@v4 https://github.com/actions/checkout/blob/main/CHANGELOG.md?rgh-link-date=2024-09-04T18%3A38%3A10Z#v400 * GitHub Blog post https://github.blog/changelog/2024-03-07-github-actions-all-actions-will-run-on-node20-instead-of-node16-by-default/ Refs: https://github.com/rust-lang/rust/pull/130124#issuecomment-2336871149
2024-09-09fix UB in a testRalf Jung-2/+35
also add an explicit test for the fact that a Option<WidePtr> has padding when it is None
2024-09-09use fd_num for file descriptors, so we can use fd for file descriptionRalf Jung-92/+83
2024-09-09Auto merge of #18041 - roife:fix-issue-17631, r=Veykrilbors-1/+95
feat: better name suggestions for fn fix #17631. Better name suggestions for fn-calls / method-calls in the form of `from()`, `from_xxx()`, `into()`, etc.
2024-09-09feat: better name suggestions for fnroife-1/+95
2024-09-09ci: bump actions/checkout to v4Trivikram Kamat-2/+2
2024-09-09fix: add parenthesis for or-patternroife-1/+18
2024-09-09fix: use `pretty_print_pat` for params in fnroife-5/+123
2024-09-09feat: add prettifier for Patroife-0/+31
2024-09-09feat: Allow hir-def prettifier formatting into one-lineroife-15/+55