about summary refs log tree commit diff
path: root/src/tools
AgeCommit message (Collapse)AuthorLines
2023-12-22Update cargoWeihang Lo-0/+0
2023-12-22Auto merge of #118847 - eholk:for-await, r=compiler-errorsbors-20/+47
Add support for `for await` loops This adds support for `for await` loops. This includes parsing, desugaring in AST->HIR lowering, and adding some support functions to the library. Given a loop like: ```rust for await i in iter { ... } ``` this is desugared to something like: ```rust let mut iter = iter.into_async_iter(); while let Some(i) = loop { match core::pin::Pin::new(&mut iter).poll_next(cx) { Poll::Ready(i) => break i, Poll::Pending => yield, } } { ... } ``` This PR also adds a basic `IntoAsyncIterator` trait. This is partly for symmetry with the way `Iterator` and `IntoIterator` work. The other reason is that for async iterators it's helpful to have a place apart from the data structure being iterated over to store state. `IntoAsyncIterator` gives us a good place to do this. I've gated this feature behind `async_for_loop` and opened #118898 as the feature tracking issue. r? `@compiler-errors`
2023-12-22Auto merge of #119163 - fmease:refactor-ast-trait-bound-modifiers, ↵bors-20/+11
r=compiler-errors Refactor AST trait bound modifiers Instead of having two types to represent trait bound modifiers in the parser / the AST (`parser::ty::BoundModifiers` & `ast::TraitBoundModifier`), only to map one to the other later, just use `parser::ty::BoundModifiers` (moved & renamed to `ast::TraitBoundModifiers`). The struct type is more extensible and easier to deal with (see [here](https://github.com/rust-lang/rust/pull/119099/files#r1430749981) and [here](https://github.com/rust-lang/rust/pull/119099/files#r1430752116) for context) since it more closely models what it represents: A compound of two kinds of modifiers, constness and polarity. Modeling this as an enum (the now removed `ast::TraitBoundModifier`) meant one had to add a new variant per *combination* of modifier kind, which simply isn't scalable and which lead to a lot of explicit non-DRY matches. NB: `hir::TraitBoundModifier` being an enum is fine since HIR doesn't need to worry representing invalid modifier kind combinations as those get rejected during AST validation thereby immensely cutting down the number of possibilities.
2023-12-20Rollup merge of #119145 - aDotInTheVoid:variantdata-struct-struct, ↵Matthias Krüger-10/+12
r=compiler-errors Give `VariantData::Struct` named fields, to clairfy `recovered`. Implements https://github.com/rust-lang/rust/pull/119121#discussion_r1431467066. Supersedes #119121 This way, it's clear what the bool fields means, instead of having to find where it's generated. Changes both ast and hir. r? `@compiler-errors`
2023-12-20Refactor AST trait bound modifiersLeón Orell Valerian Liehr-20/+11
2023-12-20Auto merge of #119037 - RalfJung:repr-c-abi-mismatch, r=scottmcmbors-0/+33
do not allow ABI mismatches inside repr(C) types In https://github.com/rust-lang/rust/pull/115476 we allowed ABI mismatches inside `repr(C)` types. This wasn't really discussed much; I added it because from how I understand calling conventions, this should actually be safe in practice. However I entirely forgot to actually allow this in Miri, and in the mean time I have learned that too much ABI compatibility can be a problem for CFI (it can reject fewer calls so that gives an attacker more room to play with). So I propose we take back that part about ABI compatibility in `repr(C)`. It is anyway something that C and C++ do not allow, as far as I understand. In the future we might want to introduce a class of ABI compatibilities where we say "this is a bug and it may lead to aborting the process, but it won't lead to arbitrary misbehavior -- worst case it'll just transmute the arguments from the caller type to the callee type". That would give CFI leeway to reject such calls without introducing the risk of arbitrary UB. (The UB can still happen if the transmute leads to bad results, of course, but it wouldn't be due to ABI weirdness.) #115476 hasn't reached beta yet so if we land this before Dec 22nd we can just pretend this all never happened. ;) Otherwise we should do a beta backport (of the docs change at least). Cc `@rust-lang/opsem` `@rust-lang/types`
2023-12-20Give `VariantData::Struct` named fields, to clairfy `recovered`.Alona Enraght-Moony-10/+12
2023-12-19Plumb awaitness of for loopsEric Holk-20/+47
2023-12-19Auto merge of #118842 - Nadrieril:librarify-further, r=compiler-errorsbors-0/+1
Make exhaustiveness usable outside of rustc With this PR, `rustc_pattern_analysis` compiles on stable (with the `stable` feature)! `rust-analyzer` will be able to use it to provide match-related diagnostics and refactors. Two questions: - Should I name the feature `nightly` instead of `rustc` for consistency with other crates? `rustc` makes more sense imo. - `typed-arena` is an optional dependency but tidy made me add it to the allow-list anyway. Can I avoid that somehow? r? `@compiler-errors`
2023-12-18Auto merge of #119070 - lnicola:sync-from-ra, r=lnicolabors-476/+1079
Subtree update of `rust-analyzer`
2023-12-18Merge commit '21b06c1beb9bb59369ffd652f5d617bcf6952e05' into sync-from-raLaurențiu Nicola-476/+1079
2023-12-18Auto merge of #119063 - nnethercote:dcx, r=compiler-errorsbors-38/+38
Consistent `Handler` naming This PR implements the renaming described in https://github.com/rust-lang/compiler-team/issues/699. r? `@compiler-errors`
2023-12-18Rename many `DiagCtxt` and `EarlyDiagCtxt` locals.Nicholas Nethercote-11/+11
2023-12-18Rename many `EarlyDiagCtxt` arguments.Nicholas Nethercote-4/+4
2023-12-18Rename `default_handler` as `default_dcx`.Nicholas Nethercote-2/+2
2023-12-18Rename `ParseSess::with_span_handler` as `ParseSess::with_dcx`.Nicholas Nethercote-3/+3
2023-12-18Rename `Session::span_diagnostic` as `Session::dcx`.Nicholas Nethercote-3/+3
2023-12-18Rename `ParseSess::span_diagnostic` as `ParseSess::dcx`.Nicholas Nethercote-11/+11
2023-12-18Rename `EarlyErrorHandler` as `EarlyDiagCtxt`.Nicholas Nethercote-8/+8
2023-12-18Rename `Handler` as `DiagCtxt`.Nicholas Nethercote-6/+6
2023-12-17Update cargoWeihang Lo-0/+0
2023-12-17Auto merge of #119039 - RalfJung:miri, r=RalfJungbors-354/+491
Miri subtree update r? `@ghost`
2023-12-17do not allow ABI mismatches inside repr(C) typesRalf Jung-0/+33
2023-12-17Auto merge of #119001 - notriddle:notriddle/searchwords, r=GuillaumeGomezbors-3/+3
rustdoc-search: remove parallel searchWords array This might have made sense if the algorithm could use `searchWords` to skip having to look at `searchIndex`, but since it always does a substring check on both the stock word and the normalizedName, it doesn't seem to help performance anyway. Profile: http://notriddle.com/rustdoc-html-demo-8/searchwords/index.html
2023-12-17Auto merge of #118830 - GuillaumeGomez:env-tracked_env, r=Nilstriebbors-0/+4
Add support for `--env` on `tracked_env::var` Follow-up of https://github.com/rust-lang/rust/pull/118368. Part of Part of https://github.com/rust-lang/rust/issues/80792. It adds support of the `--env` option for proc-macros through `tracked_env::var`. r? `@Nilstrieb`
2023-12-16Auto merge of #117595 - jyn514:x-clippy, r=albertlarsan68bors-1/+1
x clippy thanks to `@asquared31415` `@albertlarsan68` for all their help, most of this pr is their work note that this also adds x clippy --stage 0 -Awarnings to x86_64-gnu-llvm-15 to make sure it stays working; that won't gate on any clippy warnings, just enforce that clippy doesn't give a hard error. we can't add --stage 1 until clippy fixes its debug assertions not to panic. note that `x clippy --stage 1` currently breaks when combined with download-rustc. unlike the previous prs, this doesn't require changes to clippy (it works by using RUSTC_WRAPPER instead), and supports stage 0 read this commit-by-commit closes https://github.com/rust-lang/rust/pull/107628; see also https://github.com/rust-lang/rust/pull/106394, https://github.com/rust-lang/rust/pull/97443. fixes https://github.com/rust-lang/rust/issues/95988. helps with https://github.com/rust-lang/rust/issues/76495. r? bootstrap
2023-12-16make x.py clippy download and use beta clippyasquared31415-1/+1
2023-12-16Visit the AllocIds and BorTags in borrow state FrameExtraBen Kimock-8/+25
2023-12-16Merge commit 'a859e5cc1ce100df22346a1005da30532d04de59' into clippyupPhilipp Krones-637/+3064
2023-12-15rustdoc-search: remove parallel searchWords arrayMichael Howell-3/+3
This might have made sense if the algorithm could use `searchWords` to skip having to look at `searchIndex`, but since it always does a substring check on both the stock word and the normalizedName, it doesn't seem to help performance anyway.
2023-12-15Rollup merge of #118727 - compiler-errors:lint-decorate, r=WaffleLapkinJubilee-6/+0
Don't pass lint back out of lint decorator Change the decorator function in the signature of the `emit_lint`/`span_lint`/etc family of methods from `impl for<'a, 'b> FnOnce(&'b mut DiagnosticBuilder<'a, ()>) -> &'b mut DiagnosticBuilder<'a, ()>` to `impl for<'a, 'b> FnOnce(&'b mut DiagnosticBuilder<'a, ()>)`. I consider it easier to read this way, especially when there's control flow involved. r? nnethercote though feel free to reassign
2023-12-15Appease the tools: clippy, rustdocMichael Goulet-4/+6
2023-12-15Don't pass lint back out of lint decoratorMichael Goulet-6/+0
2023-12-15Make the crate compile on stableNadrieril-0/+1
2023-12-15Auto merge of #3226 - saethlin:deadpool-test, r=RalfJungbors-0/+16
Add a regression test for rust#115145 Per https://github.com/rust-lang/rust/pull/118805#issuecomment-1855264860
2023-12-15Add the test minimized from deadpoolBen Kimock-0/+16
2023-12-15Rollup merge of #118888 - compiler-errors:uplift-more-things, r=jackh726Matthias Krüger-3/+3
Uplift `TypeAndMut` and `ClosureKind` to `rustc_type_ir` Uplifts `TypeAndMut` and `ClosureKind` I know I said I was just going to get rid of `TypeAndMut` (https://github.com/rust-lang/types-team/issues/124) but I think this is much simpler, lol r? `@jackh726` or `@lcnr`
2023-12-15Merge from rustcThe Miri Conjob Bot-10/+27
2023-12-15Preparing for merge from rustcThe Miri Conjob Bot-1/+1
2023-12-14Rollup merge of #118943 - lqd:update-deps2, r=michaelwoeristerJubilee-1/+0
update `measureme` to 10.1.2 to deduplicate `parking_lot` This PR updates `measureme` to the latest release to remove the last duplicates of `parking_lot` 0.11 we had in our dependency tree. ```console Updating measureme v10.1.1 -> v10.1.2 Removing parking_lot v0.11.2 Removing parking_lot_core v0.8.6 ``` Also removes `instant` from the allowed list of dependencies, as it's no longer used. r? `@michaelwoerister` (Thanks for the release in the first place 🙏)
2023-12-14Rollup merge of #118933 - nnethercote:cleanup-errors-even-more, ↵Jubilee-5/+3
r=compiler-errors Cleanup errors handlers even more A sequel to #118587. r? `@compiler-errors`
2023-12-15Split `Handler::emit_diagnostic` in two.Nicholas Nethercote-5/+3
Currently, `emit_diagnostic` takes `&mut self`. This commit changes it so `emit_diagnostic` takes `self` and the new `emit_diagnostic_without_consuming` function takes `&mut self`. I find the distinction useful. The former case is much more common, and avoids a bunch of `mut` and `&mut` occurrences. We can also restrict the latter with `pub(crate)` which is nice.
2023-12-14Auto merge of #118375 - ouz-a:add_emit_stable_mir_tests, r=celinvalbors-1/+1
Add -Zunpretty=stable-mir output test As strongly suggested here https://github.com/rust-lang/rust/pull/118364#issuecomment-1827974148 this adds output test for `-Zunpretty=stable-mir`, added test shows almost all the functionality of the current printer. r? `@compiler-errors`
2023-12-14remove `instant` from allowed dependenciesRémy Rakic-1/+0
2023-12-14add stable_mir output testouz-a-1/+1
2023-12-14update use of feature flagslcnr-2/+2
2023-12-14Auto merge of #118566 - klensy:cstr-new, r=WaffleLapkinbors-1/+0
use c literals in compiler and library Relands refreshed https://github.com/rust-lang/rust/pull/111647
2023-12-14add test for uninhabited saved locals in a coroutineRalf Jung-0/+31
2023-12-14Merge from rustcThe Miri Conjob Bot-6292/+9944
2023-12-14Preparing for merge from rustcThe Miri Conjob Bot-1/+1