Commit Graph

634 Commits

Author SHA1 Message Date
bors
40fda7b3fe Auto merge of #107318 - matthiaskrgr:rollup-776kd81, r=matthiaskrgr
Rollup of 9 pull requests

Successful merges:

 - #97373 (impl DispatchFromDyn for Cell and UnsafeCell)
 - #106625 (Remove backwards compat for LLVM 12 coverage format)
 - #106779 (Avoid __cxa_thread_atexit_impl on Emscripten)
 - #106811 (Append .dwp to the binary filename instead of replacing the existing extension.)
 - #106836 (Remove optimistic spinning from `mpsc::SyncSender`)
 - #106946 (implement Hash for proc_macro::LineColumn)
 - #107074 (remove unnecessary check for opaque types)
 - #107287 (Improve fn pointer notes)
 - #107304 (Use `can_eq` to compare types for default assoc type error)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-01-26 09:14:05 +00:00
Matthias Krüger
b2448f9f9c
Rollup merge of #106625 - Swatinem:ref/cov6, r=nagisa
Remove backwards compat for LLVM 12 coverage format

The minimum external LLVM was updated to 13 recently in https://github.com/rust-lang/rust/pull/100611, so this PR removes backwards compat with older coverage formats.

I kept the version check and error message there, in accordance with this comment: https://github.com/rust-lang/rust/pull/91207#issuecomment-981121867
2023-01-26 07:53:22 +01:00
Matthias Krüger
8ae5116fae
Rollup merge of #106407 - mejrs:attr_check, r=compiler-errors
Improve proc macro attribute diagnostics

Closes https://github.com/rust-lang/rust/issues/102923
2023-01-26 06:15:23 +01:00
inquisitivecrystal
05b7cc8370 Move FFI attribute validation to check_attr 2023-01-24 02:19:04 -08:00
Edward Shen
a8b77cfe54
Add suggestion to remove if in let...else block
Adds an additional hint to failures where we encounter an else keyword
while we're parsing an if-let block.

This is likely that the user has accidentally mixed if-let and let...else
together.
2023-01-23 20:33:04 -08:00
Matthias Krüger
6e79310c55
Rollup merge of #107111 - chenyukang:yukang/fix-107090-fluent-parameters, r=petrochenkov
Fix missing arguments issues and copy-paste bug for fluent

Fixes #107090
2023-01-22 11:43:06 +01:00
bors
a6269dad38 Auto merge of #107106 - matthiaskrgr:rollup-g7r1ep0, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - #106699 ([drop tracking] Visit break expressions )
 - #106738 (Fix known-bug annotations)
 - #106891 (Tweak "borrow closure argument" suggestion)
 - #106928 (add raw identifier for keyword in suggestion)
 - #107065 (Clippy: Make sure to include in beta: Move `unchecked_duration_subtraction` to pedantic)
 - #107068 (autoderive Subdiagnostic for AddtoExternBlockSuggestion)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-01-20 15:28:40 +00:00
clubby789
f3cde8e9da Fix broken format strings in infer.ftl 2023-01-19 23:13:01 +00:00
mejrs
cc5af33d64 Autoderive ExternBlockSuggestion 2023-01-19 13:52:15 +01:00
yukang
0368adb262 Fix #107090, fix missing arguments for fluent 2023-01-18 22:53:24 +08:00
mejrs
6fe4cf795b Migrate mir_build's borrow conflicts 2023-01-17 13:48:43 +01:00
Oli Scherer
64e5f9129f Handle diagnostics customization on the fluent side 2023-01-17 08:21:34 +00:00
Oli Scherer
1a6ab6c16a Empty regions don't exist anymore, remove them from fluent 2023-01-17 08:00:01 +00:00
Matthias Krüger
9bcc46ee90
Rollup merge of #106949 - compiler-errors:is-poly, r=BoxyUwU
ConstBlocks are poly if their substs are poly

r? `@BoxyUwU`

fixes #106926
2023-01-17 05:25:23 +01:00
Matthias Krüger
f74044259a
Rollup merge of #106591 - Ezrashaw:attempted-integer-identifer, r=Estebank
suggestion for attempted integer identifier in patterns

Fixes #106552

Implemented a suggestion on `E0005` that occurs when no bindings are present and the pattern is a literal integer.
2023-01-17 05:25:21 +01:00
Michael Goulet
9f6fef9657 Properly pluralize 'generic constants' 2023-01-16 20:21:29 +00:00
Oli Scherer
6b69b5e460 Improve a TAIT error and add an error code plus documentation 2023-01-16 16:54:14 +00:00
Ezra Shaw
1babece1e8
suggest fix for attempted integer identifier in patterns 2023-01-14 12:51:20 +13:00
Matthias Krüger
e4d0104754
Rollup merge of #106678 - Veykril:proc-macro-panic-abort, r=eholk
Warn when using panic-strategy abort for proc-macro crates

See https://github.com/rust-lang/rust/issues/82320, this simply warns for now as that seems like the best step that can be immediately taken (opposed to straight up rejecting or ignoring)
2023-01-13 19:16:43 +01:00
bors
5ca6f7d2c3 Auto merge of #106801 - JohnTitor:rollup-xqkraw0, r=JohnTitor
Rollup of 6 pull requests

Successful merges:

 - #106608 (Render missing generics suggestion verbosely)
 - #106716 ([RFC 2397] Deny incorrect locations)
 - #106754 (Rename `Ty::is_ty_infer` -> `Ty::is_ty_or_numeric_infer`)
 - #106782 (Ignore tests move in git blame)
 - #106785 (Make blame spans better for impl wfcheck)
 - #106791 (Fix ICE formatting)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-01-13 10:56:53 +00:00
Lukas Wirth
549ece7033 Warn when using panic-strategy abort for proc-macro crates 2023-01-13 10:13:49 +01:00
Yuki Okushi
f6f362c332
Rollup merge of #106716 - c410-f3r:rfc-2397-1, r=davidtwco
[RFC 2397] Deny incorrect locations

cc #51992

As declared in the RFC, `#[do_not_recommend]` should only be applicable on trait implementations.
2023-01-13 16:54:23 +09:00
bors
4a04f252f9 Auto merge of #106092 - asquared31415:start_lang_item_checks, r=davidtwco
Add checks for the signature of the `start` lang item

Closes #105963
2023-01-13 07:45:34 +00:00
bors
bfffe406fb Auto merge of #101138 - Rejyr:diagnostic-migration-rustc-lint-pt2, r=davidtwco
Migrate `rustc_lint` lint diagnostics

Part 2 of [Migrate `rustc_lint` errors to `SessionDiagnostic`](https://github.com/rust-lang/rust/pull/100776)

r? `@davidtwco`

# TODO
- [x] Refactor some lints manually implementing `DecorateLint` to use `Option<Subdiagnostic>`.
- [x] Add `#[rustc_lint_diagnostics]` to lint functions in `context.rs`.
- [x] Migrate `hidden_unicode_codepoints.rs`.
- [x] Migrate `UnsafeCode` in `builtin.rs`.
- [x] Migrate the rest of `builtin.rs`.
2023-01-13 02:13:00 +00:00
nils
c61f29ca52
Rollup merge of #106714 - Ezrashaw:remove-e0490, r=davidtwco
remove unreachable error code `E0490`

AFAIK, the untested and undocumented error code `E0490` is now unreachable, it was from the days of the original borrow checker.

cc ``@GuillaumeGomez`` #61137
2023-01-12 15:44:52 +01:00
Caio
7dd45bafb4 [RFC 2397] Deny incorrect locations 2023-01-12 08:41:21 -03:00
Michael Goulet
9928b14772
Rollup merge of #106170 - compiler-errors:autoderef-to-analysis, r=lcnr
Move autoderef to `rustc_hir_analysis`

Not sure if this is a change we actually want, but autoderef really is only (functionally) used by `rustc_hir_analysis` and `rustc_hir_typeck`, so it probably should live there.

Instead, implement a separate autoderef helper in `TypeErrCtxt` for the one use-case that  goes against the ordering of the crate graph..
2023-01-11 22:25:48 -08:00
Michael Goulet
83d3b76ac2
Rollup merge of #106097 - mejrs:mir_build2, r=oli-obk
Migrate mir_build diagnostics 2 of 3

The first three commits are fairly boring, however I've made some changes to the output of the match checking diagnostics.
2023-01-11 22:25:47 -08:00
bors
d4203eda5f Auto merge of #106537 - fmease:recover-where-clause-before-tuple-struct-body, r=estebank
Recover from where clauses placed before tuple struct bodies

Open to any suggestions regarding the phrasing of the diagnostic.

Fixes #100790.
`@rustbot` label A-diagnostics
r? diagnostics
2023-01-12 02:16:16 +00:00
Ezra Shaw
02005e9f22
remove unreachable error code E0490 2023-01-12 14:15:21 +13:00
mejrs
f92000816e Improve proc macro attribute diagnostics 2023-01-12 00:11:11 +01:00
mejrs
372ac9c1a2
Translate Overlap eagerly 2023-01-11 14:40:13 -08:00
mejrs
8476c517c0
Don't recommend if let if let else works 2023-01-11 14:40:07 -08:00
mejrs
31c20210b9
Migrate pattern matching 2023-01-11 14:40:02 -08:00
mejrs
ef33072890
Migrate usefulness.rs 2023-01-11 14:39:59 -08:00
mejrs
5d2b9a9ed0
Migrate deconstruct_pat.rs 2023-01-11 14:39:49 -08:00
mejrs
519b1abd19
Translate const_to_pat.rs 2023-01-11 14:39:27 -08:00
asquared31415
337a97d374
add checks for the signature of the lang item 2023-01-11 14:35:08 -08:00
Michael Goulet
c8334ce60c Move autoderef to rustc_hir_analysis 2023-01-11 20:12:57 +00:00
Matthias Krüger
88765b0f59
Rollup merge of #106622 - estebank:issue-68972, r=davidtwco
Detect out of bounds range pattern value

Fix #68972.
2023-01-11 21:08:07 +01:00
León Orell Valerian Liehr
70ddde76df
parser: recover from where clauses placed before tuple struct bodies 2023-01-11 17:54:48 +01:00
Esteban Küber
5311938531 Detect struct literal needing parentheses
Fix #82051.
2023-01-11 16:53:21 +00:00
Esteban Küber
52d534ef63 Detect out of bounds range pattern value
Fix #68972.
2023-01-11 16:50:55 +00:00
Rejyr
fe09291036 migrate: deref_into_dyn_supertrait.rs 2023-01-09 18:57:02 -05:00
Rejyr
758140e196 migrate: rest of builtin.rs without builtin_asm_labels 2023-01-09 18:56:59 -05:00
Rejyr
78fce795d8 refactor: refactor to derive for some lints. 2023-01-09 17:07:25 -05:00
Rejyr
ca7df9a2a9 migrate: for_loops_over_fallibles.rs 2023-01-09 17:07:25 -05:00
Rejyr
6ffecd2059 migrate(wip): builtin.rs 2023-01-09 17:07:25 -05:00
Rejyr
0b19227524 migrate: internal.rs 2023-01-09 17:07:25 -05:00
Rejyr
e610047940 migrate: let_underscore.rs
fix: NonBindingLetSub
2023-01-09 17:07:25 -05:00
Rejyr
80df25e160 migrate: levels.rs 2023-01-09 17:07:25 -05:00
Rejyr
ab66ea61cf add: emit{,_spanned}_lint for LintLevelsBuilder
add: `emit_spanned_lint` and `emit_lint` for `LintLevelsBuilder`
migrate: `DeprecatedLintName`
2023-01-09 17:07:25 -05:00
Arpad Borsos
9f5a933f00
Remove backwards compat for LLVM 12 coverage format 2023-01-09 16:31:24 +01:00
Michael Goulet
49f849a3d2 Mention signature rather than fn pointers when comparing impl/trait methods 2023-01-08 03:49:24 +00:00
Matthias Krüger
771cfa5581
Rollup merge of #104543 - JhonnyBillM:migrate-codegen-ssa-to-diagnostics-structs-pt3, r=davidtwco
Migrate `codegen_ssa` to diagnostics structs - [Part 3]

Completes migrating `codegen_ssa` module except 2 outstanding errors that depend on other crates:
1. [`rustc_middle::mir::interpret::InterpError`](b6097f2e1b/compiler/rustc_middle/src/mir/interpret/error.rs (L475)): I saw `rustc_middle` is unassigned, I am open to take this work.

2.  `codegen_llvm`'s use of `fn span_invalid_monomorphization_error`, which I started to replace in the [last commit](9a31b3cdda) of this PR, but would like to know the team's preference on how we should keep replacing the other macros:
2.1. Update macros to expect a `Diagnostic`
2.2. Remove macros and expand the code on each use.
See [some examples of the different options in this experimental commit](64aee83e80)

_Part 2 - https://github.com/rust-lang/rust/pull/103792_

r? ``@davidtwco``
Cc ``@compiler-errors``
2023-01-07 20:43:19 +01:00
Matthias Krüger
405e48f1ac
Rollup merge of #101936 - IntQuant:issue-100717-infer-4, r=compiler-errors
Migrating rustc_infer to session diagnostics (part 3)

``@rustbot`` label +A-translation
r? rust-lang/diagnostics
cc https://github.com/rust-lang/rust/issues/100717

Seems like a part of static_impl_trait.rs emits suggestions in a loop, and note.rs needs to have two instances of the same subdiagnostic, so these will need to wait until we have eager translation/list support.
Other than that, there is only error_reporting/mod.rs left to migrate.
2023-01-07 20:43:18 +01:00
bors
d9e317a176 Auto merge of #106224 - bjorn3:staticlib_fixes, r=wesleywiser
Small fixes for --crate-type staticlib

The first commit doesn't have an effect until we start translating error messages. The second commit fixes potential linker errors when combining `--crate-type staticlib` with another crate type and I think `-Cprefer-dynamic`.
2023-01-04 21:35:15 +00:00
Matthias Krüger
11020b93b6
Rollup merge of #106361 - clubby789:int-literal-too-large, r=estebank
Note maximum integer literal for `IntLiteralTooLarge`

Closes #105908

`@rustbot` label +A-diagnostics
2023-01-04 07:28:56 +01:00
bors
3b1c8a94a4 Auto merge of #105609 - bjorn3:shrink_rustc_dev, r=jyn514
Only include metadata for non-dynamic libraries in rustc-dev

The actual object code should be linked from librustc_driver.so, which is still included in rustc-dev. This saves on download time and disk usage.

Fixes https://github.com/rust-lang/rust/issues/103538
2023-01-03 08:05:54 +00:00
clubby789
537c7f4fa9 Print correct base for too-large literals
Also update tests
2023-01-02 11:43:07 +00:00
clubby789
cafdd2f7bb Note maximum integer literal for IntLiteralTooLarge 2023-01-02 03:52:29 +00:00
bjorn3
7837058073 Add help for the error message when missing rustc_driver 2022-12-31 17:20:13 +00:00
Ezra Shaw
24b39ece2f
refactor: merge E0465 into E0464 2022-12-31 20:44:54 +13:00
bjorn3
0b54782cc8 Don't translate --print native-static-libs output
This breaks tools that depend on the prefix
2022-12-28 17:56:31 +00:00
Nikita Tomashevich
7ecd064bbe
Split infer_explicit_lifetime_required into several diags 2022-12-28 14:53:48 +03:00
Nikita Tomashevich
40b221814e
Rename subdiagnostic fields that do not need to be unique now 2022-12-28 14:53:48 +03:00
Nikita Tomashevich
eb7ce1703b
Use eager translation 2022-12-28 14:53:47 +03:00
Nikita Tomashevich
71d24da665
Split into several messages 2022-12-28 14:53:47 +03:00
Nikita Tomashevich
6c19c08140
More descriptive names for ActualImplExplNotes variants 2022-12-28 14:53:47 +03:00
Nikita Tomashevich
0634b0119c
Partial work on static_impl_trait.rs 2022-12-28 14:53:47 +03:00
Nikita Tomashevich
3935a81d47
Migrate trait_impl_difference.rs 2022-12-28 14:53:47 +03:00
Nikita Tomashevich
2118ff401f
Migrate placeholder_error.rs 2022-12-28 14:53:47 +03:00
Nikita Tomashevich
8360a40a8a
Migrate named_anon_conflict.rs 2022-12-28 14:53:47 +03:00
Jhonny Bill Mena
29d8c87fe8 DELETE - fn span_invalid_monomorphization_error and localize intrinsics macros 2022-12-27 20:59:22 -05:00
Jhonny Bill Mena
27744460e2 ADD - create and emit Bug support for Diagnostics
UPDATE - migrate constant span_bug to translatable diagnostic.
2022-12-27 20:59:22 -05:00
Jhonny Bill Mena
d1030fab22 UPDATE - migrate fn simd_simple_float_intrinsic error messages 2022-12-27 20:59:21 -05:00
Jhonny Bill Mena
e26366ad99 [WIP] UPDATE - migrate intrinsic.rs to new diagnostic infrastructure
WIP - replacing span_invalid_monomorphization_error function. Still in progress due to its use in codegen_llvm inside macros
2022-12-27 20:59:21 -05:00
Jhonny Bill Mena
d41112a8c5 UPDATE - migrate constant.rs to new diagnostics infrastructure 2022-12-27 20:59:21 -05:00
Jhonny Bill Mena
82cf6f204a UPDATE - migrate base.rs to new diagnostics infrastructure 2022-12-27 20:59:19 -05:00
Michael Goulet
aff403cf68 Recover fn keyword as Fn trait in bounds 2022-12-27 06:14:46 +00:00
Matthias Krüger
d23cb738d2
Rollup merge of #105975 - jeremystucki:rustc-remove-needless-lifetimes, r=eholk
rustc: Remove needless lifetimes
2022-12-24 00:31:41 +01:00
Matthias Krüger
da370fe25a
Rollup merge of #106057 - jyn514:trimmed-def-paths-ice, r=compiler-errors
Give a more helpful error for "trimmed_def_paths constructed"

cc https://rust-lang.zulipchat.com/#narrow/stream/122651-general/topic/ice.20debugging/near/315928294, https://github.com/rust-lang/rust/pull/106056

`@mejrs` do you think this would have helped you figure out the problem faster?
2022-12-23 01:17:51 +01:00
Joshua Nelson
e4330295d9 Give a more helpful error for "trimmed_def_paths construted" 2022-12-22 13:12:15 -06:00
Bryan Garza
9650a4168f Improve code based on feedback.
This patch improves the readability of some of the code by using
if-let-chains. Also, make use of the `add_feature_diagnostics` function.
2022-12-21 03:47:27 +00:00
Bryan Garza
e28a07a0a1 update wording of lint 2022-12-21 03:30:46 +00:00
Bryan Garza
dc2c4ce578 Update code based on PR comments
This patch does the following:
- Refactor some repeated lines into a single one
- Split the `ungated_async_fn_caller` lint into multiple lines, and make
  one of those lines only print out on nightly
- Use test revisions instead of copying an existing test
2022-12-21 03:30:37 +00:00
Bryan Garza
04926e0534 Switch #[track_caller] back to a no-op unless feature gate is enabled
This patch fixes a regression, in which `#[track_caller]`, which was
previously a no-op, was changed to actually turn on the behavior. This
should instead only happen behind the `closure_track_caller` feature
gate.

Also, add a warning for the user to understand how their code will
compile depending on the feature gate being turned on or not.

Fixes #104588
2022-12-21 03:23:08 +00:00
Jeremy Stucki
3dde32ca97
rustc: Remove needless lifetimes 2022-12-20 22:10:40 +01:00
mejrs
1bdf112529 Resolve various merge conflicts 2022-12-17 19:08:25 +01:00
TheOddGarlic
e71a722fa6 Migrate multiple mut borrows diagnostic 2022-12-17 19:08:25 +01:00
TheOddGarlic
3a9a06311d Migrate borrow of moved value diagnostic 2022-12-17 19:08:25 +01:00
TheOddGarlic
eeef05b318 Migrate irrefutable let pattern diagnostics 2022-12-17 19:08:25 +01:00
TheOddGarlic
e1c5073c07 Migrate pattern bindings with variant name lint 2022-12-17 19:08:25 +01:00
TheOddGarlic
6f82a00aa1 Migrate leading/trailing irrefutable let pattern diagnostics 2022-12-17 19:08:24 +01:00
TheOddGarlic
4b70784176 Migrate lower range bound diagnostics 2022-12-17 19:08:24 +01:00
TheOddGarlic
513e3995e0 Migrate "could not evaluate const pattern" diagnostic 2022-12-17 19:08:24 +01:00
TheOddGarlic
d5f821eeb0 Migrate "constant pattern depends on generic parameter" diagnostic 2022-12-17 19:08:24 +01:00
TheOddGarlic
b694e6649e Migrate unreachable pattern diagnostic 2022-12-17 19:08:24 +01:00
TheOddGarlic
98442b6905 Migrate pattern inlining error diagnostics 2022-12-17 19:08:24 +01:00
TheOddGarlic
c7bfd00719 Migrate "non-exhaustive patterns: type is non-empty" diagnostic 2022-12-17 19:08:24 +01:00