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

Rename SliceConcatExt::connect to join #26957

Merged
merged 4 commits into from
Jul 12, 2015

Conversation

wesleywiser
Copy link
Member

Fixes #26900

@rust-highfive
Copy link
Collaborator

r? @alexcrichton

(rust_highfive has picked a reviewer for you, use r? to override)

@wesleywiser
Copy link
Member Author

I broke this out into two separate commits to make it easier to code review. The first commit is the rename and the second changes all of the call sites. If it's better to squash them together before merging them, I'd be happy to do that too.

I tried to follow the RFC but if I messed something up, please let me know. Thanks!

/// assert_eq!(["hello", "world"].connect(" "), "hello world");
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
#[deprecated(since = "1.3.0", reason = "renamed to join")]
fn connect(&self, sep: &T) -> Self::Output;
Copy link
Contributor

Choose a reason for hiding this comment

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

Probably best to just have this default to calling join so you don't need multiple impls.

Copy link
Member

Choose a reason for hiding this comment

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

Isn't it backwards-incompatible to do anything other than having join default to calling connect?

Copy link
Contributor

Choose a reason for hiding this comment

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

Well, he even had to fix libcollections/str.rs, so it's clearly not backward compatible.

Copy link
Member Author

Choose a reason for hiding this comment

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

The trait is marked unstable but the individual functions are marked as stable. What does that mean in terms of backward-compatibility? I tried to make my changes backwards compatible for users of the trait but I hadn't considered implementors.

Copy link
Contributor

Choose a reason for hiding this comment

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

@eddyb All implementors must have given an impl of connect, so this default will never apply unless you update your impl to not use connect.

Copy link
Member

Choose a reason for hiding this comment

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

Without a default on join, no user impls will compile after this change. But if the trait is unstable... It's probably fine.

Copy link
Member Author

Choose a reason for hiding this comment

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

It seems to me that providing a default on one of the functions is a good idea. I'm just not sure which one.

If we:

  • default connect to call join: then this will break any existing user implementations. However the trait is currently marked unstable. Is breaking backwards compatibility ok then?
  • default join to call connect: then existing user implementations will continue working. However any future users will have to implement a deprecated method which doesn't seem obvious or desirable. Also, will that generate warnings on their implementations?

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh yes. Sorry I saw that this PR was breaking all implementations anyway,
so I immediately paged out "having to implement join" as a breaking change.
:)

Longterm I think connect-defaults-to-join is the right one. Regardless,
sliceconcatext isn't really something that's meant to be impl'd... it's
just a hack we use internally, I think.

On Sat, Jul 11, 2015 at 10:45 AM, Eduard Burtescu notifications@github.com
wrote:

In src/libcollections/slice.rs
#26957 (comment):

 /// assert_eq!(["hello", "world"].connect(" "), "hello world");
 /// ```
 #[stable(feature = "rust1", since = "1.0.0")]
  • #[deprecated(since = "1.3.0", reason = "renamed to join")]
    fn connect(&self, sep: &T) -> Self::Output;

Without a default on join, no user impls will compile after this change.
But if the trait is unstable... It's probably fine.


Reply to this email directly or view it on GitHub
https://github.com/rust-lang/rust/pull/26957/files#r34414816.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ok. I'll change connect to default to join which should address the remaining nits. I'll push that change up in a minute. Should I squash everything together or leave the rename and connect-to-join changes in two separate commits?

Copy link
Contributor

Choose a reason for hiding this comment

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

Having a seperate "rename" and "fallout" commit seems reasonable.

On Sat, Jul 11, 2015 at 1:42 PM, Wesley Wiser notifications@github.com
wrote:

In src/libcollections/slice.rs
#26957 (comment):

 /// assert_eq!(["hello", "world"].connect(" "), "hello world");
 /// ```
 #[stable(feature = "rust1", since = "1.0.0")]
  • #[deprecated(since = "1.3.0", reason = "renamed to join")]
    fn connect(&self, sep: &T) -> Self::Output;

Ok. I'll change connect to default to join which should address the
remaining nits. I'll push that change up in a minute. Should I squash
everything together or leave the rename and connect-to-join changes in
two separate commits?


Reply to this email directly or view it on GitHub
https://github.com/rust-lang/rust/pull/26957/files#r34416058.

@Gankra
Copy link
Contributor

Gankra commented Jul 11, 2015

r=me with nits

@alexcrichton
Copy link
Member

I'd like to hold off on r+'ing this just yet as I'd also like to run this through crater. This is a change to a pretty core type, so it may have unintended impact that we weren't aware of ahead of time.

@alexcrichton
Copy link
Member

I'm currently running a crater run.

@alexcrichton
Copy link
Member

Ok, here's the regression report. Looks like a few crates have failed because of #![deny(warnings)], but nothing is unexpected.

@bors: r+ ed472c8

Thanks @wesleywiser!

bors added a commit that referenced this pull request Jul 12, 2015
@bors
Copy link
Contributor

bors commented Jul 12, 2015

⌛ Testing commit ed472c8 with merge 05d8767...

@wesleywiser
Copy link
Member Author

I was going to squash the code review feedback before it got merged. The
branch is kind of messy right now. Do you still want me to do that?

On Sun, Jul 12, 2015, 6:06 PM bors notifications@github.com wrote:

[image: ⌛] Testing commit ed472c8
ed472c8
with merge 05d8767
05d8767
...


Reply to this email directly or view it on GitHub
#26957 (comment).

@alexcrichton
Copy link
Member

If this bounces then it's fine to squash, but while bors is testing the branch shouldn't be force pushed. Not much harm either way :)

@bors bors merged commit ed472c8 into rust-lang:master Jul 12, 2015
@bluss
Copy link
Member

bluss commented Jul 13, 2015

Is there any way we could move this method to be inherent on slices? The rename is a good opportunity.

geofft added a commit to geofft/std-with-cargo that referenced this pull request Aug 31, 2015
On the functionality side, morestack is gone (rust-lang/rust#27338), and
rustrt_native is gone (rust-lang/rust#27176).

On the implementation side, connect has been renamed to join
(rust-lang/rust#26957).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants