-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Make ItemKind::ExternCrate looks like hir::ItemKind::ExternCrate to make transition over hir::ItemKind simpler #80845
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
Conversation
☔ The latest upstream changes (presumably #80802) made this pull request unmergeable. Please resolve the merge conflicts. |
…ields, r=ollie27 Remove some function fields Same kind as rust-lang#80845. This PR removes the `all_types` and `ret_types` from the `clean::Function` type. Another change that I had to do was implementing the `From` trait to be able to convert `hir::def::DefKind` into `clean::TypeKind` without requiring `DocContext` (and so I updated the `clean` method so that it's taken into account). The last two commits improve a bit the `get_real_types` function and the `Type::generics` method. r? `@jyn514`
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.
I like the idea but the implementation needs some work.
0164171
to
d5515ad
Compare
Updated. |
Ping @jyn514 |
c547676
to
4c70372
Compare
I'll go forward with this then! If you want the test back, don't hesitate to ask (either before after it's merged). @bors: r=jyn514 |
📌 Commit 4c70372 has been approved by |
…, r=jyn514 Make ItemKind::ExternCrate looks like hir::ItemKind::ExternCrate to make transition over hir::ItemKind simpler It was surprisingly difficult to make this change, mostly because of two issues: * We now store the `ExternCrate` name in the parent struct (`clean::Item`), which forced me to modify the json conversion code a bit more than expected. * The second problem was that, since we now have a `Some(name)`, it was trying to render it, ending up in a panic because we ended up in a `unreachable` statement. The solution was simply to add `!item.is_extern_crate()` in `formats::renderer` before calling `cx.item(item, &cache)?;`. I'll continue to replace all the `clean::ItemKind` variants one by one until it looks exactly like `hir::ItemKind`. Then we'll simply discard the rustdoc type. Once this done, we'll be able to discard `clean::Item` too to use `hir::Item`. r? `@jyn514`
…, r=jyn514 Make ItemKind::ExternCrate looks like hir::ItemKind::ExternCrate to make transition over hir::ItemKind simpler It was surprisingly difficult to make this change, mostly because of two issues: * We now store the `ExternCrate` name in the parent struct (`clean::Item`), which forced me to modify the json conversion code a bit more than expected. * The second problem was that, since we now have a `Some(name)`, it was trying to render it, ending up in a panic because we ended up in a `unreachable` statement. The solution was simply to add `!item.is_extern_crate()` in `formats::renderer` before calling `cx.item(item, &cache)?;`. I'll continue to replace all the `clean::ItemKind` variants one by one until it looks exactly like `hir::ItemKind`. Then we'll simply discard the rustdoc type. Once this done, we'll be able to discard `clean::Item` too to use `hir::Item`. r? ``@jyn514``
@bors r- You didn't fix the panic:
|
Good catch, thanks! |
4c70372
to
ed50563
Compare
@jyn514: I went for what you suggested: I now pass the |
☔ The latest upstream changes (presumably #82777) made this pull request unmergeable. Please resolve the merge conflicts. |
…ake transition over hir::ItemKind simpler
ed50563
to
286a357
Compare
Fixed the issue, so let's go! @bors: r=jyn514 |
📌 Commit 286a357 has been approved by |
…, r=jyn514 Make ItemKind::ExternCrate looks like hir::ItemKind::ExternCrate to make transition over hir::ItemKind simpler It was surprisingly difficult to make this change, mostly because of two issues: * We now store the `ExternCrate` name in the parent struct (`clean::Item`), which forced me to modify the json conversion code a bit more than expected. * The second problem was that, since we now have a `Some(name)`, it was trying to render it, ending up in a panic because we ended up in a `unreachable` statement. The solution was simply to add `!item.is_extern_crate()` in `formats::renderer` before calling `cx.item(item, &cache)?;`. I'll continue to replace all the `clean::ItemKind` variants one by one until it looks exactly like `hir::ItemKind`. Then we'll simply discard the rustdoc type. Once this done, we'll be able to discard `clean::Item` too to use `hir::Item`. r? `@jyn514`
ExternCrateItem { ref src } => ItemEnum::ExternCrateItem { | ||
name: name.as_ref().unwrap().to_string(), | ||
rename: src.map(|x| x.to_string()), | ||
}, |
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.
Yup, this is what I was expecting, thanks :)
…laumeGomez Rollup of 7 pull requests Successful merges: - rust-lang#80845 (Make ItemKind::ExternCrate looks like hir::ItemKind::ExternCrate to make transition over hir::ItemKind simpler) - rust-lang#82708 (Warn on `#![doc(test(...))]` on items other than the crate root and use future incompatible lint) - rust-lang#82714 (Detect match arm body without braces) - rust-lang#82736 (Bump optimization from mir_opt_level 2 to 3 and 3 to 4 and make "release" be level 2 by default) - rust-lang#82782 (Make rustc shim's verbose output include crate_name being compiled.) - rust-lang#82797 (Update tests names to start with `issue-`) - rust-lang#82809 (rustdoc: Use substrings instead of split to grab enum variant paths) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
It was surprisingly difficult to make this change, mostly because of two issues:
ExternCrate
name in the parent struct (clean::Item
), which forced me to modify the json conversion code a bit more than expected.Some(name)
, it was trying to render it, ending up in a panic because we ended up in aunreachable
statement. The solution was simply to add!item.is_extern_crate()
informats::renderer
before callingcx.item(item, &cache)?;
.I'll continue to replace all the
clean::ItemKind
variants one by one until it looks exactly likehir::ItemKind
. Then we'll simply discard the rustdoc type. Once this done, we'll be able to discardclean::Item
too to usehir::Item
.r? @jyn514