<feed xmlns='http://www.w3.org/2005/Atom'>
<title>rust/src/librustdoc/html/render/span_map.rs, branch try</title>
<subtitle>https://github.com/rust-lang/rust
</subtitle>
<id>http://git.dreamy.place/mirrors/rust/atom?h=try</id>
<link rel='self' href='http://git.dreamy.place/mirrors/rust/atom?h=try'/>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/'/>
<updated>2025-04-01T23:00:46+00:00</updated>
<entry>
<title>Move methods from `Map` to `TyCtxt`, part 5.</title>
<updated>2025-04-01T23:00:46+00:00</updated>
<author>
<name>Nicholas Nethercote</name>
<email>n.nethercote@gmail.com</email>
</author>
<published>2025-04-01T20:04:24+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=6713f34ee4f0ef669f8860b7f8ab1442440071b3'/>
<id>urn:sha1:6713f34ee4f0ef669f8860b7f8ab1442440071b3</id>
<content type='text'>
This eliminates all methods on `Map`. Actually removing `Map` will occur
in a follow-up PR.
</content>
</entry>
<entry>
<title>Move `hir::Item::ident` into `hir::ItemKind`.</title>
<updated>2025-03-17T19:29:50+00:00</updated>
<author>
<name>Nicholas Nethercote</name>
<email>n.nethercote@gmail.com</email>
</author>
<published>2025-03-06T08:07:36+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=f2ddbcd24b3e71a2c919721f854043f1bb81ff79'/>
<id>urn:sha1:f2ddbcd24b3e71a2c919721f854043f1bb81ff79</id>
<content type='text'>
`hir::Item` has an `ident` field.

- It's always non-empty for these item kinds: `ExternCrate`, `Static`,
  `Const`, `Fn`, `Macro`, `Mod`, `TyAlias`, `Enum`, `Struct`, `Union`,
  Trait`, TraitAalis`.

- It's always empty for these item kinds: `ForeignMod`, `GlobalAsm`,
  `Impl`.

- For `Use`, it is non-empty for `UseKind::Single` and empty for
  `UseKind::{Glob,ListStem}`.

All of this is quite non-obvious; the only documentation is a single
comment saying "The name might be a dummy name in case of anonymous
items". Some sites that handle items check for an empty ident, some
don't. This is a very C-like way of doing things, but this is Rust, we
have sum types, we can do this properly and never forget to check for
the exceptional case and never YOLO possibly empty identifiers (or
possibly dummy spans) around and hope that things will work out.

The commit is large but it's mostly obvious plumbing work. Some notable
things.

- A similar transformation makes sense for `ast::Item`, but this is
  already a big change. That can be done later.

- Lots of assertions are added to item lowering to ensure that
  identifiers are empty/non-empty as expected. These will be removable
  when `ast::Item` is done later.

- `ItemKind::Use` doesn't get an `Ident`, but `UseKind::Single` does.

- `lower_use_tree` is significantly simpler. No more confusing `&amp;mut
  Ident` to deal with.

- `ItemKind::ident` is a new method, it returns an `Option&lt;Ident&gt;`. It's
  used with `unwrap` in a few places; sometimes it's hard to tell
  exactly which item kinds might occur. None of these unwraps fail on
  the test suite. It's conceivable that some might fail on alternative
  input. We can deal with those if/when they happen.

- In `trait_path` the `find_map`/`if let` is replaced with a loop, and
  things end up much clearer that way.

- `named_span` no longer checks for an empty name; instead the call site
  now checks for a missing identifier if necessary.

- `maybe_inline_local` doesn't need the `glob` argument, it can be
  computed in-function from the `renamed` argument.

- `arbitrary_source_item_ordering::check_mod` had a big `if` statement
  that was just getting the ident from the item kinds that had one. It
  could be mostly replaced by a single call to the new `ItemKind::ident`
  method.

- `ItemKind` grows from 56 to 64 bytes, but `Item` stays the same size,
  and that's what matters, because `ItemKind` only occurs within `Item`.
</content>
</entry>
<entry>
<title>Implement `#[define_opaque]` attribute for functions.</title>
<updated>2025-03-11T12:05:02+00:00</updated>
<author>
<name>Oli Scherer</name>
<email>git-spam-no-reply9815368754983@oli-obk.de</email>
</author>
<published>2024-07-26T10:04:02+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=cb4751d4b87e1c8ebdeb381abe3785486a59968e'/>
<id>urn:sha1:cb4751d4b87e1c8ebdeb381abe3785486a59968e</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Rollup merge of #138150 - nnethercote:streamline-intravisit-visit_id, r=oli-obk</title>
<updated>2025-03-07T18:15:36+00:00</updated>
<author>
<name>Matthias Krüger</name>
<email>476013+matthiaskrgr@users.noreply.github.com</email>
</author>
<published>2025-03-07T18:15:36+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=b772fa616538a8be21a3424dee049401e7776b7f'/>
<id>urn:sha1:b772fa616538a8be21a3424dee049401e7776b7f</id>
<content type='text'>
Streamline HIR intravisit `visit_id` calls for items

A small clean up.
</content>
</entry>
<entry>
<title>Move `visit_id` calls.</title>
<updated>2025-03-07T08:35:41+00:00</updated>
<author>
<name>Nicholas Nethercote</name>
<email>n.nethercote@gmail.com</email>
</author>
<published>2025-03-07T06:02:33+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=872ac73f59465ccaf63f74fd12785c583d3aa0a6'/>
<id>urn:sha1:872ac73f59465ccaf63f74fd12785c583d3aa0a6</id>
<content type='text'>
In `walk_item`, we call `visit_id` on every item kind. For most of them
we do it directly in `walk_item`. But for `ItemKind::Mod`,
`ItemKind::Enum`, and `ItemKind::Use` we instead do it in the `walk_*`
function called (via the `visit_*` function) from `walk_item`.

I can see no reason for this inconsistency, so this commit makes those
three cases like all the other cases, moving the `visit_id` calls into
`walk_item`. This also avoids the need for a few `HirId` arguments.
</content>
</entry>
<entry>
<title>`librustdoc`: flatten nested ifs</title>
<updated>2025-03-06T08:16:28+00:00</updated>
<author>
<name>Yotam Ofek</name>
<email>yotam.ofek@gmail.com</email>
</author>
<published>2025-03-06T07:59:11+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=fde37335aab7df1f9fcdfb0f5079ba76e56d7fe1'/>
<id>urn:sha1:fde37335aab7df1f9fcdfb0f5079ba76e56d7fe1</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Make asm a named field</title>
<updated>2025-02-22T00:05:09+00:00</updated>
<author>
<name>Michael Goulet</name>
<email>michael@errs.io</email>
</author>
<published>2025-02-17T05:33:06+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=2a6daaf89a12dcb3467b057ec1a3d539623cd32c'/>
<id>urn:sha1:2a6daaf89a12dcb3467b057ec1a3d539623cd32c</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Move methods from `Map` to `TyCtxt`, part 2.</title>
<updated>2025-02-17T23:17:44+00:00</updated>
<author>
<name>Nicholas Nethercote</name>
<email>n.nethercote@gmail.com</email>
</author>
<published>2025-02-17T03:17:57+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=fd7b4bf4e19b19ebf9b536790ec1668a3e50fe6f'/>
<id>urn:sha1:fd7b4bf4e19b19ebf9b536790ec1668a3e50fe6f</id>
<content type='text'>
Continuing the work started in #136466.

Every method gains a `hir_` prefix, though for the ones that already
have a `par_` or `try_par_` prefix I added the `hir_` after that.
</content>
</entry>
<entry>
<title>Overhaul the `intravisit::Map` trait.</title>
<updated>2025-02-17T02:21:35+00:00</updated>
<author>
<name>Nicholas Nethercote</name>
<email>n.nethercote@gmail.com</email>
</author>
<published>2025-02-03T03:42:01+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=661f99ba03738f1ee87888342aef920f3c0f7f48'/>
<id>urn:sha1:661f99ba03738f1ee87888342aef920f3c0f7f48</id>
<content type='text'>
First of all, note that `Map` has three different relevant meanings.
- The `intravisit::Map` trait.
- The `map::Map` struct.
- The `NestedFilter::Map` associated type.

The `intravisit::Map` trait is impl'd twice.
- For `!`, where the methods are all unreachable.
- For `map::Map`, which gets HIR stuff from the `TyCtxt`.

As part of getting rid of `map::Map`, this commit changes `impl
intravisit::Map for map::Map` to `impl intravisit::Map for TyCtxt`. It's
fairly straightforward except various things are renamed, because the
existing names would no longer have made sense.

- `trait intravisit::Map` becomes `trait intravisit::HirTyCtxt`, so named
  because it gets some HIR stuff from a `TyCtxt`.
- `NestedFilter::Map` assoc type becomes `NestedFilter::MaybeTyCtxt`,
  because it's always `!` or `TyCtxt`.
- `Visitor::nested_visit_map` becomes `Visitor::maybe_tcx`.

I deliberately made the new trait and associated type names different to
avoid the old `type Map: Map` situation, which I found confusing. We now
have `type MaybeTyCtxt: HirTyCtxt`.
</content>
</entry>
<entry>
<title>Eliminate PatKind::Path</title>
<updated>2025-01-29T15:45:13+00:00</updated>
<author>
<name>Oli Scherer</name>
<email>github333195615777966@oli-obk.de</email>
</author>
<published>2024-12-12T10:37:37+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=f47ad710595c1d87daa8f6b67045574c7304f83e'/>
<id>urn:sha1:f47ad710595c1d87daa8f6b67045574c7304f83e</id>
<content type='text'>
</content>
</entry>
</feed>
