about summary refs log tree commit diff
AgeCommit message (Collapse)AuthorLines
2023-06-08Point at correct exprs for assert_eq type mismatchMichael Goulet-16/+69
2023-06-08More robust as_ref/as_deref suggestionsMichael Goulet-152/+207
2023-06-08Suggest type mismatches even when using ref syntax on bindingMichael Goulet-2/+14
2023-06-08Auto merge of #112415 - GuillaumeGomez:rollup-5pa9frd, r=GuillaumeGomezbors-35/+90
Rollup of 9 pull requests Successful merges: - #112034 (Migrate `item_opaque_ty` to Askama) - #112179 (Avoid passing --cpu-features when empty) - #112309 (bootstrap: remove dependency `is-terminal`) - #112388 (Migrate GUI colors test to original CSS color format) - #112389 (Add a test for #105709) - #112392 (Fix ICE for while loop with assignment condition with LHS place expr) - #112394 (Remove accidental comment) - #112396 (Track more diagnostics in `rustc_expand`) - #112401 (Don't `use compile_error as print`) r? `@ghost` `@rustbot` modify labels: rollup
2023-06-08Rollup merge of #112401 - WaffleLapkin:dont_compile_error, r=NilstriebGuillaume Gomez-1/+8
Don't `use compile_error as print` I've spent **1.5 hours** debugging this while trying to compile #112400, if we use `compile_error!`, we should not just forward user input to it, but issue a reasonable error message. The better solution would be to use a lint like `clippy::print_stdout`, but since we don't have clippy in CI, let's at least make the macro error better. Also note that some functions called here actually do use `println` (see for example `print_type_sizes` function).
2023-06-08Rollup merge of #112396 - WaffleLapkin:track_more_diagnostics, r=compiler-errorsGuillaume Gomez-0/+5
Track more diagnostics in `rustc_expand` I wish we could lint this somehow...
2023-06-08Rollup merge of #112394 - clubby789:remove-comment, r=petrochenkovGuillaume Gomez-3/+0
Remove accidental comment Left this in in #110092 while debugging, thanks to `@WaffleLapkin` for spotting
2023-06-08Rollup merge of #112392 - jieyouxu:issue-112385, r=compiler-errorsGuillaume Gomez-4/+47
Fix ICE for while loop with assignment condition with LHS place expr Fixes #112385.
2023-06-08Rollup merge of #112389 - TaKO8Ki:issue-105709, r=compiler-errorsGuillaume Gomez-0/+9
Add a test for #105709 Closes #105709
2023-06-08Rollup merge of #112388 - GuillaumeGomez:migrate-gui-test-color-12, r=notriddleGuillaume Gomez-3/+3
Migrate GUI colors test to original CSS color format Follow-up of https://github.com/rust-lang/rust/pull/111459. r? `@notriddle`
2023-06-08Rollup merge of #112309 - kadiwa4:remove_is_terminal, r=albertlarsan68Guillaume Gomez-16/+1
bootstrap: remove dependency `is-terminal`
2023-06-08Rollup merge of #112179 - tamird:no-empty-cpu-features, r=petrochenkovGuillaume Gomez-5/+7
Avoid passing --cpu-features when empty Added in 12ac719b99560072cbe52a957f22d3fe6946cf2a, this logic always passed --cpu-features, even when the value was the empty string.
2023-06-08Rollup merge of #112034 - sladyn98:migrate-opaque-ty, r=GuillaumeGomezGuillaume Gomez-3/+10
Migrate `item_opaque_ty` to Askama This PR migrates `item_opaque_ty` to Askama Refers: https://github.com/rust-lang/rust/issues/108868
2023-06-08Auto merge of #110040 - ndrewxie:issue-84447-partial-1, r=lcnr,michaelwoeristerbors-192/+261
Removed use of iteration through a HashMap/HashSet in rustc_incremental and replaced with IndexMap/IndexSet This allows for the `#[allow(rustc::potential_query_instability)]` in rustc_incremental to be removed, moving towards fixing #84447 (although a LOT more modules have to be changed to fully resolve it). Only HashMaps/HashSets that are being iterated through have been modified (although many structs and traits outside of rustc_incremental had to be modified as well, as they had fields/methods that involved a HashMap/HashSet that would be iterated through) I'm making a PR for just 1 module changed to test for performance regressions and such, for future changes I'll either edit this PR to reflect additional modules being converted, or batch multiple modules of changes together and make a PR for each group of modules.
2023-06-08Migrate item_opaque_type to Askamasladynnunes-3/+10
Migrate item_opaque_type to Askama Fix wrap_item parameters Fix to write
2023-06-08add a test for #105709Takayuki Maeda-0/+9
replace build with check Co-authored-by: Michael Goulet <michael@errs.io> use appropriate test name
2023-06-08Whoops, submodule change was actually valid - undoing fixupAndrew Xie-1/+1
2023-06-08Auto merge of #112292 - thomcc:tls-ohno, r=m-ou-sebors-12/+33
Avoid unwind across `extern "C"` in `thread_local::fast_local` This is a minimal fix for #112285, in case we want a simple patch that can be easily to backported if that's desirable. *(Note: I have another broader cleanup which I've mostly omitted from here to avoid clutter, except for the `Cell` change, which isn't needed to fix UB, but simplifies safety comments).* The only tier-1 target that this occurs on in a way that seems likely to cause problems in practice linux-gnu, although I believe some folks care about that platform somewhat 😉. I'm unsure how big of an issue this is. I've seen stuff like this behave quite badly, but there's a number of reasons to think this might actually be "fine in practice". I've hedged my bets and assumed we'll backport this at least to beta but my feeling is that there's not enough evidence this is a problem worth backporting further than that. ### More details This issue seems to have existed since `thread_local!`'s `const` init functionality was added. It occurs if you have a `const`-initialized thread local for a type that `needs_drop`, the drop panics, and you're on a target with support for static thread locals. In this case, we will end up defining an `extern "C"` function in the user crate rather than in libstd, and because the user crate will not have `#![feature(c_unwind)]` enabled, their panic will not be caught by an auto-inserted abort guard. In practice, the actual situation where problems are likely[^ub] is somewhat narrower. On most targets with static thread locals, we manage the TLS dtor list by hand (for reentrancy reasons among others). In these cases, while the users code may panic, we're calling it inside our own `extern "C"` (or `extern "system"`) function, which seems to (at least in practice) catch the panic and convert it to an abort. However, on a few targets, most notably linux-gnu with recent glibc (but also fuchsia and redox), a tls dtor registration mechanism exists which we can actually use directly, [`__cxa_thread_atexit_impl`](https://github.com/rust-lang/rust/blob/master/library/std/src/sys/unix/thread_local_dtor.rs#L26-L36). This is the case that seems most likely to be a cause for concern, as now we're passing a function to the system library and panicking out of it in a case where there are may not be Rust frames above it on the call stack (since it's running thread shutdown), and even if there were, it may not be prepared to handle such unwinding. If that's the case, it'd be bad. Is it? Dunno. The fact that it's a `__cxa_*` function makes me think they probably have considered that the callback could throw but I have no evidence here and it doesn't seem to be written down anywhere, so it's just a guess. (I would not be surprised if someone comes into this thread to tell me how definitely-bad-news it is). That said, as I said, all this is actually UB! If this isn't a "technically UB but fine in practice", but all bets are off if this is the kind of thing we are telling LLVM about. [^ub]: This is UB so take that with a grain of salt -- I'm absolutely making assumptions about how the UB will behave "in practice" here, which is almost certainly a mistake.
2023-06-08fixup! Removed stable/unstable sort arg from into_sorted_stable_ord, fixed a ↵Andrew Xie-1/+1
few misc issues, added collect to UnordItems
2023-06-08Removed stable/unstable sort arg from into_sorted_stable_ord, fixed a few ↵Andrew Xie-48/+81
misc issues, added collect to UnordItems
2023-06-08Auto merge of #112012 - Kobzol:try-build-llvm-rebuild, r=nikicbors-55/+99
Avoid one `rustc` rebuild in the optimized build pipeline This PR changes the optimized build pipeline to avoid one `rustc` rebuild, inspired by [this comment](https://github.com/rust-lang/rust/issues/112011#issuecomment-1564991175). This speeds up the pipeline by 5-10 minutes. After this change, we **no longer gather LLVM PGO profiles from compiling stage 2 of `rustc`**. Now we build `rustc` two times (1x PGO instrumented, 1x PGO optimized) and LLVM three times (1x normal, 1x PGO instrumented, 1x PGO optimized). It should be possible to cache the normal LLVM build, but I'll leave that for another PR.
2023-06-07Auto merge of #111698 - Amanieu:force-static-lib, r=petrochenkovbors-6/+47
Force all native libraries to be statically linked when linking a static binary Previously, `#[link]` without an explicit `kind = "static"` would confuse the linker and end up producing a dynamically linked library because of the `-Bdynamic` flag. However this binary would not work correctly anyways since it was linked with startup code for a static binary. This PR solves this by forcing all native libraries to be statically linked when the output is a static binary that cannot link to dynamic libraries anyways. Fixes #108878 Fixes #102993
2023-06-07Track more diagnostics in `rustc_expand`Maybe Waffle-0/+5
2023-06-07Don't `use compile_error as print`Maybe Waffle-1/+8
2023-06-08Fix ICE for while loop with assignment condition with LHS place expr许杰友 Jieyou Xu (Joe)-4/+47
2023-06-07Force all native libraries to be statically linked when linking a static binaryAmanieu d'Antras-6/+47
2023-06-07Auto merge of #109005 - Nilstrieb:dont-forgor-too-much-from-cfg, r=petrochenkovbors-84/+599
Remember names of `cfg`-ed out items to mention them in diagnostics # Examples ## `serde::Deserialize` without the `derive` feature (a classic beginner mistake) I had to slightly modify serde so that it uses explicit re-exports instead of a glob re-export. (Update: a serde PR was merged that adds the manual re-exports) ``` error[E0433]: failed to resolve: could not find `Serialize` in `serde` --> src/main.rs:1:17 | 1 | #[derive(serde::Serialize)] | ^^^^^^^^^ could not find `Serialize` in `serde` | note: crate `serde` has an item named `Serialize` but it is inactive because its cfg predicate evaluated to false --> /home/gh-Nilstrieb/.cargo/registry/src/index.crates.io-6f17d22bba15001f/serde-1.0.160/src/lib.rs:343:1 | 343 | #[cfg(feature = "serde_derive")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 344 | pub use serde_derive::{Deserialize, Serialize}; | ^^^^^^^^^ = note: the item is gated behind the `serde_derive` feature = note: see https://doc.rust-lang.org/cargo/reference/features.html for how to activate a crate's feature ``` (the suggestion is not ideal but that's serde's fault) I already tested the metadata size impact locally by compiling the `windows` crate without any features. `800k` -> `809k` r? `@ghost`
2023-06-07Remove accidental commentclubby789-3/+0
2023-06-07Migrate GUI colors test to original CSS color formatGuillaume Gomez-3/+3
2023-06-07Auto merge of #112383 - Dylan-DPC:rollup-et2z6nt, r=Dylan-DPCbors-232/+671
Rollup of 6 pull requests Successful merges: - #112076 (Fall back to bidirectional normalizes-to if no subst-relate candidate in alias-relate goal) - #112122 (Add `-Ztrait-solver=next-coherence`) - #112251 (rustdoc: convert `if let Some()` that always matches to variable) - #112345 (fix(expand): prevent infinity loop in macro containing only "///") - #112359 (Respect `RUST_BACKTRACE` for delayed bugs) - #112382 (download-rustc: Fix `x test core` on MacOS) r? `@ghost` `@rustbot` modify labels: rollup
2023-06-07Rollup merge of #112382 - jyn514:test-download-rustc-macos, r=albertlarsan68Dylan DPC-1/+6
download-rustc: Fix `x test core` on MacOS before, this hardcoded `.so` as the extension for dynamically linked objects, which is incorrect everywhere except linux.
2023-06-07Rollup merge of #112359 - Nilstrieb:i-can-only-handle-so-many-backtraces, ↵Dylan DPC-4/+14
r=compiler-errors Respect `RUST_BACKTRACE` for delayed bugs Sometimes, especially with MIR validation, the backtraces from delayed bugs are noise and make it harder to look at them. Respect the environment variable and don't print it when the user doesn't want it.
2023-06-07Rollup merge of #112345 - bvanjoi:fix-112342, r=nilstrieb,est31Dylan DPC-10/+212
fix(expand): prevent infinity loop in macro containing only "///" Fixes https://github.com/rust-lang/rust/issues/112342 Issue #112342 was caused by an infinity loop in `parse_tt_inner`, and the state of it is as follows: - `matcher`: `[Sequence, Token(Doc), SequenceKleeneOpNoSep(op: ZeroOrMore), Eof]` - loop: | Iteration | Action | | - | - | | 0 | enter `Sequence`| | 1 | enter `Token(Doc)` and `mp.idx += 1` had been executed | | 2 | enter `SequenceKleeneOpNoSep` and reset `mp.idx` to `1` | | 3 | enter `Token(Doc)` again| To prevent the infinite loop, a check for whether it only contains `DocComment` in `check_lhs_no_empty_seq` had been added.
2023-06-07Rollup merge of #112251 - notriddle:notriddle/cleanup-inlining, r=GuillaumeGomezDylan DPC-18/+28
rustdoc: convert `if let Some()` that always matches to variable
2023-06-07Rollup merge of #112122 - compiler-errors:next-coherence, r=lcnrDylan DPC-63/+142
Add `-Ztrait-solver=next-coherence` Flag that conditionally uses the trait solver *only* during coherence, for more testing and/or eventual partial-migration onto the trait solver (in the medium- to long-term). * This still uses the selection context in some of the coherence methods I think, so it's not "complete". Putting this up for review and/or for further work in-tree. * I probably need to spend a bit more time making sure that we don't sneakily create any other infcx's during coherence that also need the new solver enabled. r? `@lcnr`
2023-06-07Rollup merge of #112076 - compiler-errors:bidirectional-alias-eq, r=lcnrDylan DPC-136/+269
Fall back to bidirectional normalizes-to if no subst-relate candidate in alias-relate goal Sometimes we get into the case where the choice of normalizes-to branch in alias-relate are both valid, but we cannot make a choice of which one to take because they are different -- either returning equivalent but permuted region constraints, or equivalent opaque type definitions but differing modulo normalization. In this case, we can make progress by considering a fourth candidate where we compute both normalizes-to branches together and canonicalize that as a response. This is essentially the AND intersection of both normalizes-to branches. In an ideal world, we'd be returning something more like the OR intersection of both branches, but we have no way of representing that either for regions (maybe eventually) or opaques (don't see that happening ever). This is incomplete, so like the subst-relate fallback it's only considered outside of coherence. But it doesn't seem like a dramatic strengthening of inference or anything, and is useful for helping opaque type inference succeed when the hidden type is a projection. ## Example Consider the goal - `AliasRelate(Tait, <[i32; 32] as IntoIterator>::IntoIter)`. We have three ways of currently solving this goal: 1. SubstRelate - fails because we can't directly equate the substs of different alias kinds. 2. NormalizesToRhs - `Tait normalizes-to <[i32; 32] as IntoIterator>::IntoIter` * Ends up infering opaque definition - `Tait := <[i32; 32] as IntoIterator>::IntoIter` 3. NormalizesToLhs - `<[i32; 32] as IntoIterator>::IntoIter normalizes-to Tait` * Find impl candidate, substitute the associated type - `std::array::IntoIter<i32, 32>` * Equate `std::array::IntoIter<i32, 32>` and `Tait` * Ends up infering opaque definition - `Tait := std::array::IntoIter<i32, 32>` The problem here is that 2 and 3 are essentially both valid, since we have aliases that normalize on both sides, but due to lazy norm, they end up inferring different opaque type definitions that are only equal *after* normalizing them further. --- r? `@lcnr`
2023-06-07Use ``--keep-stage` also for the final buildJakub Beránek-0/+6
2023-06-07download-rustc: Fix `x test core` on MacOSjyn-1/+6
before, this hardcoded `.so` as the extension for dynamically linked objects, which is incorrect everywhere except linux
2023-06-07Auto merge of #111047 - compiler-errors:rtn-no-ty-ct-params, r=spastorinobors-44/+100
Emit an error when return-type-notation is used with type/const params These are not intended to be supported initially, even though the compiler supports them internally...
2023-06-07Avoid one `rustc` rebuild in the optimized build pipelineJakub Beránek-55/+93
2023-06-07Auto merge of #96875 - SabrinaJewson:noop-waker, r=m-ou-sebors-0/+40
Add `task::Waker::noop` I have found myself reimplementing this function many times when I need a `Context` but don't have a runtime or `futures` to hand. Prior art: [`futures::task::noop_waker`](https://docs.rs/futures/0.3/futures/task/fn.noop_waker.html) and [`futures::task::noop_waker_ref`](https://docs.rs/futures/0.3/futures/task/fn.noop_waker_ref.html) Tracking issue: https://github.com/rust-lang/rust/issues/98286 Unresolved questions: 1. Should we also add `RawWaker::noop()`? (I don't think so, I can't think of a use case for it) 2. Should we also add `Context::noop()`? Depending on the future direction `Context` goes a "noop context" might not even make sense in future. 3. Should it be an associated constant instead? That would allow for `let cx = &mut Context::from_waker(&Waker::NOOP);` to work on one line which is pretty nice. I don't really know what the guideline is here. r? rust-lang/libs-api `@rustbot` label +T-libs-api -T-libs
2023-06-07Auto merge of #111819 - nikarh:vita-improved, r=Amanieubors-88/+81
Improved std support for ps vita target Fixed a couple of things in std support for ps vita via Vita SDK newlib oss implementation: - Added missing hardware features to target spec - Compile in thumb by default (newlib is also compiled in thumb) - Fixed fs calls. Vita newlib has a not-very-posix dirent. Also vita does not expose inodes, it's stubbed as 0 in stat, and I'm stubbing it here for dirent (because vita newlibs's dirent doesn't even have that field) - Enabled signal handlers for panic unwinding - Dropped static link requirement from the platform support md. Also, rearranged sections to better stick with the template.
2023-06-07feat(expand): emit note for doc comment in macro matcherbohan-12/+119
2023-06-07Auto merge of #111495 - Kobzol:dist-tests, r=Mark-Simulacrumbors-7/+127
Run tests on PGO/LTO/BOLT optimized dist artifacts This PR adds baisc tests for the optimized dist builds on x64 Linux and Windows. A subset of the test suite is run, so it's not perfect, but it's better than the status quo (which is basically no testing at all, apart from the perf bot on Linux). r? `@ghost`
2023-06-06Auto merge of #112361 - matthiaskrgr:rollup-39zxrw1, r=matthiaskrgrbors-86/+188
Rollup of 8 pull requests Successful merges: - #111250 (Add Terminator conversion from MIR to SMIR, part #2) - #112310 (Add new Tier-3 targets: `loongarch64-unknown-none*`) - #112334 (Add myself to highfive rotation) - #112340 (remove `TyCtxt::has_error_field` helper method) - #112343 (Prevent emitting `missing_docs` for `pub extern crate`) - #112350 (Avoid duplicate type sanitization of local decls in borrowck) - #112356 (Fix comment for `get_region_var_origins`) - #112358 (Remove default visitor impl in region constraint generation) r? `@ghost` `@rustbot` modify labels: rollup
2023-06-06Rollup merge of #112358 - Nilstrieb:fancy-more-borrowck-cleanups, ↵Matthias Krüger-6/+2
r=compiler-errors Remove default visitor impl in region constraint generation I wanted to group it together with other possibly minor borrowck cleanups but that's all I have right now so I rather put it up than forget about it before doing something else. r? `@compiler-errors`
2023-06-06Rollup merge of #112356 - Nilstrieb:get-region-var-origins, r=compiler-errorsMatthias Krüger-5/+5
Fix comment for `get_region_var_origins` #109753 changed the logic but not the comment. r? `@compiler-errors`
2023-06-06Rollup merge of #112350 - Nilstrieb:borrow-me-some-cleanups, r=compiler-errorsMatthias Krüger-3/+1
Avoid duplicate type sanitization of local decls in borrowck The type of the local decl is already sanitized in `visit_local_decl`.
2023-06-06Rollup merge of #112343 - GuillaumeGomez:extern-crate-missing-docs, r=notriddleMatthias Krüger-28/+37
Prevent emitting `missing_docs` for `pub extern crate` Fixes #112308. r? `@notriddle`
2023-06-06Rollup merge of #112340 - lcnr:tyctxt-cleanup, r=compiler-errorsMatthias Krüger-40/+9
remove `TyCtxt::has_error_field` helper method