Skip to content
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

remove 'const' from 'Option::iter' #130087

Merged
merged 1 commit into from
Sep 9, 2024
Merged

Conversation

RalfJung
Copy link
Member

@RalfJung RalfJung commented Sep 7, 2024

This is kind of pointless to be a const fn since you can't do anything with the iterator. It is also the only const fn iter* in the entire standard library. It probably got constified when ~const traits got added everywhere, and then was forgotten to be de-constified when that was undone.

The rest of the const_option feature seems like it can reasonably be stabilized, but this one IMO should not be stabilized, and it's not worth creating a new tracking issue.

Cc #67441

@rustbot
Copy link
Collaborator

rustbot commented Sep 7, 2024

r? @workingjubilee

rustbot has assigned @workingjubilee.
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

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Sep 7, 2024
@workingjubilee
Copy link
Member

This is kind of pointless to be a const fn since you can't do anything with the iterator.

hm. idk, lots of constructors are useful just for being const? I think this one is different because it has a lifetime...

@RalfJung
Copy link
Member Author

RalfJung commented Sep 8, 2024

They are useful because you can have a const C: Vec<_> then. But what would a const I: Iter<_> be good for? That has to be extremely niche. The fact that no other iter function is const is also telling.

@workingjubilee
Copy link
Member

Yeah, seems likely we'd want to land it with others of its kind if it does indeed prove useful.

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Sep 8, 2024

📌 Commit f7d4da6 has been approved by workingjubilee

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 8, 2024
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Sep 8, 2024
…ingjubilee

remove 'const' from 'Option::iter'

This is kind of pointless to be a `const fn` since you can't do anything with the iterator. It is also the only `const fn iter*` in the entire standard library. It probably got constified when `~const` traits got added everywhere, and then was forgotten to be de-constified when that was undone.

The rest of the const_option feature seems like it can reasonably be stabilized, but this one IMO should not be stabilized, and it's not worth creating a new tracking issue.

Cc rust-lang#67441
bors added a commit to rust-lang-ci/rust that referenced this pull request Sep 8, 2024
…iaskrgr

Rollup of 7 pull requests

Successful merges:

 - rust-lang#129337 (rustdoc rfc#3662 changes under unstable flags)
 - rust-lang#129473 (use  `download-ci-llvm=true` in the default compiler config)
 - rust-lang#129529 (Add test to build crates used by r-a on stable)
 - rust-lang#130025 (Also emit `missing_docs` lint with `--test` to fulfil expectations)
 - rust-lang#130070 (Rename variant `AddrOfRegion` of `RegionVariableOrigin` to `BorrowRegion`)
 - rust-lang#130087 (remove 'const' from 'Option::iter')
 - rust-lang#130092 (Fixes typo in wasm32-wasip2 doc comment)

r? `@ghost`
`@rustbot` modify labels: rollup
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Sep 8, 2024
…ingjubilee

remove 'const' from 'Option::iter'

This is kind of pointless to be a `const fn` since you can't do anything with the iterator. It is also the only `const fn iter*` in the entire standard library. It probably got constified when `~const` traits got added everywhere, and then was forgotten to be de-constified when that was undone.

The rest of the const_option feature seems like it can reasonably be stabilized, but this one IMO should not be stabilized, and it's not worth creating a new tracking issue.

Cc rust-lang#67441
bors added a commit to rust-lang-ci/rust that referenced this pull request Sep 8, 2024
…iaskrgr

Rollup of 7 pull requests

Successful merges:

 - rust-lang#129473 (use  `download-ci-llvm=true` in the default compiler config)
 - rust-lang#129529 (Add test to build crates used by r-a on stable)
 - rust-lang#130025 (Also emit `missing_docs` lint with `--test` to fulfil expectations)
 - rust-lang#130048 (run-make-support: Add llvm-pdbutil)
 - rust-lang#130070 (Rename variant `AddrOfRegion` of `RegionVariableOrigin` to `BorrowRegion`)
 - rust-lang#130087 (remove 'const' from 'Option::iter')
 - rust-lang#130092 (Fixes typo in wasm32-wasip2 doc comment)

r? `@ghost`
`@rustbot` modify labels: rollup
workingjubilee added a commit to workingjubilee/rustc that referenced this pull request Sep 9, 2024
…ingjubilee

remove 'const' from 'Option::iter'

This is kind of pointless to be a `const fn` since you can't do anything with the iterator. It is also the only `const fn iter*` in the entire standard library. It probably got constified when `~const` traits got added everywhere, and then was forgotten to be de-constified when that was undone.

The rest of the const_option feature seems like it can reasonably be stabilized, but this one IMO should not be stabilized, and it's not worth creating a new tracking issue.

Cc rust-lang#67441
workingjubilee added a commit to workingjubilee/rustc that referenced this pull request Sep 9, 2024
…ingjubilee

remove 'const' from 'Option::iter'

This is kind of pointless to be a `const fn` since you can't do anything with the iterator. It is also the only `const fn iter*` in the entire standard library. It probably got constified when `~const` traits got added everywhere, and then was forgotten to be de-constified when that was undone.

The rest of the const_option feature seems like it can reasonably be stabilized, but this one IMO should not be stabilized, and it's not worth creating a new tracking issue.

Cc rust-lang#67441
bors added a commit to rust-lang-ci/rust that referenced this pull request Sep 9, 2024
…kingjubilee

Rollup of 16 pull requests

Successful merges:

 - rust-lang#119229 (Update mingw-w64 + GNU toolchain)
 - rust-lang#128345 (added support for GNU/Hurd on x86_64)
 - rust-lang#128667 (rustdoc: normalise type/field names)
 - rust-lang#128939 (Distribute rustc_codegen_cranelift for Windows)
 - rust-lang#129529 (Add test to build crates used by r-a on stable)
 - rust-lang#129624 (Adjust `memchr` pinning and run `cargo update`)
 - rust-lang#129876 (Use sysroot crates maximally in `rustc_codegen_gcc`.)
 - rust-lang#130034 ( Fix enabling wasm-component-ld to match other tools )
 - rust-lang#130048 (run-make-support: Add llvm-pdbutil)
 - rust-lang#130068 (Test codegen when setting deployment target)
 - rust-lang#130070 (Rename variant `AddrOfRegion` of `RegionVariableOrigin` to `BorrowRegion`)
 - rust-lang#130087 (remove 'const' from 'Option::iter')
 - rust-lang#130090 (make Result::copied unstably const)
 - rust-lang#130092 (Fixes typo in wasm32-wasip2 doc comment)
 - rust-lang#130107 (const: make ptr.is_null() stop execution on ambiguity)
 - rust-lang#130115 (Remove needless returns detected by clippy in libraries)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit to rust-lang-ci/rust that referenced this pull request Sep 9, 2024
…kingjubilee

Rollup of 14 pull requests

Successful merges:

 - rust-lang#119229 (Update mingw-w64 + GNU toolchain)
 - rust-lang#128345 (added support for GNU/Hurd on x86_64)
 - rust-lang#128667 (rustdoc: normalise type/field names)
 - rust-lang#129876 (Use sysroot crates maximally in `rustc_codegen_gcc`.)
 - rust-lang#130034 ( Fix enabling wasm-component-ld to match other tools )
 - rust-lang#130048 (run-make-support: Add llvm-pdbutil)
 - rust-lang#130068 (Test codegen when setting deployment target)
 - rust-lang#130070 (Rename variant `AddrOfRegion` of `RegionVariableOrigin` to `BorrowRegion`)
 - rust-lang#130087 (remove 'const' from 'Option::iter')
 - rust-lang#130090 (make Result::copied unstably const)
 - rust-lang#130092 (Fixes typo in wasm32-wasip2 doc comment)
 - rust-lang#130107 (const: make ptr.is_null() stop execution on ambiguity)
 - rust-lang#130115 (Remove needless returns detected by clippy in libraries)
 - rust-lang#130130 (Miri subtree update)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 38520ae into rust-lang:master Sep 9, 2024
6 checks passed
@rustbot rustbot added this to the 1.83.0 milestone Sep 9, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Sep 9, 2024
Rollup merge of rust-lang#130087 - RalfJung:option-const-iter, r=workingjubilee

remove 'const' from 'Option::iter'

This is kind of pointless to be a `const fn` since you can't do anything with the iterator. It is also the only `const fn iter*` in the entire standard library. It probably got constified when `~const` traits got added everywhere, and then was forgotten to be de-constified when that was undone.

The rest of the const_option feature seems like it can reasonably be stabilized, but this one IMO should not be stabilized, and it's not worth creating a new tracking issue.

Cc rust-lang#67441
@RalfJung RalfJung deleted the option-const-iter branch September 9, 2024 12:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-libs Relevant to the library team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants