Skip to content

Remove extern mod foo (name="bar") syntax, closes #9543 - #10696

Merged
bors merged 2 commits into
rust-lang:masterfrom
fhahn:issue9543-remove-extern-mod-foo
Jan 2, 2014
Merged

bors merged 2 commits into
rust-lang:masterfrom
fhahn:issue9543-remove-extern-mod-foo

Conversation

@fhahn

@fhahn fhahn commented Nov 27, 2013

Copy link
Copy Markdown
Contributor

This patch for #9543 throws an obsolete syntax error for extern mod foo (name="bar") .
I was wondering if this is the correct place to do this?

I think the wording of the error message could probably be improved as well.

If this approach is OK, I'm going to run the whole test suite tomorrow and update the old syntax to the new one.

@fhahn

fhahn commented Nov 28, 2013

Copy link
Copy Markdown
Contributor Author

I've updated to obsolete syntax in the tests.

One thing I was wondering about: should extern mod bar(name = "std", vers = "0.9-pre"); behave like extern mod bar = "std"; for the name resolution?

@metajack

Copy link
Copy Markdown
Contributor

It's a package id, so the most specific one would be extern mod bar = "std#0.9-pre";

@fhahn

fhahn commented Nov 28, 2013

Copy link
Copy Markdown
Contributor Author

Does this mean we could get rid of the whole extern mod bar(x=y, a=b); syntax? I'm not sure if #9543 was only limited to extern mod bar(name = foo);.

@metajack

Copy link
Copy Markdown
Contributor

I thought this was the plan. My PR for stable crate hashes removes the tests for this functionality since link args is getting removed there.

@fhahn

fhahn commented Nov 28, 2013

Copy link
Copy Markdown
Contributor Author

Ah I see!

So I guess I should wait until your PR (#10593 , if I'm not wrong) is merged and remove the extern mod bar() syntax then?

@metajack

Copy link
Copy Markdown
Contributor

You can remove it now if you like. I can rebase my PR over yours when it lands. They are orthogonal changes that happen to overlap in removing a few of the same tests :)

@alexcrichton

Copy link
Copy Markdown
Member

It seems a little odd to only remove extern mod(name = "bar") yet still allow extern mod(name = "bar", foo = "baz"). We should either completely support linkage attributes or completely deny them I would imagine.

@fhahn

fhahn commented Nov 28, 2013

Copy link
Copy Markdown
Contributor Author

That seemed odd to me as well.

I've updated my patch and removed the parsing of linkage attributes altogether and display a obsolete syntax message instead.
In order to compile rust with this patch, we'll need @metajack 's changes, because a linkage version is used in some files.

@alexcrichton

Copy link
Copy Markdown
Member

@metajack, @brson, this was the agreed-upon path forward for pkgid, right?

@metajack

Copy link
Copy Markdown
Contributor

@alexcrichton Yes. I was planning to make the old syntax an error instead of a warning, but that is probably something that should be decided by Rust core team. In any case, this is better than the silent ignoring we have now.

@fhahn

fhahn commented Dec 16, 2013

Copy link
Copy Markdown
Contributor Author

@metajack this version of the patch gives an error fhahn@c199905#diff-da9d34ca1d0f6beee2838cf02e07345cR4433

@alexcrichton

Copy link
Copy Markdown
Member

This needs a rebase again, and I would be comfortable merging this if it also removes the array of attributes from view_item_extern_mod.

@fhahn

fhahn commented Dec 30, 2013

Copy link
Copy Markdown
Contributor Author

I've rebase this PR and removed the arry of attributes.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Ah now I remember something I remembered awhile ago, these need to change to link to the proper libstd. Right now this is just linking to an arbitrary libstd but we want it to target a specific version (in this case 0.9-pre). The extern mod statements below should not have None, but rather Some("std#0.9-pre") (or the equivalent thereof)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I've pushed another commit, addressing this point.

@alexcrichton

Copy link
Copy Markdown
Member

Just a few more minor comments. With this addressed and a squash into one commit, looks good to me!

@fhahn

fhahn commented Jan 1, 2014

Copy link
Copy Markdown
Contributor Author

After injecting the std libs with version numbers, I noticed a problem with rustpkg. I've pushed a fix for rustpkg to work with versioned std libs, but there is an inconsistency with the version handling in rustpkg. rustpkg::version::split_version returns versions like 0.9-pre, but this version string isn't a valid version for try_parsing_version. In my opinion, both functions should return compatible versions.

I've squashed everything into two commits, one for the syntax removal and one for the injection with versions, because they seem like two distinct changes to me, but I could squash them into one big commit.

@fhahn

fhahn commented Jan 2, 2014

Copy link
Copy Markdown
Contributor Author

It seems like I forgot to run make check before pushing the most recent version, one line was too long. I've pushed an update version.

bors added a commit that referenced this pull request Jan 2, 2014
…pcwalton

This patch for  #9543 throws an `obsolete syntax` error for `extern mod foo (name="bar")` . 
I was wondering if [this](https://github.com/fhahn/rust/compare/mozilla:master...fhahn:issue9543-remove-extern-mod-foo?expand=1#diff-da9d34ca1d0f6beee2838cf02e07345cR4444) is the correct place to do this?

I think the wording of the error message could probably be improved as well.

If this approach is OK, I'm going to run the whole test suite tomorrow and update the old syntax to the new one.
@bors
bors merged commit 4cb13ed into rust-lang:master Jan 2, 2014
@fhahn
fhahn deleted the issue9543-remove-extern-mod-foo branch January 3, 2014 16:32
flip1995 pushed a commit to flip1995/rust that referenced this pull request Apr 23, 2023
…=flip1995

Fix `#[allow(clippy::enum_variant_names)]` directly on variants

changelog: [`enum_variant_names`]: Fix `#[allow]` attributes applied directly to the enum variant

Fixes rust-lang#10695
U007D pushed a commit to U007D/rust-mos that referenced this pull request Aug 21, 2026
10696: internal: Replace more Name::to_string usages with Name::to_smol_str r=Veykril a=Veykril

Gets rid of some more unnecessary string allocs
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
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.

6 participants