-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
Fix json reexports of different items with same name #107766
Fix json reexports of different items with same name #107766
Conversation
This comment has been minimized.
This comment has been minimized.
Fixed the bad primitive change I made. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rustbot author
#[allow(non_snake_case)] | ||
pub fn Foo() {} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could this test be expanded a bit more? I'd like to see it checking that their are items for both Foo
s, and that each name imports both of the foo items (instead of just checking that their are two imports with each name).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Eg:
#![feature(no_core)]
#![no_core]
pub mod nested {
// @set foo_struct = "$.index[*][?(@.docs == 'Foo the struct')].id"
/// Foo the struct
pub struct Foo {}
// @set foo_fn = "$.index[*][?(@.docs == 'Foo the function')].id"
#[allow(non_snake_case)]
/// Foo the function
pub fn Foo() {}
}
// @ismany "$.index[*][?(@.inner.name == 'Foo' && @.kind == 'import')].inner.id" $foo_fn $foo_struct
// @ismany "$.index[*][?(@.inner.name == 'Bar' && @.kind == 'import')].inner.id" $foo_fn $foo_struct
// @count "$.index[*][?(@.inner.name == 'Foo' && @.kind == 'import')]" 2
pub use nested::Foo;
// @count "$.index[*][?(@.inner.name == 'Bar' && @.kind == 'import')]" 2
pub use Foo as Bar;
Looking at the output (of "index": {
"0:0:1588": {
"crate_id": 0,
"docs": null,
"id": "0:0:1588",
"inner": {
"is_crate": true,
"is_stripped": false,
"items": [
"0:1:1582",
"0:4-0:2:1584",
"0:4-0:3:1584",
"0:4-0:2:1584",
"0:4-0:3:1584",
"0:5-0:2:1584",
"0:5-0:3:1584",
"0:5-0:2:1584",
"0:5-0:3:1584"
]
},
"kind": "module",
"name": "same_name_different_types"
}, I'm not really sure whats causing this, but idealy it wouldn't happen, although I'd be willing to merge as is, as long as an issue gets created to follow up. (Also, jsondoclint should probably catch this) |
b1b003b
to
1ae875f
Compare
I think it's better to fix it in another PR since this one is already quite big. We can fix it easily by having a |
And also: updated. |
@bors r+ |
…llaumeGomez Rollup of 5 pull requests Successful merges: - rust-lang#107766 (Fix json reexports of different items with same name) - rust-lang#108129 (Correctly handle links starting with whitespace) - rust-lang#108188 (Change src/etc/vscode_settings.json to always treat ./library as the sysroot source) - rust-lang#108203 (Fix RPITITs in default trait methods (by assuming projection predicates in param-env)) - rust-lang#108212 (Download rustfmt regardless of rustc being set in config.toml) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Fixes #107677.
I renamed
from_item_id*
functions intoid_from_item
instead because it makes more sense now. I also simplified the logic around it a bit so that theids
function will now directly pass&clean::Item
toid_from_item
and the ID will be consistently generated (it caused an issue when I updated the ID for imports).So now, the big change of this PR: I changed how imports' ID is generated: it now includes the target item's ID at the end of the ID. It's to prevent two reexported items with the same name (but different types).
r? @aDotInTheVoid