summary refs log tree commit diff
path: root/src/tools
AgeCommit message (Collapse)AuthorLines
2022-06-23Auto merge of #97911 - dtolnay:numcpu, r=Mark-Simulacrumbors-1/+2
Revert "remove num_cpus dependency" in rustc and update cargo Fixes #97549. This PR reverts #94524 and does a Cargo update to pull in rust-lang/cargo#10737. Rust 1.61.0 has a regression in which it misidentifies the number of available CPUs in some environments, leading to enormously increased memory usage and failing builds. In between Rust 1.60 and 1.61 both rustc and cargo replaced some uses of `num_cpus` with `available_parallelism`, which eliminated support for cgroupv1, still apparently in common use. This PR switches both rustc and cargo back to using `num_cpus` in order to support environments where the available parallelism is controlled by cgroupv1. Both can use `available_parallism` again once it handles cgroupv1 (if ever). I have confirmed that the rustc part of this PR fixes the memory usage regression in my non-Cargo environment, and others have confirmed in #97549 that the Cargo regression was at fault for the memory usage regression in their environments.
2022-06-01[beta] Update cargoEric Huss-0/+0
2022-05-17Bump rlsMark Rousskov-0/+0
2022-05-14Auto merge of #96883 - jackh726:early-binder-2, r=oli-obkbors-8/+8
Add EarlyBinder Chalk has no concept of `Param` (https://github.com/rust-lang/chalk/blob/e0ade19d139bc784384acc6736cd960c91dd55a1/chalk-ir/src/lib.rs#L579) or `ReEarlyBound` (https://github.com/rust-lang/chalk/blob/e0ade19d139bc784384acc6736cd960c91dd55a1/chalk-ir/src/lib.rs#L1308). Everything is just "bound" - the equivalent of rustc's late-bound. It's not completely clear yet whether to move everything to the same time of binder in rustc or add `Param` and `ReEarlyBound` in Chalk. Either way, tracking when we have or haven't already substituted out these in rustc can be helpful. As a first step, I'm just adding a `EarlyBinder` newtype that is required to call `subst`. I also add a couple "transparent" `bound_*` wrappers around a couple query that are often immediately substituted. r? `@nikomatsakis`
2022-05-14Rollup merge of #97018 - GuillaumeGomez:fail-on-js-error, r=notriddleYuki Okushi-1/+1
Ensure that test fail if a JS error occurs Fixes #96902. r? ``@notriddle``
2022-05-13Add bound_fn_sigJack Huey-2/+2
2022-05-13Add bound_type_ofJack Huey-6/+6
2022-05-13Emit an error if there is a JS failure on rustdoc pagesGuillaume Gomez-1/+1
2022-05-13Auto merge of #96493 - chbaker0:issue-96342-fix, r=Mark-Simulacrumbors-1/+9
Add compiletest and bootstrap "--skip" option forwarded to libtest With this PR, "x.py test --skip SKIP ..." will run the specified test suite, but forward "--skip SKIP" to the test tool. libtest already supports this option. The PR also adds it to compiletest which itself just forwards it to libtest. Adds the functionality requested in https://github.com/rust-lang/rust/issues/96342. This is useful to work around tests broken upstream. https://github.com/rust-lang/rust/issues/96362#issuecomment-1108609893 is the specific test issue my project is trying to work around.
2022-05-12Update cargoEric Huss-0/+0
2022-05-12Auto merge of #95562 - lcnr:attr-no-encode, r=davidtwcobors-45/+27
don't encode only locally used attrs Part of https://github.com/rust-lang/compiler-team/issues/505. We now filter builtin attributes before encoding them in the crate metadata in case they should only be used in the local crate. To prevent accidental misuse `get_attrs` now requires the caller to state which attribute they are interested in. For places where that isn't trivially possible, I've added a method `fn get_attrs_unchecked` which I intend to remove in a followup PR. After this pull request landed, we can then slowly move all attributes to only be used in the local crate while being certain that we don't accidentally try to access them from extern crates. cc https://github.com/rust-lang/rust/pull/94963#issuecomment-1082924289
2022-05-12compiletest: normalize paths from repository rootDavid Wood-10/+9
When testing macros from `rustc_macros` in `ui-fulldeps` tests, sometimes paths from the compiler source tree can be shown in error messages - these need to be normalized. Signed-off-by: David Wood <david.wood@huawei.com>
2022-05-12Auto merge of #96150 - est31:unused_macro_rules, r=petrochenkovbors-4/+0
Implement a lint to warn about unused macro rules This implements a new lint to warn about unused macro rules (arms/matchers), similar to the `unused_macros` lint added by #41907 that warns about entire macros. ```rust macro_rules! unused_empty { (hello) => { println!("Hello, world!") }; () => { println!("empty") }; //~ ERROR: 1st rule of macro `unused_empty` is never used } fn main() { unused_empty!(hello); } ``` Builds upon #96149 and #96156. Fixes #73576
2022-05-11Auto merge of #96806 - cjgillot:codegen-fulfill-nice, r=oli-obkbors-1/+9
Gracefully fail to resolve associated items instead of `delay_span_bug`. `codegen_fulfill_obligation` is used during instance resolution for trait items. In case of insufficient normalization issues during MIR inlining, it caused ICEs. It's better to gracefully refuse to resolve the associated item, and let the caller decide what to do with this. Split from https://github.com/rust-lang/rust/pull/91743 Closes #69121 Closes #73021 Closes #88599 Closes #93008 Closes #93248 Closes #94680 Closes #96170 r? `@oli-obk`
2022-05-11Bless clippy.Camille GILLOT-1/+9
2022-05-11Auto merge of #96942 - Dylan-DPC:rollup-p8bcly2, r=Dylan-DPCbors-7/+7
Rollup of 4 pull requests Successful merges: - #91518 (Add readable rustdoc display for RISC-V target) - #95281 (Fix inaccurate function name in `rustc_const_eval` docs) - #96898 (logging: add env var to control verbose scope entry/exit logging) - #96936 (:arrow_up: rust-analyzer) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-05-11ast: Introduce some traits to get AST node properties genericallyVadim Petrochenkov-14/+3
And use them to avoid constructing some artificial `Nonterminal` tokens during expansion
2022-05-11:arrow_up: rust-analyzerLaurențiu Nicola-7/+7
2022-05-11Rollup merge of #96543 - nnethercote:rm-make_token_stream-hacks, r=Aaron1011Yuki Okushi-3/+1
Remove hacks in `make_token_stream`. `make_tokenstream` has three commented hacks, and a comment at the top referring to #67062. These hacks have no observable effect, at least as judged by running the test suite. The hacks were added in #82608, with an explanation [here](https://github.com/rust-lang/rust/pull/82608#issuecomment-812877329). It appears that one of the following is true: (a) they never did anything useful, (b) they do something useful but we have no test coverage for them, or (c) something has changed in the meantime that means they are no longer necessary. This commit removes the hacks and the comments, in the hope that (b) is not true. r? `@Aaron1011`
2022-05-10Introduce EarlyBinderJack Huey-12/+12
2022-05-11Remove some unnecessary invisible delimiter checks.Nicholas Nethercote-3/+1
These seem to have no useful effect... they don't seem useful from a code inspection point of view, and they affect anything in the test suite.
2022-05-11Rollup merge of #96849 - c410-f3r:z-errors, r=petrochenkovYuki Okushi-2/+2
Move some tests to more reasonable places cc https://github.com/rust-lang/rust/issues/73494 r? `@petrochenkov`
2022-05-10Add test skip supportCollin Baker-1/+9
libtest already supports a "--skip SUBSTRING" arg which excludes any test names matching SUBSTRING. This adds a "--skip" argument to compiletest and bootstrap which is forwarded to libtest.
2022-05-10update clippylcnr-45/+27
2022-05-09Auto merge of #95542 - xFrednet:rfc-2383-expect-query, r=wesleywiserbors-0/+182
Support tool lints with the `#[expect]` attribute (RFC 2383) This PR fixes the ICE https://github.com/rust-lang/rust/issues/94953 by making the assert for converted expectation IDs conditional. Additionally, it moves the lint expectation check into a separate query to support rustdoc and other tools. On the way, I've also added some tests to ensure that the attribute works for Clippy and rustdoc lints. The number of changes comes from the long test file. This may look like a monster PR, this may smell like a monster PR and this may be a monster PR, but it's a harmless monster. :sauropod: --- Closes: https://github.com/rust-lang/rust/issues/94953 cc: https://github.com/rust-lang/rust/issues/85549 r? `@wesleywiser` cc: `@rust-lang/rustdoc`
2022-05-08Move some tests to more reasonable placesCaio-2/+2
2022-05-08Auto merge of #96770 - flip1995:fix-trait-type-in-bounds, r=cjgillotbors-26/+14
Track if a where bound comes from a impl Trait desugar With https://github.com/rust-lang/rust/pull/93803 `impl Trait` function arguments get desugared to hidden where bounds. However, Clippy needs to know if a bound was originally a `impl Trait` or an actual bound. This adds a field to the `WhereBoundPredicate` struct to keep track of this information during AST->HIR lowering. r? `@cjgillot` cc `@estebank` (as the reviewer of #93803)
2022-05-08Test `expect` attribute for tool lints, clippy edition (RFC 2383)xFrednet-0/+182
2022-05-08Auto merge of #94206 - PrestonFrom:significant_drop, r=flip1995bors-0/+1201
Create clippy lint against unexpectedly late drop for temporaries in match scrutinee expressions A new clippy lint for issue 93883 (https://github.com/rust-lang/rust/issues/93883). Relies on a new trait in `marker` (called `SignificantDrop` to enable linting), which is why this PR is for the rust-lang repo and not the clippy repo. changelog: new lint [`significant_drop_in_scrutinee`]
2022-05-07Track if a where bound comes from a impl Trait desugarflip1995-4/+8
With #93803 `impl Trait` function arguments get desugared to hidden where bounds. However, Clippy needs to know if a bound was originally a impl Trait or an actual bound. This adds a field to the `WhereBoundPredicate` struct to keep track of this information during HIR lowering.
2022-05-07update MiriRalf Jung-9/+7
2022-05-06Lint for significant drops who may have surprising lifetimes #1Preston From-0/+1201
author Preston From <prestonfrom@gmail.com> 1645164142 -0600 committer Preston From <prestonfrom@gmail.com> 1650005351 -0600
2022-05-07Auto merge of #96531 - kckeiks:remove-item-like-visitor-from-rustc-typeck, ↵bors-6/+6
r=cjgillot Remove ItemLikeVisitor impls from rustc_typeck Issue #95004 cc `@cjgillot`
2022-05-06Rollup merge of #96557 - nbdd0121:const, r=oli-obkGuillaume Gomez-1/+1
Allow inline consts to reference generic params Tracking issue: #76001 The RFC says that inline consts cannot reference to generic parameters (for now), same as array length expressions. And expresses that it's desirable for it to reference in-scope generics, when array length expressions gain that feature as well. However it is possible to implement this for inline consts before doing this for all anon consts, because inline consts are only used as values and they won't be used in the type system. So we can have: ```rust fn foo<T>() { let x = [4i32; std::mem::size_of::<T>()]; // NOT ALLOWED (for now) let x = const { std::mem::size_of::<T>() }; // ALLOWED with this PR! let x = [4i32; const { std::mem::size_of::<T>() }]; // NOT ALLOWED (for now) } ``` This would make inline consts super useful for compile-time checks and assertions: ```rust fn assert_zst<T>() { const { assert!(std::mem::size_of::<T>() == 0) }; } ``` This would create an error during monomorphization when `assert_zst` is instantiated with non-ZST `T`s. A error during mono might sound scary, but this is exactly what a "desugared" inline const would do: ```rust fn assert_zst<T>() { struct F<T>(T); impl<T> F<T> { const V: () = assert!(std::mem::size_of::<T>() == 0); } let _ = F::<T>::V; } ``` It should also be noted that the current inline const implementation can already reference the type params via type inference, so this resolver-level restriction is not any useful either: ```rust fn foo<T>() -> usize { let (_, size): (PhantomData<T>, usize) = const { const fn my_size_of<T>() -> (PhantomData<T>, usize) { (PhantomData, std::mem::size_of::<T>()) } my_size_of() }; size } ``` ```@rustbot``` label: F-inline_const
2022-05-06use def_span and def_kind queries instead of calling tcx.hir() methodsMiguel Guarniz-6/+6
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2022-05-05Allow unused rules in some places in the compiler, library and toolsest31-4/+0
2022-05-05(Partially) Revert "HACK: Move buggy lints to nursery"flip1995-22/+6
This reverts commit bb01aca86f66954b80798213711e8eadc4b26902. Partial: Keep regression tests
2022-05-05Merge commit '7c21f91b15b7604f818565646b686d90f99d1baf' into clippyupflip1995-2639/+6204
2022-05-05Bless clippy error msgGary Guo-1/+1
2022-05-04Auto merge of #96546 - nnethercote:overhaul-MacArgs, r=petrochenkovbors-1/+2
Overhaul `MacArgs` Motivation: - Clarify some code that I found hard to understand. - Eliminate one use of three places where `TokenKind::Interpolated` values are created. r? `@petrochenkov`
2022-05-05Overhaul `MacArgs::Eq`.Nicholas Nethercote-1/+2
The value in `MacArgs::Eq` is currently represented as a `Token`. Because of `TokenKind::Interpolated`, `Token` can be either a token or an arbitrary AST fragment. In practice, a `MacArgs::Eq` starts out as a literal or macro call AST fragment, and then is later lowered to a literal token. But this is very non-obvious. `Token` is a much more general type than what is needed. This commit restricts things, by introducing a new type `MacArgsEqKind` that is either an AST expression (pre-lowering) or an AST literal (post-lowering). The downside is that the code is a bit more verbose in a few places. The benefit is that makes it much clearer what the possibilities are (though also shorter in some other places). Also, it removes one use of `TokenKind::Interpolated`, taking us a step closer to removing that variant, which will let us make `Token` impl `Copy` and remove many "handle Interpolated" code paths in the parser. Things to note: - Error messages have improved. Messages like this: ``` unexpected token: `"bug" + "found"` ``` now say "unexpected expression", which makes more sense. Although arbitrary expressions can exist within tokens thanks to `TokenKind::Interpolated`, that's not obvious to anyone who doesn't know compiler internals. - In `parse_mac_args_common`, we no longer need to collect tokens for the value expression.
2022-05-03Update cargoEric Huss-0/+0
2022-05-03Auto merge of #96558 - bjorn3:librarify_parse_format, r=davidtwcobors-2/+3
Make rustc_parse_format compile on stable This allows it to be used by lightweight formatting systems and may allow it to be used by rust-analyzer.
2022-05-03Make rustc_parse_format compile on stablebjorn3-2/+3
This allows it to be used by lightweight formatting systems and may allow it to be used by rust-analyzer.
2022-05-03:arrow_up: rust-analyzerLaurențiu Nicola-22/+7
2022-05-02Auto merge of #96431 - petrochenkov:parent, r=cjgillotbors-9/+9
rustc: Panic by default in `DefIdTree::parent` Only crate root def-ids don't have a parent, and in majority of cases the argument of `DefIdTree::parent` cannot be a crate root. So we now panic by default in `parent` and introduce a new non-panicing function `opt_parent` for cases where the argument can be a crate root. Same applies to `local_parent`/`opt_local_parent`.
2022-05-02Rollup merge of #96610 - GuillaumeGomez:update-browser-ui-test, r=notriddleYuki Okushi-1/+0
Update browser-ui-test version to 0.9.0 It adds the command `screenshot` and disables the screenshot comparison by default. r? `@notriddle`
2022-05-02rustc: Panic by default in `DefIdTree::parent`Vadim Petrochenkov-9/+9
Only crate root def-ids don't have a parent, and in majority of cases the argument of `DefIdTree::parent` cannot be a crate root. So we now panic by default in `parent` and introduce a new non-panicing function `opt_parent` for cases where the argument can be a crate root. Same applies to `local_parent`/`opt_local_parent`.
2022-05-01Auto merge of #96517 - ferrocene:pa-files-related-to-test, r=Mark-Simulacrumbors-11/+35
[compiletest] Extract code to detect files related to a test into a different function In the code that checks whether a test needs to be re-executed, compiletest checks the modification date of all the files related to the test. I need the list of files related to the test for other purposes inside compiletest, and while I could copy/paste the code `is_up_to_date` runs, that would produce incomplete results if more related files are added in the future. This PR extracts the code to detect related files into a separate function, allowing the rest of compiletest to access the same data. r? `@Mark-Simulacrum`
2022-05-01Update browser-ui-test version to 0.9.0Guillaume Gomez-1/+0