about summary refs log tree commit diff
AgeCommit message (Collapse)AuthorLines
2024-12-16Rollup merge of #134284 - estebank:issue-74863, r=lcnrMatthias Krüger-8/+135
Keep track of patterns that could have introduced a binding, but didn't When we recover from a pattern parse error, or a pattern uses `..`, we keep track of that and affect resolution error for missing bindings that could have been provided by that pattern. We differentiate between `..` and parse recovery. We silence resolution errors likely caused by the pattern parse error. ``` error[E0425]: cannot find value `title` in this scope --> $DIR/struct-pattern-with-missing-fields-resolve-error.rs:18:30 | LL | if let Website { url, .. } = website { | ------------------- this pattern doesn't include `title`, which is available in `Website` LL | println!("[{}]({})", title, url); | ^^^^^ not found in this scope ``` Fix #74863.
2024-12-16Rollup merge of #134277 - notriddle:notriddle/inline-into, r=GuillaumeGomezMatthias Krüger-8/+72
rustdoc-search: handle `impl Into<X>` better This PR fixes two bugs I ran into while searching the compiler docs: - It omitted an `impl Trait` entry in the type signature field, producing `TyCtxt, , Symbol -> bool` - It didn't let me search for `TyCtxt, DefId, Symbol -> bool` even though that's a perfectly good description of the function I was looking for (the function actually used `impl Into<DefId>` r? ``@GuillaumeGomez`` cc ``@lolbinarycat``
2024-12-16Rollup merge of #134260 - GuillaumeGomez:doctest-attrs, r=notriddleMatthias Krüger-18/+165
Correctly handle comments in attributes in doctests source code Fixes https://github.com/rust-lang/rust/issues/134221. The problem was that attributes are "inlined" (backlines are stripped), then when there is an inline comment inside it, the attribute is never considered valid (since unclosed). Fix was to simply put back backlines in case it's a multiline attribute. r? ``@notriddle``
2024-12-16Rollup merge of #134197 - Enselic:mirror, r=lcnrMatthias Krüger-0/+8
rustc_mir_build: Clarify that 'mirrored' does not mean 'flipped' or 'reversed' My intuition for 'mirrored' is that it means 'flipped' or 'reversed'. Clarify that that is not what is meant to 'mirror' the THIR from the HIR.
2024-12-16Rollup merge of #134124 - MarcoIeni:split-llvm-jobs, r=KobzolMatthias Krüger-44/+143
CI: use free runners for x86_64-gnu-llvm jobs try-job: x86_64-gnu-llvm-19-1 try-job: x86_64-gnu-llvm-19-2 try-job: x86_64-gnu-llvm-19-3 try-job: x86_64-gnu-llvm-18-1 try-job: x86_64-gnu-llvm-18-2 try-job: x86_64-gnu-llvm-18-3
2024-12-16Remove unneeded handling of backlines in doctest attributesGuillaume Gomez-2/+46
2024-12-16Auto merge of #134377 - lnicola:sync-from-ra, r=lnicolabors-2118/+8734
Subtree update of `rust-analyzer` r? `@ghost`
2024-12-16Also handle cases where attributes are unclosedGuillaume Gomez-18/+60
2024-12-16Add ui regression test for #134221Guillaume Gomez-0/+59
2024-12-16Auto merge of #134374 - matthiaskrgr:rollup-2tbbrxq, r=matthiaskrgrbors-65/+309
Rollup of 5 pull requests Successful merges: - #134314 (Make sure to use normalized ty for unevaluated const in default struct value) - #134342 (crashes: more tests) - #134357 (Fix `trimmed_def_paths` ICE in the function ptr comparison lint) - #134369 (Update spelling of "referring") - #134372 (Disable `tests/ui/associated-consts/issue-93775.rs` on windows msvc) Failed merges: - #134365 (Rename `rustc_mir_build::build` to `builder`) r? `@ghost` `@rustbot` modify labels: rollup
2024-12-16Rollup merge of #134372 - jieyouxu:disable-flaky-test, r=NoratriebMatthias Krüger-0/+4
Disable `tests/ui/associated-consts/issue-93775.rs` on windows msvc This test seems to be quite flaky. See: - https://github.com/rust-lang/rust/issues/132111 - https://github.com/rust-lang/rust/issues/133432
2024-12-16Rollup merge of #134369 - antonok-edm:refering-referring, r=jieyouxuMatthias Krüger-8/+8
Update spelling of "referring" I noticed that `referring` was spelled incorrectly in the output of `unexpected 'cfg' condition name` warnings; it looks like it was also incorrectly spelled in a doc comment. I've update both instances.
2024-12-16Rollup merge of #134357 - Urgau:fn-ptr-134345, r=compiler-errorsMatthias Krüger-34/+75
Fix `trimmed_def_paths` ICE in the function ptr comparison lint This PR fixes an ICE with `trimmed_def_paths` ICE in the function ptr comparison lint, specifically when pretty-printing user types but then not using the resulting pretty-printing. Fixes #134345 r? `@saethlin`
2024-12-16Rollup merge of #134342 - matthiaskrgr:tests1512, r=compiler-errorsMatthias Krüger-0/+176
crashes: more tests try-job: aarch64-apple try-job: x86_64-msvc try-job: x86_64-gnu
2024-12-16Rollup merge of #134314 - compiler-errors:default-struct-value-const, r=estebankMatthias Krüger-23/+46
Make sure to use normalized ty for unevaluated const in default struct value This cleans up the way that we construct the `mir::Const::Unevaluated` for default struct values. We were previously using `from_unevaluated`, which doesn't normalize the type, and is really only used for inline assembly. Other codepaths (such as `ExprKind::NamedConst`) use the type from the body. Also, let's stop using `literal_operand`, which also is really not meant for calls other than for literal comparisons in pattern lowering. Also move all of the tests to a separate subdirectory so they don't need to have the same prefix on all the test files. Fixes #134298 r? estebank or reassign
2024-12-16Disable `tests\ui\associated-consts\issue-93775.rs` on windows msvc许杰友 Jieyou Xu (Joe)-0/+4
This test seems to be quite flaky. See: - https://github.com/rust-lang/rust/issues/132111 - https://github.com/rust-lang/rust/issues/133432
2024-12-15spell "referring" correctlyAnton Lazarev-8/+8
2024-12-15Use `span_label` as it looks better when we show pattern missing binding in ↵Esteban Küber-39/+10
order
2024-12-15Use `ErrorGuaranteed` moreEsteban Küber-6/+11
2024-12-15Fix trimmed_def_paths ICE in the function ptr comparison lintUrgau-34/+75
2024-12-15Auto merge of #131808 - jdonszelmann:hir-attributes, r=oli-obk,petrochenkovbors-716/+1152
Hir attributes This PR needs some explanation, it's somewhat large. - This is step one as described in https://github.com/rust-lang/compiler-team/issues/796. I've added a new `hir::Attribute` which is a lowered version of `ast::Attribute`. Right now, this has few concrete effects, however every place that after this PR parses a `hir::Attribute` should later get a pre-parsed attribute as described in https://github.com/rust-lang/compiler-team/issues/796 and transitively https://github.com/rust-lang/rust/issues/131229. - an extension trait `AttributeExt` is added, which is implemented for both `ast::Attribute` and `hir::Atribute`. This makes `hir::Attributes` mostly compatible with code that used to parse `ast::Attribute`. All its methods are also added as inherent methods to avoid having to import the trait everywhere in the compiler. - Incremental can not not hash `ast::Attribute` at all.
2024-12-15Auto merge of #134349 - jieyouxu:rollup-zqn0jox, r=jieyouxubors-171/+184
Rollup of 4 pull requests Successful merges: - #134111 (Fix `--nocapture` for run-make tests) - #134329 (Add m68k_target_feature) - #134331 (bootstrap: make ./x test error-index work) - #134339 (Pass `TyCtxt` to early diagostics decoration) r? `@ghost` `@rustbot` modify labels: rollup
2024-12-15Merge pull request #18693 from Veykril/push-wzoomkkmuolmLaurențiu Nicola-6/+3
fix: Fix proc-macro dylib names on windows
2024-12-15Remove some leftover dead codeJonathan Dönszelmann-55/+8
2024-12-15Add hir::AttributeJonathan Dönszelmann-658/+1143
2024-12-16Rollup merge of #134339 - Urgau:tcx-in-early-diag, r=jieyouxu许杰友 Jieyou Xu (Joe)-112/+84
Pass `TyCtxt` to early diagostics decoration This PR pass a `TyCtxt` to the early diagnostics decoration code so that diagnostics code that take advantage of (a very limited but still useful) `TyCtxt` in their note, help, suggestions, ... This is particulary useful for #133221 which wants to get the crate name of a `DefId`, which is possible with `tcx.crate_name(...)`. I highly recommend reviewing this PR commit by commit. r? `@jieyouxu`
2024-12-16Rollup merge of #134331 - RalfJung:bootstrap-error-index, r=onur-ozkan许杰友 Jieyou Xu (Joe)-1/+3
bootstrap: make ./x test error-index work This makes it more likely that someone who sees an error index CI failure will be able to figure out how to reproduce that locally. Note that bootstrap already prints "Testing stage2 error-index", which is misleading since the test is actually called error_index_generator.
2024-12-16Rollup merge of #134329 - taiki-e:m68k-target-feature, r=workingjubilee许杰友 Jieyou Xu (Joe)-2/+29
Add m68k_target_feature This adds the following unstable target features (tracking issue: https://github.com/rust-lang/rust/issues/134328): - isa-68000 - isa-68010 - isa-68020 - isa-68030 - isa-68040 - isa-68060 - isa-68881 - isa-68882 The feature names and implied features are match with [definitions in LLVM](https://github.com/llvm/llvm-project/blob/llvmorg-19.1.0/llvm/lib/Target/M68k/M68k.td#L21-L57). isa-68881 and isa-68882 are FPU ISA features. isa-68881 is needed to support input/output in floating-point regs in inline assembly. isa-68020 is needed to implement https://github.com/taiki-e/atomic-maybe-uninit/pull/28 more robustly. cc `@glaubitz` `@ricky26` (designated developers of [m68k-unknown-linux-gnu](https://doc.rust-lang.org/nightly/rustc/platform-support/m68k-unknown-linux-gnu.html#designated-developers)) r? workingjubilee `@rustbot` label +O-motorola68k +A-target-feature
2024-12-16Rollup merge of #134111 - jyn514:run-make-nocapture, r=jieyouxu许杰友 Jieyou Xu (Joe)-56/+68
Fix `--nocapture` for run-make tests This was confusing because there are three layers of output hiding. 1. libtest shoves all output into a buffer and does not print it unless the test fails or `--nocapture` is passed. 2. compiletest chooses whether to print the output from any given process. 3. run-make-support chooses what output to print. This modifies 2 and 3. - compiletest: Don't require both `--verbose` and `--nocapture` to show the output of run-make tests. - compiletest: Print the output from `rmake` processes if they succeed. Previously this was only printed on failure. - compiletest: Distinguish rustc and rmake stderr by printing the command name (e.g. "--stderr--" to "--rustc stderr--"). - run-make-support: Unconditionally print the needle/haystack being searched. Previously this was only printed on failure. Before: ``` $ x t tests/run-make/linker-warning --force-rerun -- --nocapture running 1 tests . test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 377 filtered out; finished in 281.64ms $ x t tests/run-make/linker-warning --force-rerun -v -- --nocapture 2>&1 | wc -l 1004 $ x t tests/run-make/linker-warning --force-rerun -v -- --nocapture | tail -n40 running 1 tests ------stdout------------------------------ ------stderr------------------------------ warning: unused import: `std::path::Path` --> /home/jyn/src/rust2/tests/run-make/linker-warning/rmake.rs:1:5 | 1 | use std::path::Path; | ^^^^^^^^^^^^^^^ | = note: `#[warn(unused_imports)]` on by default warning: unused import: `run_make_support::rfs::remove_file` --> /home/jyn/src/rust2/tests/run-make/linker-warning/rmake.rs:3:5 | 3 | use run_make_support::rfs::remove_file; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: 2 warnings emitted ------------------------------------------ test [run-make] tests/run-make/linker-warning ... ok test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 377 filtered out; finished in 285.89ms ``` After: ``` Testing stage1 compiletest suite=run-make mode=run-make (x86_64-unknown-linux-gnu) running 1 tests ------rmake stdout------------------------------ ------rmake stderr------------------------------ assert_contains_regex: === HAYSTACK === error: linking with `./fake-linker` failed: exit status: 1 | = note: LC_ALL="C" PATH="/home/jyn/src/rust2/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/bin:...:/bin" VSLANG="1033" "./fake-linker" "-m64" "/tmp/rustcYqdAZT/symbols.o" "main.main.d17f5fbe6225cf88-cgu.0.rcgu.o" "main.2uoctswmurc6ir5rvoay0p9ke.rcgu.o" "-Wl,--as-needed" "-Wl,-Bstatic" "-Wl,-Bdynamic" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-B/home/jyn/src/rust2/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/bin/gcc-ld" "-fuse-ld=lld" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-L" "/home/jyn/src/rust2/build/x86_64-unknown-linux-gnu/test/run-make/linker-warning/rmake_out" "-L" "/home/jyn/src/rust2/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-o" "main" "-Wl,--gc-sections" "-pie" "-Wl,-z,relro,-z,now" "-nodefaultlibs" "run_make_error" = note: error: baz error: aborting due to 1 previous error === NEEDLE === fake-linker.*run_make_error assert_not_contains_regex: === HAYSTACK === === NEEDLE === fake-linker.*run_make_error ------------------------------------------ . test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 377 filtered out; finished in 314.81ms ``` r? `@jieyouxu`
2024-12-15Rename `value` field to `expr` to simplify later commits' diffsOli Scherer-30/+28
2024-12-15Merge pull request #18694 from Veykril/push-uxpuruvqpwmxLukas Wirth-97/+113
internal: Show mir eval errors on hover with debug env var set
2024-12-15fix: Fix proc-macro dylib names on windowsLukas Wirth-6/+3
2024-12-15internal: Show mir eval errors on hover with debug env var setLukas Wirth-97/+113
2024-12-15Auto merge of #133417 - RalfJung:aarch64-float-abi, r=workingjubileebors-37/+116
reject aarch64 target feature toggling that would change the float ABI ~~Stacked on top of https://github.com/rust-lang/rust/pull/133099. Only the last two commits are new.~~ The first new commit lays the groundwork for separately controlling whether a feature may be enabled or disabled. The second commit uses that to make it illegal to *disable* the `neon` feature (which is only possible via `-Ctarget-feature`, and so the new check just adds a warning). Enabling the `neon` feature remains allowed on targets that don't disable `neon` or `fp-armv8`, which is all our built-in targets. This way, the entire PR is not a breaking change. Fixes https://github.com/rust-lang/rust/issues/131058 for hardfloat targets (together with https://github.com/rust-lang/rust/pull/133102 which fixed it for softfloat targets). Part of https://github.com/rust-lang/rust/issues/116344.
2024-12-15crashes: more testsMatthias Krüger-0/+176
2024-12-15Improve check-cfg Cargo macro diagnostic with crate nameUrgau-14/+19
2024-12-15Cleanup lifetimes around `EarlyContextAndPass` and `EarlyCheckNode`Urgau-58/+44
2024-12-15Auto merge of #134117 - DianQK:gep-i8, r=oli-obkbors-4/+60
Modifies the index instruction from `gep [0 x %Type]` to `gep %Type` Fixes #133979. This PR modifies the index instruction from `gep [0 x %Type]` to `gep %Type`, which is the same with pointer offset calculation. This will help LLVM calculate various formats of GEP instructions. According to [[RFC] Replacing getelementptr with ptradd](https://discourse.llvm.org/t/rfc-replacing-getelementptr-with-ptradd/68699), we ultimately aim to canonicalize everything to `gep i8`. Based on the results from https://github.com/rust-lang/rust/pull/134117#issuecomment-2531717076, I think we still need to investigate some missing optimizations, so this PR is just a small step forward. r? compiler
2024-12-15Auto merge of #134332 - Zalathar:rollup-oe23hkw, r=Zalatharbors-471/+1030
Rollup of 7 pull requests Successful merges: - #130361 (std::net: Solaris supports `SOCK_CLOEXEC` as well since 11.4.) - #133406 (Add value accessor methods to `Mutex` and `RwLock`) - #133633 (don't show the full linker args unless `--verbose` is passed) - #134285 (Add some convenience helper methods on `hir::Safety`) - #134310 (Add clarity to the examples of some `Vec` & `VecDeque` methods) - #134313 (Don't make a def id for `impl_trait_in_bindings`) - #134315 (A couple of polonius fact generation cleanups) r? `@ghost` `@rustbot` modify labels: rollup
2024-12-15Simplify the GEP instruction for indexDianQK-4/+60
2024-12-15advice against negative features in target specsRalf Jung-0/+4
Co-authored-by: Jubilee <workingjubilee@gmail.com>
2024-12-15Rollup merge of #134315 - lqd:polonius-next-episode-1, r=jackh726Stuart Cook-265/+253
A couple of polonius fact generation cleanups This PR is extracted from #134268 for easier review and contains its first two commits. They have already been reviewed by `@jackh726.` r? `@jackh726`
2024-12-15Rollup merge of #134313 - compiler-errors:no-itib-def-id, r=oli-obkStuart Cook-0/+20
Don't make a def id for `impl_trait_in_bindings` The def collector is awkward, so for now just wrap let statements in a new `ImplTraitContext::InBinding` which tells `visit_ty` not to make a def id for the type. This will not generalize to other ITIB cases, like if we allow them in turbofishes (e.g. `foo::<impl Fn()>(|| {})`). Fixes #134307 r? oli-obk
2024-12-15Rollup merge of #134310 - tkr-sh:master, r=NoratriebStuart Cook-36/+39
Add clarity to the examples of some `Vec` & `VecDeque` methods In some `Vec` and `VecDeque` examples where elements are `i32`, examples can seem a bit confusing at first glance if a parameter of the method is an `usize`. In this case, I think it's better to use `char` rather than `i32`. > [!NOTE] > It's already done in the implementation of `VecDeque::insert` #### Difference - `i32` ```rs let mut v = vec![1, 2, 3]; assert_eq!(v.remove(1), 2); assert_eq!(v, [1, 3]); ``` - `char` ```rs let mut v = vec!['a', 'b', 'c']; assert_eq!(v.remove(1), 'b'); assert_eq!(v, ['a', 'c']); ``` Even tho it's pretty minor, it's a nice to have.
2024-12-15Rollup merge of #134285 - oli-obk:push-vwrqsqlwnuxo, r=UrgauStuart Cook-70/+74
Add some convenience helper methods on `hir::Safety` Makes a lot of call sites simpler and should make any refactorings needed for https://github.com/rust-lang/rust/pull/134090#issuecomment-2541332415 simpler, as fewer sites have to be touched in case we end up storing some information in the variants of `hir::Safety`
2024-12-15Rollup merge of #133633 - jyn514:hide-linker-args, r=bjorn3,jyn514Stuart Cook-14/+126
don't show the full linker args unless `--verbose` is passed the linker arguments can be *very* long, especially for crates with many dependencies. often they are not useful. omit them unless the user specifically requests them. split out from https://github.com/rust-lang/rust/pull/119286. fixes https://github.com/rust-lang/rust/issues/109979. r? `@bjorn3` try-build: i686-mingw
2024-12-15Rollup merge of #133406 - EFanZh:lock-value-accessors, r=NoratriebStuart Cook-86/+517
Add value accessor methods to `Mutex` and `RwLock` - ACP: https://github.com/rust-lang/libs-team/issues/485. - Tracking issue: https://github.com/rust-lang/rust/issues/133407. This PR adds `get`, `set` and `replace` methods to the `Mutex` and `RwLock` types for quick access to their contained values. One possible optimization would be to check for poisoning first and return an error immediately, without attempting to acquire the lock. I didn’t implement this because I consider poisoning to be relatively rare, adding this extra check could slow down common use cases.
2024-12-15Rollup merge of #130361 - devnexen:sock_cloexec_solaris, r=cuviperStuart Cook-0/+1
std::net: Solaris supports `SOCK_CLOEXEC` as well since 11.4. try-job: dist-various-2
2024-12-15bootstrap: make ./x test error-index workRalf Jung-1/+3
2024-12-15Auto merge of #133223 - zachs18:uniquerc-impls, r=Noratriebbors-4/+282
`UniqueRc` trait impls UniqueRc tracking Issue: #112566 Stable traits: (i.e. impls behind only the `unique_rc_arc` feature gate) * Support the same formatting as `Rc`: * `fmt::Debug` and `fmt::Display` delegate to the pointee. * `fmt::Pointer` prints the address of the pointee. * Add explicit `!Send` and `!Sync` impls, to mirror `Rc`. * Borrowing traits: `Borrow`, `BorrowMut`, `AsRef`, `AsMut` * `Rc` does not implement `BorrowMut` and `AsMut`, but `UniqueRc` can. * Unconditional `Unpin`, like other heap-allocated types. * Comparison traits `(Partial)Ord` and `(Partial)Eq` delegate to the pointees. * `PartialEq for UniqueRc` does not do `Rc`'s specialization shortcut for pointer equality when `T: Eq`, since by definition two `UniqueRc`s cannot share an allocation. * `Hash` delegates to the pointee. * `AsRawFd`, `AsFd`, `AsHandle`, `AsSocket` delegate to the pointee like `Rc`. * Sidenote: The bounds on `T` for the existing `Pointer<T>` impls for specifically `AsRawFd` and `AsSocket` do not allow `T: ?Sized`. For the added `UniqueRc` impls I allowed `T: ?Sized` for all four traits, but I did not change the existing (stable) impls. Unstable traits: * `DispatchFromDyn`, allows using `UniqueRc<Self>` as a method receiver under `feature(arbitrary_self_types)`. * Existing `PinCoerceUnsized for UniqueRc` is generalized to allow non-`Global` allocators, like `Rc`. * `DerefPure`, allows using `UniqueRc` in deref-patterns under `feature(deref_patterns)`, like `Rc`. For documentation, `Rc` only has documentation on the comparison traits' methods, so I copied/adapted the documentation for those, and left the rest without impl-specific docs. ~~Edit: Marked as draft while I figure out `UnwindSafe`.~~ Edit: Ignoring `UnwindSafe` for this PR