about summary refs log tree commit diff
path: root/src
AgeCommit message (Collapse)AuthorLines
2022-04-29Add a bathroom stall to weird expressions testThom Chiovoloni-0/+7
2022-04-29Auto merge of #96566 - Dylan-DPC:rollup-fo7rd98, r=Dylan-DPCbors-285/+326
Rollup of 6 pull requests Successful merges: - #96390 (Switch JS code to ES6 - part 2) - #96527 (RustWrapper: explicitly don't handle DXILPointerTyID) - #96536 (rustdoc: fix missing method list for primitive deref target) - #96559 (Use the correct lifetime binder for elided lifetimes in path.) - #96560 (Remove unnecessary environment variable in cf-protection documentation) - #96562 (Fix duplicate directory separator in --remap-path-prefix.) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-04-29Rollup merge of #96562 - michaelwoerister:path-remapping-fixes, r=oli-obkDylan DPC-1/+1
Fix duplicate directory separator in --remap-path-prefix. The compiler will currently emit duplicate directory separators when `--remap-path-prefix` has an exact match of the working directory and it is invoked with a relative path to the main source file. For example ```bash rustc src/main.rs -Cdebuginfo=2 --remap-path-prefix="$(pwd)=abc" ``` will produce the path `abc//src/main.rs` in debuginfo. This is because `some_path.join("")` will append a directory separator to `some_path` and then LLVM does not check if the working directory already ends a directory separator before concatenating it with the relative path.
2022-04-29Rollup merge of #96560 - abrown:update-docs, r=Dylan-DPCDylan DPC-1/+1
Remove unnecessary environment variable in cf-protection documentation Before merging the `cf-protection` flag, it was necessary to use a locally-compiled version of `rustc`. This is no longer the case and the documentation should reflect this.
2022-04-29Rollup merge of #96559 - cjgillot:elided-path-fn, r=petrochenkovDylan DPC-0/+19
Use the correct lifetime binder for elided lifetimes in path. Fixes https://github.com/rust-lang/rust/issues/96540
2022-04-29Rollup merge of #96536 - rust-lang:notriddle/deref-slice-core, r=GuillaumeGomezDylan DPC-38/+72
rustdoc: fix missing method list for primitive deref target This change makes it so that local impls count when listing primitives that need retained. Fixes #95325
2022-04-29Rollup merge of #96390 - GuillaumeGomez:es6-part2, r=notriddleDylan DPC-245/+233
Switch JS code to ES6 - part 2 Part of #93058. It's based on https://github.com/rust-lang/rust/pull/96361 so it needs to wait for it to be merged first. r? `@notriddle`
2022-04-29Auto merge of #95819 - oli-obk:mir_can't_hold_all_these_lifetimes, r=estebankbors-55/+131
Enforce Copy bounds for repeat elements while considering lifetimes fixes https://github.com/rust-lang/rust/issues/95477 this is a breaking change in order to fix a soundness bug. Before this PR we only checked whether the repeat element type had an `impl Copy`, but not whether that impl also had the appropriate lifetimes. E.g. if the impl was for `YourType<'static>` and not a general `'a`, then copying any type other than a `'static` one should have been rejected, but wasn't. r? `@lcnr`
2022-04-29Fix duplicate directory separator in --remap-path-prefix.Michael Woerister-1/+1
2022-04-29Remove unnecessary environment variable in cf-protection documentationAndrew Brown-1/+1
Before merging the `cf-protection` flag, it was necessary to use a locally-compiled version of `rustc`. This is no longer the case and the documentation should reflect this.
2022-04-29Use the correct lifetime binder for elided lifetimes in path.Camille GILLOT-0/+19
2022-04-29rustdoc: prevent B -> C -> B -> C loops from stack overflowingMichael Howell-3/+12
2022-04-29Auto merge of #96468 - davidtwco:diagnostic-translation-subdiagnostic, r=oli-obkbors-80/+1090
macros: subdiagnostic derive Add a new macro, `#[derive(SessionSubdiagnostic)]`, which can be applied to structs that represent subdiagnostics, such as labels, notes, helps or suggestions. `#[derive(SessionSubdiagnostic)]` can be used with the existing `#[derive(SessionDiagnostic)]`. All diagnostics implemented using either derive are translatable, and this new derive should make it easier to port existing diagnostics to using these derives. For example, consider the following subdiagnostic types... ```rust #[derive(SessionSubdiagnostic)] pub enum ExpectedIdentifierLabel<'tcx> { #[label(slug = "parser-expected-identifier")] WithoutFound { #[primary_span] span: Span, } #[label(slug = "parser-expected-identifier-found")] WithFound { #[primary_span] span: Span, found: String, } } #[derive(SessionSubdiagnostic)] #[suggestion_verbose(slug = "parser-raw-identifier")] pub struct RawIdentifierSuggestion<'tcx> { #[primary_span] span: Span, #[applicability] applicability: Applicability, ident: Ident, } ``` ...and the corresponding Fluent messages: ```fluent parser-expected-identifier = expected identifier parser-expected-identifier-found = expected identifier, found {$found} parser-raw-identifier = escape `{$ident}` to use it as an identifier ``` These can be emitted using the new `subdiagnostic` function on `Diagnostic`... ```rust diag.subdiagnostic(ExpectedIdentifierLabel::WithoutFound { span }); diag.subdiagnostic(RawIdentifierSuggestion { span, applicability, ident }); ``` ...or as part of a larger `#[derive(SessionDiagnostic)]`: ```rust #[derive(SessionDiagnostic)] #[error(slug = "parser-expected-identifier")] pub struct ExpectedIdentifier { #[primary_span] span: Span, token_descr: String, #[subdiagnostic] label: ExpectedIdentifierLabel, #[subdiagnostic] raw_identifier_suggestion: Option<RawIdentifierSuggestion>, } ``` ```rust sess.emit_err(ExpectedIdentifier { ... }); ``` r? `@oli-obk` cc `@pvdrz`
2022-04-29Rollup merge of #96523 - nbdd0121:windows, r=petrochenkovDylan DPC-0/+12
Add `@feat.00` symbol to symbols.o for COFF Fix #96498 This is based on top of #96444. r? ``@petrochenkov``
2022-04-29Rollup merge of #96516 - oli-obk:impl_trait_inference_accidental_permitted, ↵Dylan DPC-574/+113
r=jackh726 Revert diagnostic duplication and accidental stabilization fixes #96460 this is an accidental stabilization that we should put into the beta. I believe it is low-risk, because it was literally what we had before #94081 The effect on tests is massive, but mostly deduplication of diagnostics and some minor span changes.
2022-04-29Auto merge of #96444 - nbdd0121:used2, r=petrochenkovbors-0/+13
Use decorated names for linked_symbols on Windows Fix #96423 r? `@petrochenkov`
2022-04-29macros: add interop between diagnostic derivesDavid Wood-2/+13
Add `#[subdiagnostic]` field attribute to the diagnostic derive which is applied to fields that have types which use the subdiagnostic derive. Signed-off-by: David Wood <david.wood@huawei.com>
2022-04-29macros: allow setting applicability in attributeDavid Wood-3/+45
In the initial implementation of the `SessionSubdiagnostic`, the `Applicability` of a suggestion can be set both as a field and as part of the attribute, this commit adds the same support to the original `SessionDiagnostic` derive. Signed-off-by: David Wood <david.wood@huawei.com>
2022-04-29macros: reuse `SetOnce` trait in diagnostic deriveDavid Wood-36/+91
`SetOnce` trait was introduced in the subdiagnostic derive to simplify the code a little bit, re-use it in the diagnostic derive too. Signed-off-by: David Wood <david.wood@huawei.com>
2022-04-29macros: add helper functions for invalid attrsDavid Wood-62/+76
Remove some duplicated code between both diagnostic derives by introducing helper functions for reporting an error in case of a invalid attribute. Signed-off-by: David Wood <david.wood@huawei.com>
2022-04-29macros: subdiagnostic deriveDavid Wood-0/+888
Add a new derive, `#[derive(SessionSubdiagnostic)]`, which enables deriving structs for labels, notes, helps and suggestions. Signed-off-by: David Wood <david.wood@huawei.com>
2022-04-29tests: move diagnostic derive test to directoryDavid Wood-41/+41
Move existing test for session diagnostic derive to a subdirectory. Signed-off-by: David Wood <david.wood@huawei.com>
2022-04-29errors: `span_suggestion` takes `impl ToString`David Wood-3/+3
Change `span_suggestion` (and variants) to take `impl ToString` rather than `String` for the suggested code, as this simplifies the requirements on the diagnostic derive. Signed-off-by: David Wood <david.wood@huawei.com>
2022-04-28rustdoc: fix missing method list for primitive deref targetMichael Howell-35/+60
This change makes it so that local impls count when listing primitives that need retained.
2022-04-28Auto merge of #96393 - joboet:pthread_parker, r=thomccbors-1/+1
std: directly use pthread in UNIX parker implementation `Mutex` and `Condvar` are being replaced by more efficient implementations, which need thread parking themselves (see #93740). Therefore we should use the `pthread` synchronization primitives directly. Also, we can avoid allocating the mutex and condition variable because the `Parker` struct is being placed in an `Arc` anyways. This basically is just a copy of the current `Mutex` and `Condvar` code, which will however be removed (again, see #93740). An alternative implementation could be to use dedicated private `OsMutex` and `OsCondvar` types, but all the other platforms supported by std actually have their own thread parking primitives. I used `Pin` to guarantee a stable address for the `Parker` struct, while the current implementation does not, rather using extra unsafe declaration. Since the thread struct is shared anyways, I assumed this would not add too much clutter while being clearer.
2022-04-28Add `@feat.00` symbol to symbols.o for COFFGary Guo-0/+12
2022-04-28Auto merge of #96528 - Dylan-DPC:rollup-iedbjli, r=Dylan-DPCbors-58/+320
Rollup of 5 pull requests Successful merges: - #95312 (Ensure that `'_` and GAT yields errors) - #96405 (Migrate ambiguous plus diagnostic to the new derive macro) - #96409 (Recover suggestions to introduce named lifetime under NLL) - #96433 (rustc_ast: Harmonize delimiter naming with `proc_macro::Delimiter`) - #96480 (Fixed grammatical error in example comment) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-04-28Rollup merge of #96433 - petrochenkov:delim, r=nnethercoteDylan DPC-58/+58
rustc_ast: Harmonize delimiter naming with `proc_macro::Delimiter` Compiler cannot reuse `proc_macro::Delimiter` directly due to extra impls, but can at least use the same naming. After this PR the only difference between these two enums is that `proc_macro::Delimiter::None` is turned into `token::Delimiter::Invisible`. It's my mistake that the invisible delimiter is called `None` on stable, during the stabilization I audited the naming and wrote the docs, but missed the fact that the `None` naming gives a wrong and confusing impression about what this thing is. cc https://github.com/rust-lang/rust/pull/96421 r? ``@nnethercote``
2022-04-28Rollup merge of #96409 - ↵Dylan DPC-0/+220
marmeladema:fix-nll-introduce-named-lifetime-suggestion, r=jackh726 Recover suggestions to introduce named lifetime under NLL Fixes #96157 r? ```@jackh726``` Built on top of #96385 so only the second commit is relevant
2022-04-28Rollup merge of #95312 - marmeladema:tests-for-issue-95305, r=jackh726Dylan DPC-0/+42
Ensure that `'_` and GAT yields errors Fixes #95305 ```@bors``` r? ```@jackh726```
2022-04-28Update LLVM submoduleJakub Beránek-0/+0
2022-04-28Update LLVM used for building rustc in CI for x64 to LLVM 14.0.2Jakub Beránek-2/+7
2022-04-28std: update debuginfo check to match type definitionjoboet-1/+1
2022-04-28Revert diagnostic duplication and accidental stabilizationOli Scherer-574/+113
2022-04-28Update the diagnostic message to match the new spanOli Scherer-12/+12
2022-04-28Add new repeat expr test.Oli Scherer-1/+17
Also add repeat expr test folder and move all related tests to it
2022-04-28Check that repeat expression elements are Copy (ignoring lifetimes) in ↵Oli Scherer-42/+102
typeck and that they are Copy (with proper lifetime checks) in borrowck
2022-04-28rustc_ast: Harmonize delimiter naming with `proc_macro::Delimiter`Vadim Petrochenkov-58/+58
2022-04-28Auto merge of #96503 - ehuss:update-cargo, r=ehussbors-0/+0
Update cargo 8 commits in edffc4ada3d77799e5a04eeafd9b2f843d29fc23..f63f23ff1f1a12ede8585bbd1bbf0c536e50293d 2022-04-19 17:38:29 +0000 to 2022-04-28 03:15:50 +0000 - move workspace inheritance untable docs to the correct place (rust-lang/cargo#10609) - Cargo add support for workspace inheritance (rust-lang/cargo#10606) - chore: Upgrade toml_edit (rust-lang/cargo#10603) - Mark .cargo/git and .cargo/registry as cache dirs (rust-lang/cargo#10553) - fix(yank): Use '--version' like install (rust-lang/cargo#10575) - Disallow setting registry tokens with --config (rust-lang/cargo#10580) - Set cargo --version git hash length to 9 (rust-lang/cargo#10579) - Prefer `key.workspace = true` to `key = { workspace = true }` (rust-lang/cargo#10584)
2022-04-27Update cargoEric Huss-0/+0
2022-04-28Auto merge of #96085 - jsgf:deny-unused-deps, r=compiler-errorsbors-4/+84
Make sure `-Dunused-crate-dependencies --json unused-externs` makes rustc exit with error status This PR: - fixes compiletest to understand unused extern notifications - adds tests for `--json unused-externs` - makes sure that deny-level unused externs notifications are treated as compile errors - refactors the `emit_unused_externs` callstack to plumb through the level as an enum as a string, and adds `Level::is_error` Update: adds `--json unused-externs-silent` with the original behaviour since Cargo needs it. Should address `@est31's` concerns. Fixes: https://github.com/rust-lang/rust/issues/96068
2022-04-28Auto merge of #96495 - Dylan-DPC:rollup-9lm4tpp, r=Dylan-DPCbors-5/+28
Rollup of 7 pull requests Successful merges: - #96377 (make `fn() -> _ { .. }` suggestion MachineApplicable) - #96397 (Make EncodeWide implement FusedIterator) - #96421 (Less `NoDelim`) - #96432 (not need `Option` for `dbg_scope`) - #96466 (Better error messages when collecting into `[T; n]`) - #96471 (replace let else with `?`) - #96483 (Add missing `target_feature` to the list of well known cfg names) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-04-28Rollup merge of #96471 - BoxyUwU:let_else_considered_harmful, r=lcnrDylan DPC-1/+1
replace let else with `?` r? `@oli-obk`
2022-04-28Rollup merge of #96466 - compiler-errors:error-collect-array, r=davidtwcoDylan DPC-2/+25
Better error messages when collecting into `[T; n]` Fixes #96461
2022-04-28Rollup merge of #96421 - nnethercote:less-NoDelim, r=petrochenkovDylan DPC-2/+2
Less `NoDelim` Currently there are several places where `NoDelim` (which really means "implicit delimiter" or "invisible delimiter") is used to mean "no delimiter". The name `NoDelim` is a bit misleading, and may be a cause. This PR changes these places, e.g. by changing a `DelimToken` to `Option<DelimToken>` and then using `None` to mean "no delimiter". As a result, the *only* place where `NoDelim` values are now produced is within: - `Delimiter::to_internal()`, when converting from `Delimiter::None`. - `FlattenNonterminals::process_token()`, when converting `TokenKind::Interpolated`. r? ````@petrochenkov````
2022-04-27Auto merge of #91557 - cjgillot:ast-lifetimes-named, r=petrochenkovbors-4/+17
Perform lifetime resolution on the AST for lowering Lifetime resolution is currently implemented several times. Once during lowering in order to introduce in-band lifetimes, and once in the resolve_lifetimes query. However, due to the global nature of lifetime resolution and how it interferes with hygiene, it is better suited on the AST. This PR implements a first draft of lifetime resolution on the AST. For now, we specifically target named lifetimes and everything we need to remove lifetime resolution from lowering. Some diagnostics have already been ported, and sometimes made more precise using available hygiene information. Follow-up PRs will address in particular the resolution of anonymous lifetimes on the AST. We reuse the rib design of the current resolution framework. Specific `LifetimeRib` and `LifetimeRibKind` types are introduced. The most important variant is `LifetimeRibKind::Generics`, which happens each time we encounter something which may introduce generic lifetime parameters. It can be an item or a `for<...>` binder. The `LifetimeBinderKind` specifies how this rib behaves with respect to in-band lifetimes. r? `@petrochenkov`
2022-04-28Ensure that `'_` and GAT yields errorsmarmeladema-0/+42
2022-04-27Recover suggestions to introduce named lifetime under NLLmarmeladema-0/+220
2022-04-27Bless tests.Camille GILLOT-4/+17
2022-04-27Add --json unused-externs-silent with original behaviourJeremy Fitzhardinge-4/+15
Since Cargo wants to do its own fatal error handling for unused dependencies, add the option `--json unused-externs-silent` which has the original behaviour of not indicating non-zero exit status for `deny`/`forbid`-level unused dependencies.