You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to tackle #9543 but under the impression that 'extern mod foo(name = "bar")' should be equivalent to 'extern mod foo = "bar"'. After trying to change occurrences of the first form, I noticed rustc does not treat them equally. A minimal test shows this easily:
And it all works if I compile world.rs as a lib and then compile main.rs passing -L . to rustc. If I change the first line in main.rs to extern mod w = "world", it does not work ("can't find crate for 'w')".
While trying to find out if the two forms should be equivalent I looked at view items in the manual; by the specification there maybe the two forms are not meant to be equivalent, but I was informed on IRC that this is probably a rustc bug, so I'm filing it.
The text was updated successfully, but these errors were encountered:
After some investigation, I found out that the 'extern mod foo(name="bar")' form creates a view item with attached metaitem having key "name" and value "bar". The 'extern mod foo = "bar"' form creates a view item with two metaitems, one with key "name" and value "bar", and other with key "package_id" and also value "bar". This happens in rustc::metadata::creader, function visit_view_item, and it appends the whole path as package_id and only the filestem as name, but in this case both are equal. So in rustc::metadata::loader, find_library_crate_aux finds the crate to load but metadata_matches requires the "package_id" metaitem to be present in the "bar" crate.
I confirmed this with my above example by adding 'package_id="world"' item in the link attribute above (world.rs), and it worked even with 'extern mod w = "world"' in main.rs.
So this amounts to the "package_id" being mandatory in external crates.
…=Alexendoo
Mark uninlined_format_args as pedantic
Fixesrust-lang/rust-clippy#10087
We should restore this when rust-analyzer support gets better. Worth filing an issue to track.
changelog: Mark [`uninlined_format_args`] as `pedantic`
I'm trying to tackle #9543 but under the impression that 'extern mod foo(name = "bar")' should be equivalent to 'extern mod foo = "bar"'. After trying to change occurrences of the first form, I noticed rustc does not treat them equally. A minimal test shows this easily:
This is used by
And it all works if I compile world.rs as a lib and then compile main.rs passing -L . to rustc. If I change the first line in main.rs to extern mod w = "world", it does not work ("can't find crate for 'w')".
While trying to find out if the two forms should be equivalent I looked at view items in the manual; by the specification there maybe the two forms are not meant to be equivalent, but I was informed on IRC that this is probably a rustc bug, so I'm filing it.
The text was updated successfully, but these errors were encountered: