about summary refs log tree commit diff
path: root/compiler/rustc_ast/src/ptr.rs
AgeCommit message (Collapse)AuthorLines
2025-08-09remove `P`Deadbeef-11/+0
2025-05-27Reduce `P<T>` to a typedef of `Box<T>`.Nicholas Nethercote-75/+5
Keep the `P` constructor function for now, to minimize immediate churn. All the `into_inner` calls are removed, which is nice.
2025-05-27Remove unused `P` stuff.Nicholas Nethercote-42/+2
2025-05-27Remove support for `P<[T]>`.Nicholas Nethercote-78/+1
It's no longer used.
2025-05-27Remove `P::map`.Nicholas Nethercote-11/+0
It's barely used, and the places that use it are better if they don't.
2025-05-27Remove `'static` bounds on `P`.Nicholas Nethercote-4/+4
These date back to 2014. I don't think they're needed any more.
2024-12-31Convert some Into impls into From implsMichael Goulet-3/+3
2024-07-29Reformat `use` declarations.Nicholas Nethercote-2/+1
The previous commit updated `rustfmt.toml` appropriately. This commit is the outcome of running `x fmt --all` with the new formatting options.
2024-05-20Implement BOXED_SLICE_INTO_ITERMichael Goulet-1/+1
2024-04-03rustc_ast: Update `P<T>` docs to reflect mutable status.Alona Enraght-Moony-9/+7
`P<T>` has implemented `DerefMut` since #54277. While this was lamented at the time [1], rustc now relies on it extensively via the many implementors of MutVisitor [2]. Updates the docs to reflect that `P<T>` is fundamentally mutable, and a few other cleanups to make them nicer to browse. [1]: https://github.com/rust-lang/rust/pull/54277#discussion_r257181754 [2]: https://doc.rust-lang.org/1.77.1/nightly-rustc/rustc_ast/mut_visit/trait.MutVisitor.html#implementors
2023-04-16make rustc compilableDeadbeef-1/+2
2022-12-10compiler: remove unnecessary imports and qualified pathsKaDiWa-1/+0
2022-06-08Use delayed error handling for `Encodable` and `Encoder` infallible.Nicholas Nethercote-4/+4
There are two impls of the `Encoder` trait: `opaque::Encoder` and `opaque::FileEncoder`. The former encodes into memory and is infallible, the latter writes to file and is fallible. Currently, standard `Result`/`?`/`unwrap` error handling is used, but this is a bit verbose and has non-trivial cost, which is annoying given how rare failures are (especially in the infallible `opaque::Encoder` case). This commit changes how `Encoder` fallibility is handled. All the `emit_*` methods are now infallible. `opaque::Encoder` requires no great changes for this. `opaque::FileEncoder` now implements a delayed error handling strategy. If a failure occurs, it records this via the `res` field, and all subsequent encoding operations are skipped if `res` indicates an error has occurred. Once encoding is complete, the new `finish` method is called, which returns a `Result`. In other words, there is now a single `Result`-producing method instead of many of them. This has very little effect on how any file errors are reported if `opaque::FileEncoder` has any failures. Much of this commit is boring mechanical changes, removing `Result` return values and `?` or `unwrap` from expressions. The more interesting parts are as follows. - serialize.rs: The `Encoder` trait gains an `Ok` associated type. The `into_inner` method is changed into `finish`, which returns `Result<Vec<u8>, !>`. - opaque.rs: The `FileEncoder` adopts the delayed error handling strategy. Its `Ok` type is a `usize`, returning the number of bytes written, replacing previous uses of `FileEncoder::position`. - Various methods that take an encoder now consume it, rather than being passed a mutable reference, e.g. `serialize_query_result_cache`.
2022-05-20typoTshepang Lekhonkhobe-1/+1
2022-04-11Use const Box::default in P::<[T]>::newJosh Stone-8/+1
2022-01-22Make `Decodable` and `Decoder` infallible.Nicholas Nethercote-4/+4
`Decoder` has two impls: - opaque: this impl is already partly infallible, i.e. in some places it currently panics on failure (e.g. if the input is too short, or on a bad `Result` discriminant), and in some places it returns an error (e.g. on a bad `Option` discriminant). The number of places where either happens is surprisingly small, just because the binary representation has very little redundancy and a lot of input reading can occur even on malformed data. - json: this impl is fully fallible, but it's only used (a) for the `.rlink` file production, and there's a `FIXME` comment suggesting it should change to a binary format, and (b) in a few tests in non-fundamental ways. Indeed #85993 is open to remove it entirely. And the top-level places in the compiler that call into decoding just abort on error anyway. So the fallibility is providing little value, and getting rid of it leads to some non-trivial performance improvements. Much of this commit is pretty boring and mechanical. Some notes about a few interesting parts: - The commit removes `Decoder::{Error,error}`. - `InternIteratorElement::intern_with`: the impl for `T` now has the same optimization for small counts that the impl for `Result<T, E>` has, because it's now much hotter. - Decodable impls for SmallVec, LinkedList, VecDeque now all use `collect`, which is nice; the one for `Vec` uses unsafe code, because that gave better perf on some benchmarks.
2021-08-18Remove box syntax from rustc_astest31-1/+1
2020-08-30mv compiler to compiler/mark-0/+219