rust-lang / rust

Empowering everyone to build reliable and efficient software.
https://www.rust-lang.org
Other
98.77k stars 12.76k forks source link

Add a range argument to vec.extract_if #133265

Open the8472 opened 1 day ago

the8472 commented 1 day ago

tracking issue: #43244

This adds the range argument requested in https://github.com/rust-lang/rust/issues/43244#issuecomment-2486160659

rustbot commented 1 day ago

r? @tgross35

rustbot has assigned @tgross35. They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

rust-log-analyzer commented 1 day ago

The job x86_64-gnu-llvm-18 failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot) ```plain #16 exporting to docker image format #16 sending tarball 27.4s done #16 DONE 33.4s ##[endgroup] Setting extra environment values for docker: --env ENABLE_GCC_CODEGEN=1 --env GCC_EXEC_PREFIX=/usr/lib/gcc/ [CI_JOB_NAME=x86_64-gnu-llvm-18] debug: `DISABLE_CI_RUSTC_IF_INCOMPATIBLE` configured. --- sccache: Starting the server... ##[group]Configure the build configure: processing command line configure: configure: build.configure-args := ['--build=x86_64-unknown-linux-gnu', '--llvm-root=/usr/lib/llvm-18', '--enable-llvm-link-shared', '--set', 'rust.randomize-layout=true', '--set', 'rust.thin-lto-import-instr-limit=10', '--enable-verbose-configure', '--enable-sccache', '--disable-manage-submodules', '--enable-locked-deps', '--enable-cargo-native-static', '--set', 'rust.codegen-units-std=1', '--set', 'dist.compression-profile=balanced', '--dist-compression-formats=xz', '--set', 'rust.lld=false', '--disable-dist-src', '--release-channel=nightly', '--enable-debug-assertions', '--enable-overflow-checks', '--enable-llvm-assertions', '--set', 'rust.verify-llvm-ir', '--set', 'rust.codegen-backends=llvm,cranelift,gcc', '--set', 'llvm.static-libstdcpp', '--enable-new-symbol-mangling'] configure: target.x86_64-unknown-linux-gnu.llvm-config := /usr/lib/llvm-18/bin/llvm-config configure: llvm.link-shared := True configure: rust.randomize-layout := True configure: rust.thin-lto-import-instr-limit := 10 --- Compiling unwind v0.0.0 (/checkout/library/unwind) error[E0422]: cannot find struct, variant or union type `Range` in this scope --> alloc/src/vec/extract_if.rs:49:13 | 49 | let Range { start, end } = slice::range(range, ..old_len); | help: consider importing one of these structs | 1 + use crate::collections::btree_map::Range; --- error[E0424]: expected value, found module `self` --> alloc/src/vec/extract_if.rs:55:26 | 47 | pub(super) fn new(vec: &mut Vec, pred: F, range: core::ops::RangeFull) -> Self { | --- this function doesn't have a `self` parameter ... 55 | ExtractIf { vec: self, idx: start, del: 0, end, old_len, pred: filter } | ^^^^ `self` value is a keyword only available in methods with a `self` parameter | help: add a `self` receiver parameter to make the associated `fn` a method | 47 | pub(super) fn new(&self, vec: &mut Vec, pred: F, range: core::ops::RangeFull) -> Self { error[E0425]: cannot find value `filter` in this scope --> alloc/src/vec/extract_if.rs:55:72 | | 55 | ExtractIf { vec: self, idx: start, del: 0, end, old_len, pred: filter } error[E0425]: cannot find value `pred` in this scope --> alloc/src/vec/mod.rs:3690:30 | | 3690 | ExtractIf::new(self, pred, range) error[E0308]: mismatched types --> alloc/src/vec/mod.rs:3690:36 | | 3685 | pub fn extract_if(&mut self, range: R, filter: F) -> ExtractIf<'_, T, F, A> ... ... 3690 | ExtractIf::new(self, pred, range) | -------------- ^^^^^ expected `RangeFull`, found type parameter `R` | arguments to this function are incorrect | = note: expected struct `RangeFull` found type parameter `R` found type parameter `R` note: associated function defined here --> alloc/src/vec/extract_if.rs:47:19 | 47 | pub(super) fn new(vec: &mut Vec, pred: F, range: core::ops::RangeFull) -> Self { Some errors have detailed explanations: E0308, E0422, E0424, E0425. For more information about an error, try `rustc --explain E0308`. error: could not compile `alloc` (lib) due to 5 previous errors ```
rust-log-analyzer commented 1 day ago

The job x86_64-gnu-llvm-18 failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot) ```plain #16 exporting to docker image format #16 sending tarball 28.1s done #16 DONE 41.8s ##[endgroup] Setting extra environment values for docker: --env ENABLE_GCC_CODEGEN=1 --env GCC_EXEC_PREFIX=/usr/lib/gcc/ [CI_JOB_NAME=x86_64-gnu-llvm-18] debug: `DISABLE_CI_RUSTC_IF_INCOMPATIBLE` configured. --- sccache: Starting the server... ##[group]Configure the build configure: processing command line configure: configure: build.configure-args := ['--build=x86_64-unknown-linux-gnu', '--llvm-root=/usr/lib/llvm-18', '--enable-llvm-link-shared', '--set', 'rust.randomize-layout=true', '--set', 'rust.thin-lto-import-instr-limit=10', '--enable-verbose-configure', '--enable-sccache', '--disable-manage-submodules', '--enable-locked-deps', '--enable-cargo-native-static', '--set', 'rust.codegen-units-std=1', '--set', 'dist.compression-profile=balanced', '--dist-compression-formats=xz', '--set', 'rust.lld=false', '--disable-dist-src', '--release-channel=nightly', '--enable-debug-assertions', '--enable-overflow-checks', '--enable-llvm-assertions', '--set', 'rust.verify-llvm-ir', '--set', 'rust.codegen-backends=llvm,cranelift,gcc', '--set', 'llvm.static-libstdcpp', '--enable-new-symbol-mangling'] configure: target.x86_64-unknown-linux-gnu.llvm-config := /usr/lib/llvm-18/bin/llvm-config configure: llvm.link-shared := True configure: rust.randomize-layout := True configure: rust.thin-lto-import-instr-limit := 10 --- Compiling rustc_hir v0.0.0 (/checkout/compiler/rustc_hir) Compiling rustc_lint_defs v0.0.0 (/checkout/compiler/rustc_lint_defs) Compiling rustc_hir_pretty v0.0.0 (/checkout/compiler/rustc_hir_pretty) Compiling rustc_errors v0.0.0 (/checkout/compiler/rustc_errors) error[E0277]: the trait bound `{closure@compiler/rustc_errors/src/lib.rs:1561:43: 1561:62}: RangeBounds` is not satisfied | | 1572 | diagnostic.children.extract_if(already_emitted_sub).for_each(|_| {}); | ---------- ^^^^^^^^^^^^^^^^^^^ the trait `RangeBounds` is not implemented for closure `{closure@compiler/rustc_errors/src/lib.rs:1561:43: 1561:62}` | required by a bound introduced by this call | | note: required by a bound in `Vec::::extract_if` | | 3685 | pub fn extract_if(&mut self, range: R, filter: F) -> ExtractIf<'_, T, F, A> ... ... 3688 | R: RangeBounds, | ^^^^^^^^^^^^^^^^^^ required by this bound in `Vec::::extract_if` error[E0061]: this method takes 2 arguments but 1 argument was supplied --> compiler/rustc_errors/src/lib.rs:1572:37 | | 1572 | diagnostic.children.extract_if(already_emitted_sub).for_each(|_| {}); | ^^^^^^^^^^--------------------- argument #2 is missing note: method defined here --> /checkout/library/alloc/src/vec/mod.rs:3685:12 | | 3685 | pub fn extract_if(&mut self, range: R, filter: F) -> ExtractIf<'_, T, F, A> help: provide the argument | | 1572 | diagnostic.children.extract_if(already_emitted_sub, /* filter */).for_each(|_| {}); Some errors have detailed explanations: E0061, E0277. For more information about an error, try `rustc --explain E0061`. error: could not compile `rustc_errors` (lib) due to 2 previous errors ```
rust-log-analyzer commented 1 day ago

The job mingw-check failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot) ```plain = note: `-D rustdoc::unescaped-backticks` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(rustdoc::unescaped_backticks)]` help: if you meant to use a literal backtick, escape it | 3658 | /// If \`range`` is out of bounds. error: could not document `alloc` warning: build failed, waiting for other jobs to finish... warning: build failed, waiting for other jobs to finish... Command has failed. Rerun with -v to see more details. local time: Wed Nov 20 23:20:52 UTC 2024 network time: Wed, 20 Nov 2024 23:20:52 GMT ##[error]Process completed with exit code 1. Post job cleanup. ```