about summary refs log tree commit diff
AgeCommit message (Collapse)AuthorLines
2024-07-08Auto merge of #127421 - cjgillot:cache-iter, r=fmeasebors-8/+26
Cache hir_owner_nodes in ParentHirIterator. Lint level computation may traverse deep HIR trees using that iterator. This calls `hir_owner_nodes` many times for the same HIR owner, which is wasterful. This PR caches the value to allow a more efficient iteration scheme. r? ghost for perf
2024-07-07Auto merge of #127172 - compiler-errors:full-can_eq-everywhere, r=lcnrbors-154/+133
Make `can_eq` process obligations (almost) everywhere Move `can_eq` to an extension trait on `InferCtxt` in `rustc_trait_selection`, and change it so that it processes obligations. This should strengthen it to be more accurate in some cases, but is most important for the new trait solver which delays relating aliases to `AliasRelate` goals. Without this, we always basically just return true when passing aliases to `can_eq`, which can lead to weird errors, for example #127149. I'm not actually certain if we should *have* `can_eq` be called on the good path. In cases where we need `can_eq`, we probably should just be using a regular probe. Fixes #127149 r? lcnr
2024-07-07Auto merge of #127385 - weihanglo:update-cargo, r=weihanglobors-0/+0
Update cargo 20 commits in a515d463427b3912ec0365d106791f88c1c14e1b..154fdac39ae9629954e19e9986fd2cf2cdd8d964 2024-07-02 20:53:36 +0000 to 2024-07-07 01:28:23 +0000 - test: relax redactions for rust-lang/rust (rust-lang/cargo#14203) - use "bootstrap" instead of "rustbuild" (rust-lang/cargo#14207) - test: migrate serveral files to snapbox (rust-lang/cargo#14180) - Add rustdocflags to Unit's Debug impl (rust-lang/cargo#14201) - Allow enabling `config-include` feature in config (rust-lang/cargo#14196) - fix(test): Restore `does_not_contain` for check (rust-lang/cargo#14198) - test: migrate patch, pkgid, proc_macro and progress to snapbox (rust-lang/cargo#14181) - test: Migrate jobserver to snapbox (rust-lang/cargo#14191) - chore(deps): update msrv (3 versions) to v1.77 (rust-lang/cargo#14186) - test: migrate build_plan and build_script to snapbox (rust-lang/cargo#14193) - test: migrate cfg and check to snapbox (rust-lang/cargo#14185) - test: migrate install* and inheritable_workspace_fields to snapbox (rust-lang/cargo#14170) - Pass rustflags to artifacts built with implicit targets when using target-applies-to-host (rust-lang/cargo#13900) - test: Migrate network tests to snapbox (rust-lang/cargo#14187) - test: migrate some files to snapbox (rust-lang/cargo#14113) - test: Auto-redact `... after last build at ...`; Migrate `freshness` to Snapbox (rust-lang/cargo#14161) - chore: fix some typos (rust-lang/cargo#14182) - fix: improve message for inactive weak optional feature with edition2024 through unused dep collection (rust-lang/cargo#14026) - test:migrate `doc/directory/docscrape` to snapbox (rust-lang/cargo#14171) - test: Migrate git_auth to snapbox (rust-lang/cargo#14172)
2024-07-07Auto merge of #127454 - matthiaskrgr:rollup-k3vfen2, r=matthiaskrgrbors-134/+190
Rollup of 8 pull requests Successful merges: - #127179 (Print `TypeId` as hex for debugging) - #127189 (LinkedList's Cursor: method to get a ref to the cursor's list) - #127236 (doc: update config file path in platform-support/wasm32-wasip1-threads.md) - #127297 (Improve std::Path's Hash quality by avoiding prefix collisions) - #127308 (Attribute cleanups) - #127354 (Describe Sized requirements for mem::offset_of) - #127409 (Emit a wrap expr span_bug only if context is not tainted) - #127447 (once_lock: make test not take as long in Miri) r? `@ghost` `@rustbot` modify labels: rollup
2024-07-07Update cargoWeihang Lo-0/+0
2024-07-07Auto merge of #127455 - Nilstrieb:blazing-tidy, r=jieyouxubors-27/+31
Make tidy problematic const checking fast again fixes pathological tidy performance described in #127453 by reverting #127428 i think anyone can approve this ASAP, it makes working on this repo significantly worse.
2024-07-07Add note about performance of tidy problematic constsNilstrieb-0/+3
2024-07-07Revert "remove regexes"Nilstrieb-27/+28
This reverts commit 8d8504300fe7ad9b20a7690cce8025290847f155. The regexes are important for performance.
2024-07-07Rollup merge of #127447 - RalfJung:once_lock_miri, r=joboetMatthias Krüger-6/+13
once_lock: make test not take as long in Miri Allocating 1000 list elements takes a while (`@zachs18` reported >5min), so let's reduce the iteration count when running in Miri. Unfortunately due to this clever `while let i @ 0..LEN =` thing, the count needs to be a constants, and constants cannot be shadowed, so we need to use another trick to hide the `cfg!(miri)` from the docs. (I think this loop condition may be a bit too clever, it took me a bit to decipher. Ideally this would be `while let i = ... && i < LEN`, but that is not stable yet.)
2024-07-07Rollup merge of #127409 - gurry:127332-ice-with-expr-not-struct, r=oli-obkMatthias Krüger-10/+27
Emit a wrap expr span_bug only if context is not tainted Fixes #127332 The ICE occurs because of this `span_bug`: https://github.com/rust-lang/rust/blob/51917e2e69702e5752bce6a4f3bfd285d0f4ae39/compiler/rustc_hir_typeck/src/expr_use_visitor.rs#L732-L738 which is triggered by the fact that we're trying to use an `enum` in a `with` expression instead of a `struct`. The issue originates in commit https://github.com/rust-lang/rust/pull/127202/commits/814bfe9335fd7c941169e0ef15ae2cffeacc78eb from PR #127202. As per the title of that commit the ICEing code should not be reachable any more, but looks like it still is. This PR changes the code so that the `span_bug` will be emitted only if the context is not tainted by a previous error.
2024-07-07Rollup merge of #127354 - nicholasbishop:bishop-sized-doc, r=NilstriebMatthias Krüger-0/+14
Describe Sized requirements for mem::offset_of The container doesn't have to be sized, but the field must be sized (at least until https://github.com/rust-lang/rust/issues/126151 is stable).
2024-07-07Rollup merge of #127308 - nnethercote:Attribute-cleanups, r=petrochenkovMatthias Krüger-112/+70
Attribute cleanups More refactoring done while trying to fix the final remaining test failure for #124141. r? `@petrochenkov`
2024-07-07Rollup merge of #127297 - the8472:path-new-hash, r=NilstriebMatthias Krüger-4/+44
Improve std::Path's Hash quality by avoiding prefix collisions This adds a bit rotation to the already existing state so that the same sequence of characters chunked at different offsets into separate path components results in different hashes. The tests are from #127255 Closes #127254
2024-07-07Rollup merge of #127236 - iawia002:wasip1-threads-doc, r=NilstriebMatthias Krüger-1/+1
doc: update config file path in platform-support/wasm32-wasip1-threads.md The config content described in the `Building the target` section should be the configuration used for building Rust itself: https://github.com/rust-lang/rust/blob/7d97c59438e933e86f557ed999da3b8dfc6855a7/config.example.toml#L845-L848 I believe this is different from Cargo's configuration. There seems to be some misunderstanding in the discussion here: https://github.com/rust-lang/rust/pull/112922#discussion_r1272263810.
2024-07-07Rollup merge of #127189 - GrigorenkoPV:linkedlist-cursor-list, r=NilstriebMatthias Krüger-0/+20
LinkedList's Cursor: method to get a ref to the cursor's list We're already providing `.back()` & `.front()`, for which we hold onto a reference to the parent list, so why not share it? Useful for when you got `LinkedList` -> `CursorMut` -> `Cursor` and cannot take another ref to the list, even though you should be able to. This seems to be completely safe & sound. The name is, of course, bikesheddable.
2024-07-07Rollup merge of #127179 - tgross35:typeid-debug-hex, r=NilstriebMatthias Krüger-1/+1
Print `TypeId` as hex for debugging In <https://github.com/rust-lang/rust/pull/127134>, the `Debug` impl for `TypeId` was changed to print a single integer rather than a tuple. Change this again to print as hex for more concise and consistent formatting, as was suggested. Result: TypeId(0x1378bb1c0a0202683eb65e7c11f2e4d7)
2024-07-07Auto merge of #123253 - ChayimFriedman2:extend-trusted, r=the8472bors-26/+160
Specialize `TrustedLen` for `Iterator::unzip()` Don't check the capacity every time (and also for `Extend` for tuples, as this is how `unzip()` is implemented). I did this with an unsafe method on `Extend` that doesn't check for growth (`extend_one_unchecked()`). I've marked it as perma-unstable currently, although we may want to expose it in the future so collections outside of std can benefit from it. Then specialize `Extend for (A, B)` for `TrustedLen` to call it. An alternative way of implementing this is to have a semi-public trait (`#[doc(hidden)]` public, so collections outside of core can implement it) for `extend()` inside tuples, and specialize it from collections. However: 1. This looks more complex to me. 2. This prohibits the option of exposing this somewhen to collections outside of std, as we never expose specializations. A concern that may arise with the current approach is that implementing `extend_one_unchecked()` correctly must also incur implementing `extend_reserve()`, otherwise you can have UB. This is a somewhat non-local safety invariant. However, I believe this is fine, since to have actual UB you must have unsafe code inside your `extend_one_unchecked()` that makes incorrect assumption, *and* not implement `extend_reserve()`. I've also documented this requirement. **Benchmark:** Code: ```rust #[bench] fn unzip(b: &mut Bencher) { b.iter(|| { for _ in 0..10_000 { let v: (Vec<_>, VecDeque<_>) = (black_box(0u32)..black_box(1_000)).map(|i| (i, i * 2)).unzip(); black_box(v); } }); } ``` Before: ``` unzip::unzip 14.17ms/iter +/- 374.85µs ``` After: ``` unzip::unzip 5.33ms/iter +/- 164.54µs ```
2024-07-07Move a span_bug under a condition that cx is taintedGurinder Singh-10/+27
Fixes an ICE caused when a with expression is not a struct
2024-07-07Auto merge of #127428 - donno2048:master, r=albertlarsan68bors-28/+27
Don't use regexes in tidy checks No need for them, and it makes the tests and the checking simpler r? `@albertlarsan68`
2024-07-07once_lock: make test not take as long in MiriRalf Jung-6/+13
2024-07-07Use `filter_map` instead of `flat_map` in `configure_tokens`.Nicholas Nethercote-7/+5
All the branches produce either zero or one elements.
2024-07-07Add an size assertion.Nicholas Nethercote-0/+1
`Option<LazyAttrTokenStream>` is the type that's actually used in all the aST nodes.
2024-07-07Remove `Clone` derive from `LazyAttrTokenStreamImpl`.Nicholas Nethercote-1/+0
2024-07-07Rename some attribute types for consistency.Nicholas Nethercote-44/+42
- `AttributesData` -> `AttrsTarget` - `AttrTokenTree::Attributes` -> `AttrTokenTree::AttrsTarget` - `FlatToken::AttrTarget` -> `FlatToken::AttrsTarget`
2024-07-07Simplify `ReplaceRange`.Nicholas Nethercote-24/+21
Currently the second element is a `Vec<(FlatToken, Spacing)>`. But the vector always has zero or one elements, and the `FlatToken` is always `FlatToken::AttrTarget` (which contains an `AttributesData`), and the spacing is always `Alone`. So we can simplify it to `Option<AttributesData>`. An assertion in `to_attr_token_stream` can can also be removed, because `new_tokens.len()` was always 0 or 1, which means than `range.len()` is always greater than or equal to it, because `range.is_empty()` is always false (as per the earlier assertion).
2024-07-07Remove `HasSpan` trait.Nicholas Nethercote-38/+5
The only place it is meaningfully used is in a panic message in `TokenStream::from_ast`. But `node.span()` doesn't need to be printed because `node` is also printed and it must contain the span.
2024-07-07Remove an unnecessary local variable.Nicholas Nethercote-2/+1
2024-07-07Rename `Attribute::tokens` (the inherent method).Nicholas Nethercote-4/+5
To distinguish it from the `HasTokens` method.
2024-07-07Auto merge of #127321 - Kobzol:bootstrap-cmd-refactor-4, r=onur-ozkanbors-367/+362
Bootstrap command refactoring: quality-of-life improvements (step 4) Continuation of https://github.com/rust-lang/rust/pull/127120. This PR simply introduce two new functions (`BootstrapCommand:run` and `command`) that make it a bit easier to use commands in bootstrap. It also adds several `#[must_use]` annotations. This shouldn't (hopefully) have any effect on behavior. Especially the first commit IMO makes any code that runs commands more readable, and allows using the API in a fluent way, without needing to jump back and forth between the command and the `Build(er)`. Tracking issue: https://github.com/rust-lang/rust/issues/126819 r? `@onur-ozkan`
2024-07-07Specialize `TrustedLen` for `Iterator::unzip()`Chayim Refael Friedman-26/+160
Don't check the capacity every time (and also for `Extend` for tuples, as this is how `unzip()` is implemented). I did this with an unsafe method on `Extend` that doesn't check for growth (`extend_one_unchecked()`). I've marked it as perma-unstable currently, although we may want to expose it in the future so collections outside of std can benefit from it. Then specialize `Extend for (A, B)` for `TrustedLen` to call it. It may seem that an alternative way of implementing this is to have a semi-public trait (`#[doc(hidden)]` public, so collections outside of core can implement it) for `extend()` inside tuples, and specialize it from collections. However, it is impossible due to limitations of `min_specialization`. A concern that may arise with the current approach is that implementing `extend_one_unchecked()` correctly must also incur implementing `extend_reserve()`, otherwise you can have UB. This is a somewhat non-local safety invariant. However, I believe this is fine, since to have actual UB you must have unsafe code inside your `extend_one_unchecked()` that makes incorrect assumption, *and* not implement `extend_reserve()`. I've also documented this requirement.
2024-07-07Auto merge of #127404 - compiler-errors:rpitit-entailment-false-positive, ↵bors-24/+228
r=oli-obk Don't try to label `ObligationCauseCode::CompareImplItem` for an RPITIT, since it has no name The old (current) trait solver has a limitation that when a where clause in param-env must be normalized using the same where clause, then we get spurious errors in `normalize_param_env_or_error`. I don't think there's an issue tracking it, but it's the root cause for many of the "fixed-by-next-solver" labeled issues. Specifically, these errors may occur when checking predicate entailment of the GAT that comes out of desugaring RPITITs. Since we use `ObligationCauseCode::CompareImplItem` for these predicates, we try calling `item_name` on an RPITIT which fails, since the RPITIT has no name. We simply suppress this logic when we're reporting a predicate entailment error for an RPITIT. RPITITs should never have predicate entailment errors, *by construction*, but they may due to this bug in the old solver. Addresses the ICE in #127331, though doesn't fix the underlying issue (which is fundamental to the old solver). r? types
2024-07-07Auto merge of #127335 - Oneirical:put-on-a-petestal, r=jieyouxubors-88/+167
Migrate `emit-shared-files` and `emit-path-unhashed` `run-make` tests to rmake Part of #121876 and the associated [Google Summer of Code project](https://blog.rust-lang.org/2024/05/01/gsoc-2024-selected-projects.html). try-job: x86_64-msvc try-job: aarch64-apple try-job: armhf-gnu try-job: test-various
2024-07-06Auto merge of #126987 - petrochenkov:atvisord2, r=pnkfelixbors-12/+35
out_of_scope_macro_calls: Detect calls inside attributes more precisely Fixes https://github.com/rust-lang/rust/issues/126984.
2024-07-06Auto merge of #127430 - compiler-errors:rollup-76ni16s, r=compiler-errorsbors-376/+499
Rollup of 4 pull requests Successful merges: - #127386 (Uplift outlives components to `rustc_type_ir`) - #127405 (uplift `PredicateEmittingRelation`) - #127410 (Correct description of E0502) - #127417 (Show fnsig's unit output explicitly when there is output diff in diagnostics) r? `@ghost` `@rustbot` modify labels: rollup
2024-07-06remove regexesElisha Hollander-28/+27
2024-07-06Don't try to label ObligationCauseCode::CompareImplItem for an RPITIT, since ↵Michael Goulet-24/+228
it has no name
2024-07-06Rollup merge of #127417 - chenyukang:yukang-method-output-diff, r=oli-obkMichael Goulet-13/+48
Show fnsig's unit output explicitly when there is output diff in diagnostics Fixes #127263
2024-07-06Rollup merge of #127410 - trevyn:patch-1, r=compiler-errorsMichael Goulet-2/+3
Correct description of E0502 Closes #126495
2024-07-06Rollup merge of #127405 - ↵Michael Goulet-55/+75
compiler-errors:uplift-predicate-emitting-relation, r=lcnr uplift `PredicateEmittingRelation` Small follow-up to #127333 r? lcnr
2024-07-06Rollup merge of #127386 - compiler-errors:uplift-outlives-components, r=lcnrMichael Goulet-306/+373
Uplift outlives components to `rustc_type_ir` We need this to uplift `push_outlives_components`, since the elaborator uses `push_outlives_components` to elaborate type outlives obligations and I want to uplift elaboration. This ends up reworking and inlining a fair portion of the `GenericArg::walk_shallow` function, whose only callsite was this one. I believe I got the logic correct, but may be worthwhile to look at it closely just in case. Unfortunately github was too dumb to understand that this is a rename + change -- I could also rework the git history to split the "copy the file over" part from the actual logical changes if that makes this easier to review. r? lcnr
2024-07-06Add `#[must_use]` attribute to several command-related methodsJakub Beránek-1/+13
This should make it harder to accidentally forget to use results of methods on `BootstrapCommand` and `CommandStatus`.
2024-07-06Auto merge of #127388 - compiler-errors:elaboration-tweaks, r=lcnrbors-18/+29
Elaboration tweaks Removes `Filter::OnlySelfThatDefines` and reimplements `transitive_bounds_that_define_assoc_item` as a separate function, since I don't want to have to uplift that mode since it's both an implementation detail (only exists to avoid cycles in astconv) and requires exposing `Ident` as an associated type on `Interner`. r? lcnr
2024-07-06show fnsig's output when there is differenceyukang-15/+10
2024-07-06Remove walk_shallowMichael Goulet-17/+0
2024-07-06Import via rustc_type_ir::outlivesMichael Goulet-7/+5
We could use rustc_middle::ty::outlives I guess?
2024-07-06Uplift push_outlives_componentsMichael Goulet-284/+370
2024-07-06Uplift PredicateEmittingRelation firstMichael Goulet-55/+75
2024-07-06show unit output when there is only output diff in diagnosticsyukang-6/+46
2024-07-06out_of_scope_macro_calls: Detect calls inside attributes more preciselyVadim Petrochenkov-12/+35
2024-07-06Auto merge of #127420 - matthiaskrgr:rollup-vpitwow, r=matthiaskrgrbors-287/+153
Rollup of 3 pull requests Successful merges: - #127275 (offset_from, offset: clearly separate safety requirements the user needs to prove from corollaries that automatically follow) - #127379 (rustdoc-search: stop constructing pointless arrays in decode) - #127391 (Use verbose suggestion for `ptr::null_mut()`) r? `@ghost` `@rustbot` modify labels: rollup