Skip to content

rustdoc: Fix search links to enums/typedefs#14101

Closed
alexcrichton wants to merge 1 commit intorust-lang:masterfrom
alexcrichton:issue-14095
Closed

rustdoc: Fix search links to enums/typedefs#14101
alexcrichton wants to merge 1 commit intorust-lang:masterfrom
alexcrichton:issue-14095

Conversation

@alexcrichton
Copy link
Member

When the values in html::item_type were updated, the JS definitions were
accidentally not updated as well.

Closes #14095

When the values in html::item_type were updated, the JS definitions were
accidentally not updated as well.

Closes rust-lang#14095
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't actually know what this JS is for, but should it really have two entries called "type"?

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok I looked at it and I think the answer is "yes". The index here matches a discriminant, so you're mapping both Enum and Typedef to the same name "type".

Copy link
Member Author

Choose a reason for hiding this comment

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

Unfortunately, the Def enum in the ast uses DefTy for both enums and typedefs. Instead of refactoring the whole compiler, I figured I'd just use the same pattern (for better or for worse).

We're guaranteed that they'll never clash because they're in the same namespace (resolve checks that)

bors added a commit that referenced this pull request May 11, 2014
When the values in html::item_type were updated, the JS definitions were
accidentally not updated as well.

Closes #14095
@bors bors closed this May 11, 2014
@alexcrichton alexcrichton deleted the issue-14095 branch May 11, 2014 18:20
flip1995 pushed a commit to flip1995/rust that referenced this pull request Feb 20, 2025
- `reindent_multiline()` always returns the result of
`reindent_multiline_inner()` which returns a `String`. Make
`reindent_multiline()` return a `String` as well, instead of a
systematically owned `Cow<'_, str>`.
- There is no reason for `reindent_multiline()` to force a caller to
build a `Cow<'_, str>` instead of passing a `&str` directly, especially
considering that a `String` will always be returned.

Also, both the input parameter and return value (of type `Cow<'_, str>`)
shared the same (elided) lifetime for no reason: this worked only
because the result was always the `Cow::Owned` variant which is
compatible with any lifetime.

As a consequence, the signature changes from:

```rust
fn reindent_multiline(s: Cow<'_, str>, …) -> Cow<'_, str> { … }
```

to

```rust
fn reindent_multiline(s: &str, …) -> String { … }
```

changelog: none
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.

rustdoc search enum links are broken

3 participants