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

Unstable indexing permitted in beta channel #24791

Closed
bluss opened this issue Apr 24, 2015 · 10 comments · Fixed by #25006
Closed

Unstable indexing permitted in beta channel #24791

bluss opened this issue Apr 24, 2015 · 10 comments · Fixed by #25006
Assignees
Labels
P-high High priority
Milestone

Comments

@bluss
Copy link
Member

bluss commented Apr 24, 2015

I just discovered you can slice the slice iterator. It's neat, but unstable. .as_slice() as well as the Index implementations for the slice::Iter are marked unstable, but you can still use the slicing syntax in the beta channel.

Compiles in rustc 1.0.0-beta.2 (e9080ec 2015-04-16) (built 2015-04-16)

println!("{:?}", &[1,2,3].iter()[..1]);

The effect is that converting iterators to slices isn't closed down like it was intended.

@bluss
Copy link
Member Author

bluss commented Apr 24, 2015

Not sure if it's intentional or not.

@bluss
Copy link
Member Author

bluss commented Apr 24, 2015

cc @aturon

@alexcrichton
Copy link
Member

This is an unfortunate fallout of our current stability system, although it looks like we don't currently have another open bug on this. The consequence is that the stability of an impl is not tracked, only the stability of the trait itself is considered when evaluating the stability of a method call.

(unfortunately).

@aturon
Copy link
Member

aturon commented Apr 27, 2015

We've talked about #[cfg(nightly)] in the past, but it didn't occur to me that it would also help with situations like this one. We should look into it.

In the meantime, I think we just need to decide whether we're willing to stabilize this functionality. I think it's unstable mostly because it was a relatively recent addition.

@pnkfelix
Copy link
Member

Decision: remove this functionality for 1.0 (since we do not have a way to mark it as unstable).

P-high.

@pnkfelix pnkfelix added P-high High priority and removed I-nominated labels Apr 30, 2015
@alexcrichton alexcrichton self-assigned this Apr 30, 2015
@alexcrichton
Copy link
Member

triage: (1.0)

@alexcrichton alexcrichton added this to the 1.0 milestone Apr 30, 2015
@bluss
Copy link
Member Author

bluss commented Apr 30, 2015

Add for Vec was discussed because it is exposed in the same way. It's hard to tell what's intentional. Needs big review?

@pnkfelix
Copy link
Member

@bluss yeah, there was discussion of that in the meeting that was not recorded here.

I think the main idea was that we would lint (or grep, etc) for uses of #[unstable] on impls, (or perhaps even go so far as to lint for any impl that does not have an #[stable] on it?) and try to ensure that none get in that are not marked as #[cfg(nightly)]...

alexcrichton added a commit to alexcrichton/rust that referenced this issue Apr 30, 2015
These implementations were intended to be unstable, but currently the stability
attributes cannot handle a stable trait with an unstable `impl` block. This
commit also audits the rest of the standard library for explicitly-`#[unstable]`
impl blocks. No others were removed but some annotations were changed to
`#[stable]` as they're defacto stable anyway.

One particularly interesting `impl` marked `#[stable]` as part of this commit
is the `Add<&[T]>` impl for `Vec<T>`, which uses `push_all` and implicitly
clones all elements of the vector provided.

Closes rust-lang#24791
@alexcrichton
Copy link
Member

@bluss I've created a PR for this in which I marked that impl stable for these reasons

@bluss
Copy link
Member Author

bluss commented Apr 30, 2015

Looks good!

Edit: I'm surpised myself. See above, this is my internalized acceptance for + for concatenation. I'm against, but I've given up a long time ago.

alexcrichton added a commit to alexcrichton/rust that referenced this issue May 1, 2015
These implementations were intended to be unstable, but currently the stability
attributes cannot handle a stable trait with an unstable `impl` block. This
commit also audits the rest of the standard library for explicitly-`#[unstable]`
impl blocks. No others were removed but some annotations were changed to
`#[stable]` as they're defacto stable anyway.

One particularly interesting `impl` marked `#[stable]` as part of this commit
is the `Add<&[T]>` impl for `Vec<T>`, which uses `push_all` and implicitly
clones all elements of the vector provided.

Closes rust-lang#24791
alexcrichton added a commit to alexcrichton/rust that referenced this issue May 1, 2015
These implementations were intended to be unstable, but currently the stability
attributes cannot handle a stable trait with an unstable `impl` block. This
commit also audits the rest of the standard library for explicitly-`#[unstable]`
impl blocks. No others were removed but some annotations were changed to
`#[stable]` as they're defacto stable anyway.

One particularly interesting `impl` marked `#[stable]` as part of this commit
is the `Add<&[T]>` impl for `Vec<T>`, which uses `push_all` and implicitly
clones all elements of the vector provided.

Closes rust-lang#24791
alexcrichton added a commit to alexcrichton/rust that referenced this issue May 1, 2015
These implementations were intended to be unstable, but currently the stability
attributes cannot handle a stable trait with an unstable `impl` block. This
commit also audits the rest of the standard library for explicitly-`#[unstable]`
impl blocks. No others were removed but some annotations were changed to
`#[stable]` as they're defacto stable anyway.

One particularly interesting `impl` marked `#[stable]` as part of this commit
is the `Add<&[T]>` impl for `Vec<T>`, which uses `push_all` and implicitly
clones all elements of the vector provided.

Closes rust-lang#24791
alexcrichton added a commit to alexcrichton/rust that referenced this issue May 1, 2015
These implementations were intended to be unstable, but currently the stability
attributes cannot handle a stable trait with an unstable `impl` block. This
commit also audits the rest of the standard library for explicitly-`#[unstable]`
impl blocks. No others were removed but some annotations were changed to
`#[stable]` as they're defacto stable anyway.

One particularly interesting `impl` marked `#[stable]` as part of this commit
is the `Add<&[T]>` impl for `Vec<T>`, which uses `push_all` and implicitly
clones all elements of the vector provided.

Closes rust-lang#24791
bors added a commit that referenced this issue May 1, 2015
These implementations were intended to be unstable, but currently the stability
attributes cannot handle a stable trait with an unstable `impl` block. This
commit also audits the rest of the standard library for explicitly-`#[unstable]`
impl blocks. No others were removed but some annotations were changed to
`#[stable]` as they're defacto stable anyway.

One particularly interesting `impl` marked `#[stable]` as part of this commit
is the `Add<&[T]>` impl for `Vec<T>`, which uses `push_all` and implicitly
clones all elements of the vector provided.

Closes #24791

[breaking-change]
alexcrichton added a commit to alexcrichton/rust that referenced this issue May 7, 2015
These implementations were intended to be unstable, but currently the stability
attributes cannot handle a stable trait with an unstable `impl` block. This
commit also audits the rest of the standard library for explicitly-`#[unstable]`
impl blocks. No others were removed but some annotations were changed to
`#[stable]` as they're defacto stable anyway.

One particularly interesting `impl` marked `#[stable]` as part of this commit
is the `Add<&[T]>` impl for `Vec<T>`, which uses `push_all` and implicitly
clones all elements of the vector provided.

Closes rust-lang#24791

Conflicts:
	src/libcoretest/slice.rs
	src/librustc_driver/lib.rs
alexcrichton added a commit to alexcrichton/rust that referenced this issue May 7, 2015
These implementations were intended to be unstable, but currently the stability
attributes cannot handle a stable trait with an unstable `impl` block. This
commit also audits the rest of the standard library for explicitly-`#[unstable]`
impl blocks. No others were removed but some annotations were changed to
`#[stable]` as they're defacto stable anyway.

One particularly interesting `impl` marked `#[stable]` as part of this commit
is the `Add<&[T]>` impl for `Vec<T>`, which uses `push_all` and implicitly
clones all elements of the vector provided.

Closes rust-lang#24791

Conflicts:
	src/libcoretest/slice.rs
	src/librustc_driver/lib.rs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P-high High priority
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants