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
TheOddGarlic
71a9cb9b7e
Migrate "unused unsafe" lint
2022-12-17 19:08:24 +01:00
TheOddGarlic
64f3e4f195
Migrate "requires unsafe" diagnostics
2022-12-17 19:08:24 +01:00
TheOddGarlic
71fe52fed0
Migrate "unsafe_op_in_unsafe_fn" lints
2022-12-17 19:08:24 +01:00
TheOddGarlic
82f05446a5
Migrate "function cannot return without recursing" diagnostic
2022-12-17 19:08:24 +01:00
bors
aef17b7ae6
Auto merge of #105421 - jacobbramley:jb/branch-prot-check, r=nagisa
...
Check AArch64 branch-protection earlier in the pipeline.
As suggested in #93516 .
r? `@nagisa`
2022-12-17 12:10:27 +00:00
bors
bbb9cfbbc5
Auto merge of #102318 - Amanieu:default_alloc_error_handler, r=oli-obk
...
Stabilize default_alloc_error_handler
Tracking issue: #66741
This turns `feature(default_alloc_error_handler)` on by default, which causes the compiler to automatically generate a default OOM handler which panics if `#[alloc_error_handler]` is not provided.
The FCP completed over 2 years ago but the stabilization was blocked due to an issue with unwinding. This was fixed by #88098 so stabilization can be unblocked.
Closes #66741
2022-12-16 21:08:45 +00:00
Matthias Krüger
863d1f653a
Rollup merge of #105481 - lqd:mono-stats, r=wesleywiser
...
Start improving monomorphization items stats
As described in [this zulip discussion](https://rust-lang.zulipchat.com/#narrow/stream/247081-t-compiler.2Fperformance/topic/Compile-time.20case-study.3A.20AWS.20crates/near/314560832 ), some stats about monomorphization collection would be interesting to have, in a different form than `-Zprint-mono-items`: to have some visibility into the cost of the mono items, we'd like to know how many are instantiated and what is their estimated size.
That can be a proxy to analyze sources of slow compile times, although in the future, we'd also like to add more realistic stats from the actual backend's lowering.
This PR adds a new `-Z dump-mono-stats` flag which will output some stats in a `{crate_name}.mono-items.md` file (the flag optionally takes an output directory parameter, for easier use within a workspace than printing to stdout).
For example,
```rust
fn compute<T>(collection: Vec<T>) -> usize {
collection.len() + 19 - 0 * 9 - 18 - 1 * 1 // random code to increase the function's size
}
fn main() {
dbg!(compute(vec![0u8, 1, 2]));
dbg!(compute(vec![0u64, 1, 2]));
dbg!(compute(vec!["0", "1", "2", "3"]));
}
```
will output a file with this markdown table (abridged for readability), for a debug build:
| Item | Instantiation count | Estimated Cost Per Instantiation | Total Estimated Cost |
| --- | ---: | ---: | ---: |
| alloc::alloc::box_free | 3 | 122 | 366 |
| std::alloc::Global::alloc_impl | 1 | 284 | 284 |
| alloc::raw_vec::RawVec::<T, A>::current_memory | 3 | 82 | 246 |
| std::ptr::align_offset | 1 | 222 | 222 |
| std::slice::hack::into_vec | 3 | 67 | 201 |
| <std::vec::Vec<T, A> as std::ops::Drop>::drop | 3 | 66 | 198 |
| std::ptr::mut_ptr::<impl *mut T>::is_null | 4 | 47 | 188 |
| main | 1 | 163 | 163 |
| std::ptr::NonNull::<T>::new_unchecked | 4 | 37 | 148 |
...
<details>
<summary>Click for full output</summary>
| Item | Instantiation count | Estimated Cost Per Instantiation | Total Estimated Cost |
| --- | ---: | ---: | ---: |
| alloc::alloc::box_free | 3 | 122 | 366 |
| std::alloc::Global::alloc_impl | 1 | 284 | 284 |
| alloc::raw_vec::RawVec::<T, A>::current_memory | 3 | 82 | 246 |
| std::ptr::align_offset | 1 | 222 | 222 |
| std::slice::hack::into_vec | 3 | 67 | 201 |
| <std::vec::Vec<T, A> as std::ops::Drop>::drop | 3 | 66 | 198 |
| std::ptr::mut_ptr::<impl *mut T>::is_null | 4 | 47 | 188 |
| main | 1 | 163 | 163 |
| std::ptr::NonNull::<T>::new_unchecked | 4 | 37 | 148 |
| std::boxed::Box::<T, A>::into_unique | 3 | 48 | 144 |
| std::boxed::Box::<T, A>::leak | 3 | 39 | 117 |
| std::alloc::Layout::array::inner | 1 | 107 | 107 |
| std::ptr::align_offset::mod_inv | 1 | 103 | 103 |
| std::boxed::Box::<T, A>::into_raw_with_allocator | 3 | 31 | 93 |
| std::fmt::Arguments::<'a>::new_v1 | 1 | 80 | 80 |
| <alloc::raw_vec::RawVec<T, A> as std::ops::Drop>::drop | 3 | 26 | 78 |
| alloc::raw_vec::RawVec::<T, A>::from_raw_parts_in | 3 | 26 | 78 |
| alloc::alloc::exchange_malloc | 1 | 75 | 75 |
| std::ptr::const_ptr::<impl *const T>::is_null | 1 | 75 | 75 |
| std::ptr::const_ptr::<impl *const T>::is_aligned_to | 1 | 64 | 64 |
| compute | 3 | 20 | 60 |
| std::ptr::const_ptr::<impl *const T>::align_offset | 1 | 55 | 55 |
| std::ptr::read | 1 | 52 | 52 |
| <std::alloc::Global as std::alloc::Allocator>::deallocate | 1 | 50 | 50 |
| std::ptr::mut_ptr::<impl *mut T>::guaranteed_eq | 1 | 48 | 48 |
| std::fmt::ArgumentV1::<'a>::new_display | 2 | 22 | 44 |
| std::ptr::Alignment::new_unchecked | 1 | 42 | 42 |
| core::fmt::num::<impl std::fmt::Debug for usize>::fmt | 1 | 40 | 40 |
| std::result::Result::<T, E>::unwrap_unchecked | 1 | 37 | 37 |
| std::cmp::Ord::min | 1 | 32 | 32 |
| std::cmp::impls::<impl std::cmp::Ord for usize>::cmp | 1 | 31 | 31 |
| std::intrinsics::is_aligned_and_not_null | 1 | 27 | 27 |
| std::rt::lang_start | 1 | 27 | 27 |
| std::ptr::NonNull::<T>::new | 1 | 24 | 24 |
| std::fmt::ArgumentV1::<'a>::new_debug | 1 | 22 | 22 |
| std::fmt::Arguments::<'a>::new_v1_formatted | 1 | 19 | 19 |
| std::rt::lang_start::{closure#0} | 1 | 17 | 17 |
| std::sys_common::backtrace::__rust_begin_short_backtrace | 1 | 16 | 16 |
| std::slice::<impl [T]>::into_vec | 3 | 5 | 15 |
| <std::ptr::NonNull<T> as std::convert::From<std::ptr::Unique<T>>>::from | 1 | 14 | 14 |
| <&T as std::fmt::Debug>::fmt | 1 | 12 | 12 |
| <&T as std::fmt::Display>::fmt | 1 | 12 | 12 |
| std::vec::Vec::<T, A>::len | 3 | 2 | 6 |
| <T as std::convert::Into<U>>::into | 1 | 5 | 5 |
| <T as std::convert::From<T>>::from | 1 | 2 | 2 |
| <() as std::process::Termination>::report | 1 | 2 | 2 |
| std::hint::unreachable_unchecked | 1 | 2 | 2 |
| core::fmt::UnsafeArg::new | 1 | 1 | 1 |
</details>
Since we discussed it together, r? `@wesleywiser.`
2022-12-15 22:02:57 +01:00
Dan Johnson
da98ef9a5d
Ensure async trait impls are async (or otherwise return an opaque type)
...
As a workaround for the full `#[refine]` semantics not being implemented
yet, forbit returning a concrete future type like `Box<dyn Future>` or a
manually implemented Future.
`-> impl Future` is still permitted; while that can also cause
accidental refinement, that's behind a different feature gate
(`return_position_impl_trait_in_trait`) and that problem exists
regardless of whether the trait method is async, so will have to be
solved more generally.
Fixes #102745
2022-12-14 16:38:21 -08:00
Rémy Rakic
7611933e6a
add -Z dump-mono-stats
...
This option will output some stats from the monomorphization collection
pass to a file, to show estimated sizes from each instantiation.
2022-12-14 20:17:52 +00:00
Matthias Krüger
c8fd654d7c
Rollup merge of #105502 - chenyukang:yukang/fix-105366-impl, r=estebank
...
Suggest impl in the scenario of typo with fn
Fixes #105366
2022-12-14 10:31:06 +01:00
Michael Goulet
a8a45100a0
Move some codegen-y methods from rustc_hir_analysis::collect -> rustc_codegen_ssa
2022-12-13 05:01:36 +00:00
nils
2f9f097cb8
Migrate parts of rustc_expand
to session diagnostics
...
This migrates everything but the `mbe` and `proc_macro` modules. It also
contains a few cleanups and drive-by/accidental diagnostic improvements
which can be seen in the diff for the UI tests.
2022-12-10 11:02:41 +01:00
yukang
b70a869d8f
fix #105366 , suggest impl in the scenario of typo with fn
2022-12-10 11:01:52 +08:00
bors
91b8f34ac2
Auto merge of #104799 - pcc:linkage-fn, r=tmiasko
...
Support Option and similar enums as type of static variable with linkage attribute
Compiler MCP:
rust-lang/compiler-team#565
2022-12-07 10:24:59 +00:00