about summary refs log tree commit diff
AgeCommit message (Collapse)AuthorLines
2023-02-23Rollup merge of #108373 - tshepang:where-clause-on-main, r=compiler-errorsMatthias Krüger-10/+16
hir-analysis: make where-clause-on-main diagnostic translatable
2023-02-23Rollup merge of #108358 - Nilstrieb:git-blame-ignore-my-bad-commits, ↵Matthias Krüger-0/+2
r=compiler-errors Add git config command to `.git-blame-ignore-revs` I always have to look at the git blame for that file to find the git command in the commit message (luckily that commit isn't in the file :D), putting it directly in the file makes it easier to find. Maybe we should mention the config in some other place as well.
2023-02-23Rollup merge of #108350 - compiler-errors:assoc-type-bound-dogfooding, r=oli-obkMatthias Krüger-41/+22
Use associated type bounds in some places in the compiler Use associated type bounds for some nested `impl Trait<Assoc = impl Trait2>` cases. I'm generally keen to introduce new lang features that are more mature into the compiler, but maybe let's see what others think? Side-note: I was surprised that the only use-cases of nested impl trait in the compiler are just iterator related?!
2023-02-23Rollup merge of #108349 - GuillaumeGomez:fix-duplicated-imports2, r=notriddleMatthias Krüger-14/+64
rustdoc: Prevent duplicated imports Fixes #108163. Interestingly enough, the AST is providing us an import for each corresponding item, even though the `Res` links to multiple ones each time, which leaded to the same import being duplicated. So in this PR, I decided to prevent the add of the import before the clean pass. However, I originally took a different path by instead filtering after cleaning the path. You can see it [here](https://github.com/rust-lang/rust/compare/master...GuillaumeGomez:rust:fix-duplicated-imports?expand=1). Only the second commit differs. I think this approach is better though, but at least we can compare both if we want. The first commit adds the check for duplicated items in the rustdoc-json output as asked in #108163. cc `@aDotInTheVoid` r? `@notriddle`
2023-02-23Rollup merge of #108218 - ChrisDenton:cmd-escape, r=cuviperMatthias Krüger-1/+10
Windows: Quote more batch file arguments Make sure to always quote batch file arguments that contain command prompt special characters. Additionally add `/d` command line parameter to disable any autorun scripts that may change the way variable expansion works. This makes it more consistent across systems and may help avoid surprises. ## Background Info [`CreateProcess`](https://learn.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-createprocessw) with the `lpApplicationName` set can only be used to run `.exe` files and not script files such as `.bat`. However, for historical reasons, we do have special handling so that `.bat` files will be correctly run with `cmd.exe` as the application. In Windows, command line arguments are passed as a single string (not an array). Applications can parse this string however they like but most follow the standard MSVC C/C++ convention. But `cmd.exe` uses different argument parsing rules to other Windows programs (because it emulates old DOS). This PR aims to help smooth over some of the differences. r? libs
2023-02-23Rollup merge of #108208 - cjgillot:flood-enum, r=oli-obkMatthias Krüger-9/+120
Correctly handle aggregates in DataflowConstProp The previous implementation from https://github.com/rust-lang/rust/pull/107411 flooded target of an aggregate assignment with `Bottom`, corresponding to the `deinit` that the interpreter does. As a consequence, when assigning `target = Enum::Variant#i(...)` all the `(target as Variant#j)` were at `Bottom` while they should have been `Top`. This PR replaces that flooding with `Top`. Aside, it corrects a second bug where the wrong place would be used to assign to enum variant fields, resulting to nothing happening. Fixes https://github.com/rust-lang/rust/issues/108166
2023-02-23Rollup merge of #108063 - ↵Matthias Krüger-276/+221
compiler-errors:associated-type-bounds-in-bad-position, r=cjgillot Ban associated type bounds in bad positions We should not try to lower associated type bounds into TAITs in positions where `impl Trait` is not allowed (except for in `where` clauses, like `where T: Trait<Assoc: Bound>`). This is achieved by using the same `rustc_ast_lowering` machinery as impl-trait does to characterize positions as universal/existential/disallowed. Fixes #106077 Split out the first commit into #108066, since it's not really related.
2023-02-23Auto merge of #108324 - notriddle:notriddle/assoc-fn-method, ↵bors-700/+755
r=compiler-errors,davidtwco,estebank,oli-obk diagnostics: if AssocFn has self argument, describe as method Discussed in https://rust-lang.zulipchat.com/#narrow/stream/147480-t-compiler.2Fwg-diagnostics/topic/.22associated.20function.22.20vs.20.22method.22/near/329265515 This commit also changes the tooltips on rustdoc intra-doc links targeting methods. For anyone not sure why this is being done, see the Reference definitions of these terms in <https://doc.rust-lang.org/1.67.1/reference/items/associated-items.html#methods> > Associated functions whose first parameter is named `self` are called methods and may be invoked using the [method call operator](https://doc.rust-lang.org/1.67.1/reference/expressions/method-call-expr.html), for example, `x.foo()`, as well as the usual function call notation. In particular, while this means it's technically correct for rustc to refer to a method as an associated function (and there are a few cases where it'll still do so), rustc *must never* use the term "method" to refer to an associated function that does not have a `self` parameter.
2023-02-23hir-analysis: make where-clause-on-main diagnostic translatableTshepang Mbambo-10/+16
2023-02-22pluralize stuffMichael Goulet-111/+105
2023-02-22Suppress duplicated errors for associated type bounds in object typesMichael Goulet-137/+56
2023-02-22Auto merge of #108357 - matthiaskrgr:rollup-ceo3q2s, r=matthiaskrgrbors-121/+179
Rollup of 6 pull requests Successful merges: - #107736 ( Rename atomic 'as_mut_ptr' to 'as_ptr' to match Cell (ref #66893) ) - #108176 (Don't delay `ReError` bug during lexical region resolve) - #108315 (Lint dead code in closures and generators) - #108342 (apply query response: actually define opaque types) - #108344 (Fix test filename for #105700) - #108353 (resolve: Remove `ImportResolver`) Failed merges: - #107911 (Add check for invalid #[macro_export] arguments) r? `@ghost` `@rustbot` modify labels: rollup
2023-02-22Move associated type bounds check to ast loweringMichael Goulet-136/+168
This makes the check for when associated type bounds more accurate
2023-02-22Add git config command to `.git-blame-ignore-revs`Nilstrieb-0/+2
I always have to look at the git blame for that file to find the git command in the commit message (luckily that commit isn't in the file :D), putting it directly in the file makes it easier to find. Maybe we should mention the config in some other place as well.
2023-02-22Rollup merge of #108353 - petrochenkov:rmir, r=cjgillotMatthias Krüger-103/+87
resolve: Remove `ImportResolver` It's a trivial wrapper over `Resolver` that doesn't bring any benefits
2023-02-22Rollup merge of #108344 - Alexendoo:test-105700, r=compiler-errorsMatthias Krüger-2/+2
Fix test filename for #105700 The test is for #105700 rather than #21102
2023-02-22Rollup merge of #108342 - lcnr:opaque-tys, r=oli-obkMatthias Krüger-6/+4
apply query response: actually define opaque types not sure whether this fixes any code considering that #107891 doesn't break anything, but this is currently wrong as the `eq` there should just always fail right now. We can definitely hit this code if we remove the `replace_opaque_types_with_inference_vars` hack. Doing so without this PR causes a few tests to ICE, e.g. https://github.com/rust-lang/rust/blob/bd4a96a12d0bf6dc12edf20a45df3a33052c9d7d/tests/ui/impl-trait/issue-99642.rs#L1-L7 r? `@oli-obk`
2023-02-22Rollup merge of #108315 - clubby789:dead-code-in-closure, r=compiler-errorsMatthias Krüger-0/+39
Lint dead code in closures and generators Fixes #108296 I think this might be a potentially breaking change, but restores the behaviour of pre-1.64. `@rustbot` label +A-lint
2023-02-22Rollup merge of #108176 - compiler-errors:bad-lexical-region-resolve-bug, ↵Matthias Krüger-1/+38
r=oli-obk Don't delay `ReError` bug during lexical region resolve Lexical region resolution returns a list of `RegionResolutionError` which don't necessarily correspond to diagnostics being emitted. The compiler may, validly, throw away these resolution errors and do something else. Therefore it's not valid to use `ReError` during lifetime resolution, since we may actually be on a totally fine compilation path. For example, the `implied_bounds_entailment` lint runs region resolution twice, and only emits an error if it fails both times. If we delay a bug and create a `ReError` during this first run, then we will ICE. Fixes #108170 ---- Side-note: this is conceptually equivalent to how we can't necessarily delay bugs or create `ty::Error` during trait solving/fulfillment, since the compiler is allowed to throw away these fulfillment errors to do other things. It's only once we actually emit an error (`report_region_errors` / `report_fulfillment_errors`)
2023-02-22Rollup merge of #107736 - tgross35:atomic-as-ptr, r=m-ou-seMatthias Krüger-9/+9
Rename atomic 'as_mut_ptr' to 'as_ptr' to match Cell (ref #66893) Originally discussed in https://github.com/rust-lang/rust/issues/66893#issuecomment-1419198623 ~~This uses #107706 as a base to avoid a merge conflict once that gets rolled up (so disregard const changes in the diff until it does)~~ all merged & rebased `@rustbot` label +T-libs-api r? m-ou-se
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-22resolve: Remove `ImportResolver`Vadim Petrochenkov-103/+87
It's a trivial wrapper over `Resolver` that doesn't bring any benefits
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-22Add test to ensure there are no duplicated importsGuillaume Gomez-0/+26
2023-02-22Prevent duplicated importsGuillaume Gomez-8/+16
2023-02-22clippy: update clippy to use new `TyCtxt::def_descr`Michael Howell-2/+2
2023-02-22rustdoc: update test case with intra-doc link pointing to methodMichael Howell-4/+12
2023-02-22diagnostics: update test cases to refer to assoc fn with `self` as methodMichael Howell-636/+650
2023-02-22diagnostics: if AssocFn has self argument, describe as methodMichael Howell-58/+91
Discussed in https://rust-lang.zulipchat.com/#narrow/stream/147480-t-compiler.2Fwg-diagnostics/topic/.22associated.20function.22.20vs.20.22method.22/near/329265515 This commit also changes the tooltips on rustdoc intra-doc links targeting methods.
2023-02-22Lint dead code in closuresclubby789-0/+39
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-22Fix test filename for #105700Alex Macleod-2/+2
2023-02-22Add check to ensure there are no duplicates in rustdoc JSON output format in ↵Guillaume Gomez-6/+22
items fields
2023-02-22apply query response: actually define opaque typeslcnr-6/+4
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-22Quote more batch file argumentsChris Denton-1/+10
Make sure to quote batch file arguments that contain command prompt special characters. Additionally add `/d` command line parameter to disable any commands that may change the way variable expansion works.