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

Get rid of clean::{Method, TyMethod} #79125

Merged
merged 2 commits into from
Nov 17, 2020
Merged

Conversation

jyn514
Copy link
Member

@jyn514 jyn514 commented Nov 17, 2020

They're redundant and almost the same as clean::Function.

I needed this for #78082, although I forget why.

r? @GuillaumeGomez

It's the same as clean::Function.
Replace it instead with `(clean::Function, Option<hir::Defaultness>)`.
@jyn514 jyn514 added C-cleanup Category: PRs that clean code up or issues documenting cleanup. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Nov 17, 2020
@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Nov 17, 2020
@jyn514
Copy link
Member Author

jyn514 commented Nov 17, 2020

Here's why I needed it for doctree:

error[E0308]: mismatched types
    --> src/librustdoc/html/render/mod.rs:1771:92
     |
1769 |     match item.kind {
     |           --------- this expression has type `types::ItemKind`
1770 |         clean::ModuleItem(ref m) => item_module(buf, cx, item, &m.items),
1771 |         clean::FunctionItem(ref f) | clean::ForeignFunctionItem(ref f) | clean::MethodItem(ref f) | clean::TyMethodItem(ref f) => {
     |                             ----- first introduced with type `&types::Function` here       ^^^^^ expected struct `types::Function`, found struct `types::Method`
     |
     = note: in the same arm, a binding must have the same type in all alternatives

Don't ask me why I need to match both of these in the same pattern, without this #78082 ICEs. UPDATE: It turns out this is because doctree was throwing away item names?

} else if item.name.is_some() {
cx.item(item, &cache)?;

@GuillaumeGomez
Copy link
Member

Nice, thanks!

@bors: r+

@bors
Copy link
Contributor

bors commented Nov 17, 2020

📌 Commit 2a991e1 has been approved by GuillaumeGomez

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Nov 17, 2020
bors added a commit to rust-lang-ci/rust that referenced this pull request Nov 17, 2020
Rollup of 8 pull requests

Successful merges:

 - rust-lang#74293 (Rustdoc test compiler output color)
 - rust-lang#78702 ([self-profiling] Include the estimated size of each cgu in the profile)
 - rust-lang#79069 (Get rid of `highlight::Class::None`)
 - rust-lang#79072 (Fix exhaustiveness in case a byte string literal is used at slice type)
 - rust-lang#79120 (update rustfmt to v1.4.27)
 - rust-lang#79125 (Get rid of clean::{Method, TyMethod})
 - rust-lang#79126 (Remove duplicate `Trait::auto` field)
 - rust-lang#79130 (extend macro braces test)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 3d63f25 into rust-lang:master Nov 17, 2020
@rustbot rustbot added this to the 1.50.0 milestone Nov 17, 2020
@jyn514 jyn514 deleted the fewer-types branch November 17, 2020 17:51
m-ou-se added a commit to m-ou-se/rust that referenced this pull request Dec 1, 2020
…illaumeGomez

Rustdoc: JSON backend experimental impl, with new tests.

Based on rust-lang#75114 by `@P1n3appl3`

The first commit is all of rust-lang#75114, but squased to 1 commit, as that was much easier to rebase onto master.

The git history is a mess, but I think I'll edit it after review, so it's obvious whats new.

## Still to do

- [ ] Update docs.
- [ ] Add bless option to tests.
- [ ] Add test option for multiple files in same crate.
- [ ] Decide if the tests should check for json to be equal or subset.
- [ ] Go through the rest of the review for the original pr. (This is open because the test system is done(ish), but stuff like [not using a hashmap](rust-lang#75114 (comment)) and [using `CRATE_DEF_INDEX` ](rust-lang#75114 (comment)) hasn't)

I'm also sure how many of these we need to do before landing on nightly, as it would be nice to get this in tree, so it isn't effected by churn like rust-lang#79125, rust-lang#79041, rust-lang#79061

r? `@jyn514`
bors added a commit to rust-lang-ci/rust that referenced this pull request Dec 2, 2020
Rustdoc: JSON backend experimental impl, with new tests.

Based on rust-lang#75114 by `@P1n3appl3`

The first commit is all of rust-lang#75114, but squased to 1 commit, as that was much easier to rebase onto master.

The git history is a mess, but I think I'll edit it after review, so it's obvious whats new.

## Still to do

- [ ] Update docs.
- [ ] Add bless option to tests.
- [ ] Add test option for multiple files in same crate.
- [ ] Decide if the tests should check for json to be equal or subset.
- [ ] Go through the rest of the review for the original pr. (This is open because the test system is done(ish), but stuff like [not using a hashmap](rust-lang#75114 (comment)) and [using `CRATE_DEF_INDEX` ](rust-lang#75114 (comment)) hasn't)

I'm also sure how many of these we need to do before landing on nightly, as it would be nice to get this in tree, so it isn't effected by churn like rust-lang#79125, rust-lang#79041, rust-lang#79061

r? `@jyn514`
@jyn514 jyn514 changed the title Get rid of clean::{Method, TyMethod} Get rid of clean::{Method, TyMethod} Jan 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-cleanup Category: PRs that clean code up or issues documenting cleanup. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants