-
Notifications
You must be signed in to change notification settings - Fork 14k
Rollup of 3 pull requests #135473
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rollup of 3 pull requests #135473
Conversation
Refactored the duplicated code into a function. `with_feed_task` currently passes the query key to `debug_assert!`. This commit changes that, so it debug prints the `DepNode`, as in `with_task`.
Add an example for using splice to insert multiple elements efficiently into a vector.
Add an example for `Vec::splice` inserting elements without removing This example clearly showcases how `splice` can be used to insert multiple elements efficiently at an index into a vector. Fixes rust-lang#135369. The added example: > Using `splice` to insert new items into a vector efficiently at a specific position indicated by an empty range: > ```rust > let mut v = vec![1, 5]; > let new = [2, 3, 4]; > v.splice(1..1, new); > assert_eq!(v, [1, 2, 3, 4, 5]); > ``` `@rustbot` label A-docs A-collections
Remove code duplication when hashing query result and interning node Refactored the duplicated code into a function. `with_feed_task` currently passes the query key to `debug_assert!`. I believe that's a mistake, since `with_task` prints the `DepNode` which is more sensible, so this commit changes that, so it debug prints the `DepNode`.
…or, r=FedericoBruzzone,oli-obk fix ICE with references to infinite structs in consts fixes rust-lang#114484 Normalizing `<Type as Pointee>::Metadata` may emit a (non-fatal) error during trait selection if finding the struct tail of `Type` hits the recursion limit. When this happens, prior this PR, we would treat the projection as rigid, i.e. don't normalize it further. This PR changes it so that we normalize to `ty::Error` instead. This is important, because to compute the layout of `&Type` we need to compute the layout of `<Type as Pointee>::Metadata` https://github.com/rust-lang/rust/blob/2ae9916816a448fcaab3b2da461de754eda0055a/compiler/rustc_ty_utils/src/layout.rs#L247-L273 and computing the layout of a rigid alias will (correctly) fail and needs to report an error to the user. For example: ```rust trait Project { type Assoc; } fn foo<T: Project>() { [(); { let _: Option<T::Assoc> = None; // ^^^^^^^^ this projection is rigid, so we can't know it's layout 0 }]; } ``` ``` error: constant expression depends on a generic parameter --> src/lib.rs:6:10 | 6 | [(); { | __________^ 7 | | let _: Option<T::Assoc> = None; 8 | | // ^^^^^^^^ this projection is rigid, so we can't know it's layout 9 | | 0 10 | | }]; | |_____^ | = note: this may fail depending on what value the parameter takes ``` For non-generic rigid projections we will currently ICE, because we incorrectly assume that `LayoutError::Unknown` means that a const must be generic (rust-lang#135138). This is being fixed and turned into a proper error in rust-lang#135158. ```rust #![feature(trivial_bounds)] trait Project { type Assoc; } fn foo() where u8: Project, { [(); { let _: Option<<u8 as Project>::Assoc> = None; // ICEs currently, but will be an error 0 }]; } ``` However, if we hit the recursion limit when normalizing `<Type as Pointee>::Metadata` we don't want to report a layout error, because we already emitted the recursion error. So by normalizing to `ty::Error` here, we get a `LayoutError::ReferencesError` instead of a `LayoutError::Unknown` and don't report the layout error to the user.
|
@bors r+ rollup=never p=3 |
|
☀️ Test successful - checks-actions |
|
📌 Perf builds for each rolled up PR:
previous master: e491caec14 In the case of a perf regression, run the following command for each PR you suspect might be the cause: |
|
Finished benchmarking commit (a48e7b0): comparison URL. Overall result: no relevant changes - no action needed@rustbot label: -perf-regression Instruction countThis benchmark run did not return any relevant results for this metric. Max RSS (memory usage)This benchmark run did not return any relevant results for this metric. CyclesThis benchmark run did not return any relevant results for this metric. Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 764.175s -> 763.089s (-0.14%) |
Successful merges:
Vec::spliceinserting elements without removing #135381 (Add an example forVec::spliceinserting elements without removing)r? @ghost
@rustbot modify labels: rollup
Create a similar rollup