about summary refs log tree commit diff
AgeCommit message (Collapse)AuthorLines
2023-02-22std: time: Avoid to use "was created" in elapsed() descriptionBoqun Feng-3/+3
".. since this instant was created" is inaccurate and misleading, consider the following case: let i1 = Instant::now(); // i1 is created at T1 let i2 = i1 + Duration::from_nanos(0); // i2 is "created" at T2 i2.elapsed(); // at T3 Per the current description, `elapsed()` at T3 should return T3 - T2? Therefore removes the "was created" in the description of {Instant,SystemTime}::elapsed(). And since these types represent times, it's OK to use prepostions with them, e.g. "since this instant".
2023-02-22Auto merge of #108340 - eggyal:remove_traversal_trait_aliases, r=oli-obkbors-569/+658
Remove type-traversal trait aliases #107924 moved the type traversal (folding and visiting) traits into the type library, but created trait aliases in `rustc_middle` to minimise both the API churn for trait consumers and the arising boilerplate. As mentioned in that PR, an alternative approach of defining subtraits with blanket implementations of the respective supertraits was also considered at that time but was ruled out as not adding much value. Unfortunately, it has since emerged that rust-analyzer has difficulty with these trait aliases at present, resulting in a degraded contributor experience (see the recent [r-a has become useless](https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/r-a.20has.20become.20useless) topic on the #t-compiler/help Zulip stream). This PR removes the trait aliases, and accordingly the underlying type library traits are now used directly; they are parameterised by `TyCtxt<'tcx>` rather than just the `'tcx` lifetime, and imports have been updated to reflect the fact that the trait aliases' explicitly named traits are no longer automatically brought into scope. These changes also roll-back the (no-longer required) workarounds to #107747 that were made in b409329c624b9e3bbd7d8e07697e2e9f861a45b6. Since this PR is just a find+replace together with the changes necessary for compilation & tidy to pass, it's currently just one mega-commit. Let me know if you'd like it broken up. r? `@oli-obk`
2023-02-22Normalize line+col in normalize-tait-in-const testAlan Egerton-1/+2
2023-02-22Remove type-traversal trait aliasesAlan Egerton-569/+657
2023-02-22Auto merge of #103042 - davidtwco:translation-distributed-ftl, r=oli-obkbors-1407/+1739
errors: generate typed identifiers in each crate Instead of loading the Fluent resources for every crate in `rustc_error_messages`, each crate generates typed identifiers for its own diagnostics and creates a static which are pulled together in the `rustc_driver` crate and provided to the diagnostic emitter. There are advantages and disadvantages to this change.. #### Advantages - Changing a diagnostic now only recompiles the crate for that diagnostic and those crates that depend on it, rather than `rustc_error_messages` and all crates thereafter. - This approach can be used to support first-party crates that want to supply translatable diagnostics (e.g. `rust-lang/thorin` in https://github.com/rust-lang/rust/pull/102612#discussion_r985372582, cc `@JhonnyBillM)` - We can extend this a little so that tools built using rustc internals (like clippy or rustdoc) can add their own diagnostic resources (much more easily than those resources needing to be available to `rustc_error_messages`) #### Disadvantages - Crates can only refer to the diagnostic messages defined in the current crate (or those from dependencies), rather than all diagnostic messages. - `rustc_driver` (or some other crate we create for this purpose) has to directly depend on *everything* that has error messages. - It already transitively depended on all these crates. #### Pending work - [x] I don't know how to make `rustc_codegen_gcc`'s translated diagnostics work with this approach - because `rustc_driver` can't depend on that crate and so can't get its resources to provide to the diagnostic emission. I don't really know how the alternative codegen backends are actually wired up to the compiler at all. - [x] Update `triagebot.toml` to track the moved FTL files. r? `@compiler-errors` cc #100717
2023-02-22Auto merge of #108339 - GuillaumeGomez:rollup-4z02kas, r=GuillaumeGomezbors-400/+562
Rollup of 8 pull requests Successful merges: - #108110 (Move some `InferCtxt` methods to `EvalCtxt` in new solver) - #108168 (Fix ICE on type alias in recursion) - #108230 (Convert a hard-warning about named static lifetimes into lint "unused_lifetimes") - #108239 (Fix overlapping spans in removing extra arguments) - #108246 (Add an InstCombine for redundant casts) - #108264 (no-fail-fast support for tool testsuites) - #108310 (rustdoc: Fix duplicated attributes for first reexport) - #108318 (Remove unused FileDesc::get_cloexec) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2023-02-22Rollup merge of #108318 - tmiasko:rm-get_cloexec, r=the8472Guillaume Gomez-5/+0
Remove unused FileDesc::get_cloexec
2023-02-22Rollup merge of #108310 - ↵Guillaume Gomez-7/+42
GuillaumeGomez:fix-reexports-duplicated-attributes, r=notriddle rustdoc: Fix duplicated attributes for first reexport Fixes #108281. r? ``@notriddle``
2023-02-22Rollup merge of #108264 - jchecahi:tool-testsuite-ignores-no-fail-fast, ↵Guillaume Gomez-0/+12
r=ozkanonur no-fail-fast support for tool testsuites ~~This commit adds a change to pass "--no-fail-fast" flag to `cargo test` inside `tool::prepare_tool_cargo()` so there is no need to do it manually in each `Step` trait implementation in src/bootstrap/test.rs.~~ ~~Also, removes the flag from test.rs where prepare_tool_cargo() is called so cargo doesn't complain because the flag has been passed twice.~~ This commit adds `--no-fail-fast` flag to each `cargo test` command in each tool Step trait implementation (`miri`, `rustfmt` and `clippy`). Fixes #108261
2023-02-22Rollup merge of #108246 - saethlin:instcombine-redundant-casts, ↵Guillaume Gomez-0/+80
r=compiler-errors Add an InstCombine for redundant casts `@rustbot` label +A-mir-opt
2023-02-22Rollup merge of #108239 - clubby789:overlapping-spans, r=compiler-errorsGuillaume Gomez-39/+76
Fix overlapping spans in removing extra arguments Fixes #108225 Each span is already extended to include the previous comma, so extending to the *next* comma is unecessary and causes an ICE with assertions on. ``@rustbot`` label +A-diagnostics
2023-02-22Rollup merge of #108230 - LittleFall:enhance/warning, r=estebankGuillaume Gomez-121/+96
Convert a hard-warning about named static lifetimes into lint "unused_lifetimes" Fixes https://github.com/rust-lang/rust/issues/96956. Some changes are ported from https://github.com/rust-lang/rust/pull/98079, thanks to jeremydavis519. r? `@estebank` `@petrochenkov` Any feedback is appreciated! ## Actions - [x] resolve conflicts - [x] fix build - [x] address review comments in last pr - [x] update tests
2023-02-22Rollup merge of #108168 - clubby789:recursive-type-alias, r=compiler-errorsGuillaume Gomez-2/+28
Fix ICE on type alias in recursion Fixes #108160
2023-02-22Rollup merge of #108110 - compiler-errors:new-solver-less-infcx, r=lcnrGuillaume Gomez-226/+228
Move some `InferCtxt` methods to `EvalCtxt` in new solver Moving towards eventually making the `InferCtxt` within `EvalCtxt` private, so that we make sure not to do anything strange in the solver. This doesn't finish this work yet, just gets it started. r? ``@lcnr``
2023-02-22various: translation resources from cg backendDavid Wood-48/+86
Extend `CodegenBackend` trait with a function returning the translation resources from the codegen backend, which can be added to the complete list of resources provided to the emitter. Signed-off-by: David Wood <david.wood@huawei.com>
2023-02-22errors: fix translation's run-make testDavid Wood-9/+22
`run-make/translation` had some targets that weren't listed in `all` and thus weren't being tested - the behaviour that should have been being tested was basically correct fortunately. Signed-off-by: David Wood <david.wood@huawei.com>
2023-02-22errors: generate typed identifiers in each crateDavid Wood-1393/+1674
Instead of loading the Fluent resources for every crate in `rustc_error_messages`, each crate generates typed identifiers for its own diagnostics and creates a static which are pulled together in the `rustc_driver` crate and provided to the diagnostic emitter. Signed-off-by: David Wood <david.wood@huawei.com>
2023-02-22Auto merge of #108300 - oli-obk:elsa, r=eholkbors-36/+79
Use a lock-free datastructure for source_span follow up to the perf regression in https://github.com/rust-lang/rust/pull/105462 The main regression is likely the CStore, but let's evaluate the perf impact of this on its own
2023-02-22Add no-fail-fast support to miri, rustfmt and clippy testsuitesJesus Checa Hidalgo-0/+12
This commit adds `--no-fail-fast` flag to each `cargo test` command in each tool Step trait implementation. Fixes #108261
2023-02-22Move some InferCtxt methods to EvalCtxt in new solverMichael Goulet-226/+228
2023-02-22Auto merge of #108325 - matthiaskrgr:rollup-73qihie, r=matthiaskrgrbors-440/+818
Rollup of 7 pull requests Successful merges: - #104239 (Better debug logs for borrowck constraint graph) - #108202 (Make sure `test_type_match` doesn't ICE with late-bound types) - #108295 (Use DefKind to give more item kind information during BindingObligation note ) - #108306 (compiletest: up deps) - #108313 (Fix compiletest possible crash in option only-modified) - #108322 (Clean ConstProp) - #108323 (hir-analysis: make one diagnostic translatable) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2023-02-22Convert a hard-warning about named static lifetimes into lint "unused_lifetimes"Zhi Qi-121/+96
Define the `named_static_lifetimes` lint This lint will replace the existing hard-warning. Replace the named static lifetime hard-warning with the new lint Update the UI tests for the `named_static_lifetimes` lint Remove the direct dependency on `rustc_lint_defs` fix build Signed-off-by: Zhi Qi <qizhi@pingcap.com> use "UNUSED_LIFETIMES" instead Signed-off-by: Zhi Qi <qizhi@pingcap.com> update 1 test and fix typo Signed-off-by: Zhi Qi <qizhi@pingcap.com> update tests Signed-off-by: Zhi Qi <qizhi@pingcap.com> fix tests: add extra blank line Signed-off-by: Zhi Qi <qizhi@pingcap.com>
2023-02-21Auto merge of #108302 - Kobzol:revert-107834, r=albertlarsan68bors-86/+12
Revert #107834 This reverts commit [41c6c5d4996728b5a635319ef9b077a3d0ccc480](https://github.com/rust-lang/rust/pull/107834). Trying to check if this fixes building `rustc` for perf bot.
2023-02-21Rollup merge of #108323 - tshepang:translatable-hir-analysis, r=compiler-errorsMatthias Krüger-4/+13
hir-analysis: make one diagnostic translatable
2023-02-21Rollup merge of #108322 - cjgillot:clean-const-prop, r=oli-obkMatthias Krüger-132/+105
Clean ConstProp Small simplifications from the time when there that pass output lints.
2023-02-21Rollup merge of #108313 - chenyukang:yukang/fix-only-modified, r=oli-obkMatthias Krüger-1/+2
Fix compiletest possible crash in option only-modified `fixed` files maybe removed, `unwrap` will crash in this scenario.
2023-02-21Rollup merge of #108306 - klensy:compiletest-up, r=wesleywiserMatthias Krüger-47/+40
compiletest: up deps update `miow` 0.3.7 -> 0.5.0 (which moved from `winapi` to `windows-rs`, [changelog](https://github.com/yoshuawuyts/miow/blob/master/CHANGELOG.md#v050---2022-11-10)) replace `lazy_static` with `once_cell` (there is slow transition to the second crate, in hope of eventually stable stdlib version, yes?)
2023-02-21Rollup merge of #108295 - compiler-errors:wtf-is-this, r=cjgillotMatthias Krüger-187/+193
Use DefKind to give more item kind information during BindingObligation note The current label says "required by a bound in this". When I see that label, my immediate impression is "this... **what**?". It feels like it was cut short. Alternative to this would be saying "in this item", but adding the item kind is strictly more informational and adds very little overhead to the existing error presentation.
2023-02-21Rollup merge of #108202 - ↵Matthias Krüger-1/+27
compiler-errors:non_lifetime_binders-type-match-ice, r=davidtwco Make sure `test_type_match` doesn't ICE with late-bound types Fixes #108190 (in a kind of hacky way, anyways doesn't really matter)
2023-02-21Rollup merge of #104239 - b-naber:sccs-info, r=jackh726Matthias Krüger-68/+438
Better debug logs for borrowck constraint graph It's really cumbersome to work with `RegionVar`s when trying to debug borrowck code or when trying to understand how the borrowchecker works. This PR collects some region information (behind `cfg(debug_assertions)`) for created `RegionVar`s (NLL region vars, this PR doesn't touch canonicalization) and prints the nodes and edges of the strongly connected constraints graph using representatives that use that region information (either lifetime names, locations in MIR or spans).
2023-02-21address reviewb-naber-17/+31
2023-02-21hir-analysis: make one diagnostic translatableTshepang Mbambo-4/+13
2023-02-21Auto merge of #108307 - jedisct1:z-link-flags, r=wesleywiserbors-8/+8
Linker: use -z <params> instead of -z<params> The GNU linker accepts -z<params>, but this is undocumented, and not supported by other linkers. In particular, `zig cc`, when used as the C compiler/linker (e.g. when using `cargo-zigbuild`), will not accept this undocumented syntax. In `linker.rs`, both syntaxes are also used inconsistently. The Go compiler used to have the same issue, but fixed it: https://github.com/golang/go/commit/38607c553878da21b5042e63997ecb3b7201e684
2023-02-21Remove unused FileDesc::get_cloexecTomasz Miąsko-5/+0
2023-02-21replace lazy_static with once_cellklensy-45/+38
2023-02-21Auto merge of #108311 - oli-obk:invert_defines, r=lcnrbors-26/+51
Make hidden type registration opt-in, so that each site can be reviewed on its own and we have the right defaults for trait solvers r? `@lcnr` pulled out of https://github.com/rust-lang/rust/pull/107891 as it is the uncontroversial part
2023-02-21Fix compiletest crash when test file path does not existyukang-1/+2
2023-02-21Add regression test for #108281Guillaume Gomez-0/+25
2023-02-21Fix duplicated attributes for first reexportGuillaume Gomez-7/+17
2023-02-21Make hidden type registration opt-in, so that each site can be reviewed on ↵Oli Scherer-26/+51
its own and we have the right defaults for trait solvers
2023-02-21Linker: use -z <params> instead of -z<params>Frank Denis-8/+8
The GNU linker accepts -z<params>, but this is undocumented, and not supported by other linkers. In particular, `zig cc`, when used as the C compiler/linker (e.g. when using `cargo-zigbuild`), will not accept this undocumented syntax. In `linker.rs`, both syntaxes are also used inconsistently. The Go compiler used to have the same issue, but fixed it: https://github.com/golang/go/commit/38607c553878da21b5042e63997ecb3b7201e684
2023-02-21Revert "Copy `bin/*` and `lib/*.dylib` files to `stage0-sysroot`"Jakub Beránek-66/+0
This reverts commit 6990ab9ad2cde9b67073ffac29ffecc2be8e722f.
2023-02-21Fix overlapping spans in removing extra argumentsclubby789-39/+76
2023-02-21Auto merge of #108138 - compiler-errors:malformed-fn-trait, r=TaKO8Kibors-74/+221
Move `Fn*` traits malformedness protections to typeck I found it strange that we were doing a custom well-formedness check just for the `Fn*` traits' `call_*` fn items. My understanding from the git history is that this is just to avoid ICEs later on in typeck. Well, that well-formedness check isn't even implemented correctly for `FnOnce::call_once`, or `FnMut::call_mut` for that matter. Instead, this PR just makes the typeck checks more robust, and leaves it up to the call-site to report errors when lang items are implemented in funny ways. This coincidentally fixes another ICE where a the `Add` lang item is implemented with a `add` item that's a const instead of a method.
2023-02-21compiletest: bump miow crateklensy-2/+2
2023-02-21Auto merge of #108301 - Dylan-DPC:rollup-70zpkt0, r=Dylan-DPCbors-323/+429
Rollup of 7 pull requests Successful merges: - #108000 (lint: don't suggest MaybeUninit::assume_init for uninhabited types) - #108105 (Explain the default panic hook better) - #108141 (Add rpitit queries) - #108272 (docs: wrong naming convention in struct keyword doc) - #108285 (remove unstable `pick_stable_methods_before_any_unstable` flag) - #108289 (Name placeholder in some region errors) - #108290 (Add a test for default trait method with RPITITs) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2023-02-21Revert "port over symlink_file function from Build to Config and create ↵Jakub Beránek-20/+12
symlink for legacy rustfmt path" This reverts commit 41c6c5d4996728b5a635319ef9b077a3d0ccc480.
2023-02-21Rollup merge of #108290 - compiler-errors:rpitit-trait-default-constraint, ↵Dylan DPC-0/+28
r=oli-obk Add a test for default trait method with RPITITs This didn't work in #107013, but now that #108203 has landed, let's make sure we don't regress it. r? types
2023-02-21Rollup merge of #108289 - compiler-errors:name-placeholder, r=petrochenkovDylan DPC-10/+22
Name placeholder in some region errors Also don't print `ReVar` or `ReLateBound` as debug... these error messages are super uncommon anyways, but in the case they do trigger, let's be slightly more helpful.
2023-02-21Rollup merge of #108285 - BoxyUwU:remove_pick_stable_before_unstable_flag, ↵Dylan DPC-234/+178
r=oli-obk remove unstable `pick_stable_methods_before_any_unstable` flag This flag was only added in #90329 in case there was any issue with the impl so that it would be easy to tell nightly users to use the flag to disable the new logic to fix their code. It's now been enabled for two years and also I can't find any issues corresponding to this new functionality? This flag made it way harder to understand how this code works so it would be nice to remove it and simplify what's going on. cc `@nbdd0121` r? `@oli-obk`