Skip to content

Disallow coercions from [T, ..n] to &[T] #18645

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
wants to merge 3 commits into from
Closed

Conversation

nrc
Copy link
Member

@nrc nrc commented Nov 5, 2014

r?

(I realise this needs a rebase, but I will probably have to chop it up in order to land and I'd like to get r+ first so I can do that quicker)

@rust-highfive
Copy link
Contributor

warning Warning warning

  • These commits modify unsafe code. Please review it carefully!

@nrc
Copy link
Member Author

nrc commented Nov 5, 2014

Part of #18469

@@ -576,11 +576,11 @@ pub trait MutableSliceAllocating<T> for Sized? {
/// ```rust
/// let mut v = [5i, 4, 1, 3, 2];
/// v.sort_by(|a, b| a.cmp(b));
/// assert!(v == [1, 2, 3, 4, 5]);
/// assert!(v == &[1, 2, 3, 4, 5]);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm under the impression that this change won't be necessary once #18486 lands. Since [T, ..N] == [T, ..N] works up to N = 32. cc @nikomatsakis

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems correct

@alexcrichton
Copy link
Member

r=me, thanks @nick29581!

bors added a commit that referenced this pull request Nov 17, 2014
The forwards compatible parts of #18645, rebased. Converts implicit coercions from `[T, ..n]` to `&[T]` into explicit references.
bors added a commit that referenced this pull request Nov 18, 2014
r?

(I realise this needs a rebase, but I will probably have to chop it up in order to land and I'd like to get r+ first so I can do that quicker)
@bors bors closed this Nov 18, 2014
lnicola pushed a commit to lnicola/rust that referenced this pull request Dec 11, 2024
fix: Non-exhaustive structs may be empty
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants