Make slice comparisons const#143925
Conversation
This comment has been minimized.
This comment has been minimized.
494d350 to
c3b13bb
Compare
|
|
||
| let mut attrs = thin_vec![cx.attr_word(sym::automatically_derived, self.span),]; | ||
|
|
||
| if self.is_const && self.is_staged_api_crate { |
There was a problem hiding this comment.
There's clearly something interesting going on here, please add a comment explaining what.
There was a problem hiding this comment.
I'm fine with this being a temporary solution. To me, we should change #[derive_const(PartialEq)] to something like #[derive(PartialEq(const))] (syntax to-be-bikeshedded), then we can have #[derive(PartialEq(const, unstable))] in all standard library crates.
There was a problem hiding this comment.
How does it know which feature gate to use...?
We're fairly close to actually enforcing feature stability on impls (#140399) so this question matters soon, IIUC.
There was a problem hiding this comment.
it doesn't. All derived const trait impls are under the derive_const feature gate
| // See PR https://github.com/rust-lang/rust/pull/116846 | ||
| for idx in 0..self.len() { | ||
| let mut idx = 0; | ||
| while idx < self.len() { |
There was a problem hiding this comment.
This should get a FIXME(const-hack).
c3b13bb to
19c2f1b
Compare
|
|
||
| let mut attrs = thin_vec![cx.attr_word(sym::automatically_derived, self.span),]; | ||
|
|
||
| if self.is_const && self.is_staged_api_crate { |
There was a problem hiding this comment.
I'm fine with this being a temporary solution. To me, we should change #[derive_const(PartialEq)] to something like #[derive(PartialEq(const))] (syntax to-be-bikeshedded), then we can have #[derive(PartialEq(const, unstable))] in all standard library crates.
|
@bors r+ rollup |
…ee1-dead Make slice comparisons const This needed a fix for `derive_const`, too, as it wasn't usable in libcore anymore as trait impls need const stability attributes. I think we can't use the same system as normal trait impls while `const_trait_impl` is still unstable. r? ``@fee1-dead`` cc rust-lang#143800
…ee1-dead Make slice comparisons const This needed a fix for `derive_const`, too, as it wasn't usable in libcore anymore as trait impls need const stability attributes. I think we can't use the same system as normal trait impls while `const_trait_impl` is still unstable. r? ```@fee1-dead``` cc rust-lang#143800
…ee1-dead Make slice comparisons const This needed a fix for `derive_const`, too, as it wasn't usable in libcore anymore as trait impls need const stability attributes. I think we can't use the same system as normal trait impls while `const_trait_impl` is still unstable. r? ````@fee1-dead```` cc rust-lang#143800
|
@bors r- Failed in rollup: #143978 (comment) Needs a rebase after #143875 |
Also make it *only* usable on nightly
19c2f1b to
68b415a
Compare
|
@bors r=fee1-dead |
…ee1-dead Make slice comparisons const This needed a fix for `derive_const`, too, as it wasn't usable in libcore anymore as trait impls need const stability attributes. I think we can't use the same system as normal trait impls while `const_trait_impl` is still unstable. r? `@fee1-dead` cc rust-lang#143800
Rollup of 12 pull requests Successful merges: - #142300 (Disable `tests/run-make/mte-ffi` because no CI runners have MTE extensions enabled) - #143271 (Store the type of each GVN value) - #143280 (Remove duplicate error about raw underscore lifetime) - #143649 (Add test for `default_field_values` and `const_default`) - #143699 (Make `AsyncDrop` check that it's being implemented on a local ADT) - #143719 (Emit warning when there is no space between `-o` and arg) - #143833 (Ban projecting into SIMD types [MCP838]) - #143891 (Port `#[coverage]` to the new attribute system) - #143908 (`tests/ui`: A New Order [0/28] ) - #143909 (docs(alloc::fmt): Make type optional, instead of matching empty string) - #143925 (Make slice comparisons const) - #143997 (Use $crate in macros for rustc_public (aka stable_mir)) r? `@ghost` `@rustbot` modify labels: rollup
…ee1-dead Make slice comparisons const This needed a fix for `derive_const`, too, as it wasn't usable in libcore anymore as trait impls need const stability attributes. I think we can't use the same system as normal trait impls while `const_trait_impl` is still unstable. r? ``@fee1-dead`` cc rust-lang#143800
Rollup of 12 pull requests Successful merges: - #143280 (Remove duplicate error about raw underscore lifetime) - #143649 (Add test for `default_field_values` and `const_default`) - #143699 (Make `AsyncDrop` check that it's being implemented on a local ADT) - #143704 (Be a bit more careful around exotic cycles in in the inliner) - #143908 (`tests/ui`: A New Order [0/28] ) - #143909 (docs(alloc::fmt): Make type optional, instead of matching empty string) - #143925 (Make slice comparisons const) - #143997 (Use $crate in macros for rustc_public (aka stable_mir)) - #144013 (resolve: Make disambiguators for underscore bindings module-local) - #144029 (Fix wrong messages from methods with the same name from different traits) - #144063 (Add myself to the `infra-ci` reviewer group and adjust some infra auto-labels) - #144069 (ci: use windows 22 for all free runners) r? `@ghost` `@rustbot` modify labels: rollup
Rollup of 11 pull requests Successful merges: - #143280 (Remove duplicate error about raw underscore lifetime) - #143649 (Add test for `default_field_values` and `const_default`) - #143699 (Make `AsyncDrop` check that it's being implemented on a local ADT) - #143908 (`tests/ui`: A New Order [0/28] ) - #143909 (docs(alloc::fmt): Make type optional, instead of matching empty string) - #143925 (Make slice comparisons const) - #143997 (Use $crate in macros for rustc_public (aka stable_mir)) - #144013 (resolve: Make disambiguators for underscore bindings module-local) - #144029 (Fix wrong messages from methods with the same name from different traits) - #144063 (Add myself to the `infra-ci` reviewer group and adjust some infra auto-labels) - #144069 (ci: use windows 22 for all free runners) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of #143925 - oli-obk:slice-const-partialeq, r=fee1-dead Make slice comparisons const This needed a fix for `derive_const`, too, as it wasn't usable in libcore anymore as trait impls need const stability attributes. I think we can't use the same system as normal trait impls while `const_trait_impl` is still unstable. r? ```@fee1-dead``` cc #143800
…ee1-dead Make slice comparisons const This needed a fix for `derive_const`, too, as it wasn't usable in libcore anymore as trait impls need const stability attributes. I think we can't use the same system as normal trait impls while `const_trait_impl` is still unstable. r? ```@fee1-dead``` cc rust-lang#143800
…iaskrgr Rollup of 11 pull requests Successful merges: - rust-lang#143280 (Remove duplicate error about raw underscore lifetime) - rust-lang#143649 (Add test for `default_field_values` and `const_default`) - rust-lang#143699 (Make `AsyncDrop` check that it's being implemented on a local ADT) - rust-lang#143908 (`tests/ui`: A New Order [0/28] ) - rust-lang#143909 (docs(alloc::fmt): Make type optional, instead of matching empty string) - rust-lang#143925 (Make slice comparisons const) - rust-lang#143997 (Use $crate in macros for rustc_public (aka stable_mir)) - rust-lang#144013 (resolve: Make disambiguators for underscore bindings module-local) - rust-lang#144029 (Fix wrong messages from methods with the same name from different traits) - rust-lang#144063 (Add myself to the `infra-ci` reviewer group and adjust some infra auto-labels) - rust-lang#144069 (ci: use windows 22 for all free runners) r? `@ghost` `@rustbot` modify labels: rollup
…ee1-dead Make slice comparisons const This needed a fix for `derive_const`, too, as it wasn't usable in libcore anymore as trait impls need const stability attributes. I think we can't use the same system as normal trait impls while `const_trait_impl` is still unstable. r? ```@fee1-dead``` cc rust-lang#143800
Rollup of 11 pull requests Successful merges: - rust-lang/rust#143280 (Remove duplicate error about raw underscore lifetime) - rust-lang/rust#143649 (Add test for `default_field_values` and `const_default`) - rust-lang/rust#143699 (Make `AsyncDrop` check that it's being implemented on a local ADT) - rust-lang/rust#143908 (`tests/ui`: A New Order [0/28] ) - rust-lang/rust#143909 (docs(alloc::fmt): Make type optional, instead of matching empty string) - rust-lang/rust#143925 (Make slice comparisons const) - rust-lang/rust#143997 (Use $crate in macros for rustc_public (aka stable_mir)) - rust-lang/rust#144013 (resolve: Make disambiguators for underscore bindings module-local) - rust-lang/rust#144029 (Fix wrong messages from methods with the same name from different traits) - rust-lang/rust#144063 (Add myself to the `infra-ci` reviewer group and adjust some infra auto-labels) - rust-lang/rust#144069 (ci: use windows 22 for all free runners) r? `@ghost` `@rustbot` modify labels: rollup
Rollup of 11 pull requests Successful merges: - rust-lang/rust#143280 (Remove duplicate error about raw underscore lifetime) - rust-lang/rust#143649 (Add test for `default_field_values` and `const_default`) - rust-lang/rust#143699 (Make `AsyncDrop` check that it's being implemented on a local ADT) - rust-lang/rust#143908 (`tests/ui`: A New Order [0/28] ) - rust-lang/rust#143909 (docs(alloc::fmt): Make type optional, instead of matching empty string) - rust-lang/rust#143925 (Make slice comparisons const) - rust-lang/rust#143997 (Use $crate in macros for rustc_public (aka stable_mir)) - rust-lang/rust#144013 (resolve: Make disambiguators for underscore bindings module-local) - rust-lang/rust#144029 (Fix wrong messages from methods with the same name from different traits) - rust-lang/rust#144063 (Add myself to the `infra-ci` reviewer group and adjust some infra auto-labels) - rust-lang/rust#144069 (ci: use windows 22 for all free runners) r? `@ghost` `@rustbot` modify labels: rollup
…iaskrgr Rollup of 11 pull requests Successful merges: - rust-lang#143280 (Remove duplicate error about raw underscore lifetime) - rust-lang#143649 (Add test for `default_field_values` and `const_default`) - rust-lang#143699 (Make `AsyncDrop` check that it's being implemented on a local ADT) - rust-lang#143908 (`tests/ui`: A New Order [0/28] ) - rust-lang#143909 (docs(alloc::fmt): Make type optional, instead of matching empty string) - rust-lang#143925 (Make slice comparisons const) - rust-lang#143997 (Use $crate in macros for rustc_public (aka stable_mir)) - rust-lang#144013 (resolve: Make disambiguators for underscore bindings module-local) - rust-lang#144029 (Fix wrong messages from methods with the same name from different traits) - rust-lang#144063 (Add myself to the `infra-ci` reviewer group and adjust some infra auto-labels) - rust-lang#144069 (ci: use windows 22 for all free runners) r? `@ghost` `@rustbot` modify labels: rollup
…iaskrgr Rollup of 11 pull requests Successful merges: - rust-lang#143280 (Remove duplicate error about raw underscore lifetime) - rust-lang#143649 (Add test for `default_field_values` and `const_default`) - rust-lang#143699 (Make `AsyncDrop` check that it's being implemented on a local ADT) - rust-lang#143908 (`tests/ui`: A New Order [0/28] ) - rust-lang#143909 (docs(alloc::fmt): Make type optional, instead of matching empty string) - rust-lang#143925 (Make slice comparisons const) - rust-lang#143997 (Use $crate in macros for rustc_public (aka stable_mir)) - rust-lang#144013 (resolve: Make disambiguators for underscore bindings module-local) - rust-lang#144029 (Fix wrong messages from methods with the same name from different traits) - rust-lang#144063 (Add myself to the `infra-ci` reviewer group and adjust some infra auto-labels) - rust-lang#144069 (ci: use windows 22 for all free runners) r? `@ghost` `@rustbot` modify labels: rollup
Rollup of 11 pull requests Successful merges: - rust-lang/rust#143280 (Remove duplicate error about raw underscore lifetime) - rust-lang/rust#143649 (Add test for `default_field_values` and `const_default`) - rust-lang/rust#143699 (Make `AsyncDrop` check that it's being implemented on a local ADT) - rust-lang/rust#143908 (`tests/ui`: A New Order [0/28] ) - rust-lang/rust#143909 (docs(alloc::fmt): Make type optional, instead of matching empty string) - rust-lang/rust#143925 (Make slice comparisons const) - rust-lang/rust#143997 (Use $crate in macros for rustc_public (aka stable_mir)) - rust-lang/rust#144013 (resolve: Make disambiguators for underscore bindings module-local) - rust-lang/rust#144029 (Fix wrong messages from methods with the same name from different traits) - rust-lang/rust#144063 (Add myself to the `infra-ci` reviewer group and adjust some infra auto-labels) - rust-lang/rust#144069 (ci: use windows 22 for all free runners) r? `@ghost` `@rustbot` modify labels: rollup
This needed a fix for
derive_const, too, as it wasn't usable in libcore anymore as trait impls need const stability attributes. I think we can't use the same system as normal trait impls whileconst_trait_implis still unstable.r? @fee1-dead
cc #143800