about summary refs log tree commit diff
path: root/compiler
AgeCommit message (Collapse)AuthorLines
2024-02-20Rollup merge of #121350 - compiler-errors:resolve, r=oli-obkMatthias Krüger-15/+3
Fix stray trait mismatch in `resolve_associated_item` for `AsyncFn` Copy-paste error meant that we were calling `fn_trait_kind_from_def_id` instead of `async_fn_trait_kind_from_def_id`. But turns out we don't even need to do that, since we already matched the trait def id above. Fixes #121306 r? oli-obk
2024-02-20Rollup merge of #121344 - fmease:lta-constr-by-input, r=oli-obkMatthias Krüger-162/+230
Expand weak alias types before collecting constrained/referenced late bound regions + refactorings Fixes #114220. Follow-up to #120780. r? `@oli-obk`
2024-02-20Rollup merge of #121323 - compiler-errors:raw-param-types, r=oli-obkMatthias Krüger-2/+6
Don't use raw parameter types in `find_builder_fn` We shouldn't really ever be using `EarlyBinder::skip_binder` then performing type equality, since param types will never be equal to other types. When checking compatibility with the signature, we instead create some fresh args. Fixes #121314
2024-02-20Rollup merge of #121322 - compiler-errors:next-solver-fulfillment-ice, r=lcnrMatthias Krüger-1/+4
Don't ICE when hitting overflow limit in fulfillment loop in next solver As the title says, let's not ICE when hitting the overflow limit in fulfill. On the other hand, we don't want to treat these as true errors, since it means that whether something is considered a true error or an ambiguity is dependent on overflow handling in the solver, which seems not worth it. Now that we use the presence of true errors in fulfillment for implicit negative coherence, we especially don't want to tie together coherence and overflow. I guess I could also drain these errors out of fulfillment and put them into some `ambiguities` storage so we could return them in `select_all_or_error` without having to re-process them every time we call `select_where_possible`. Let me know if that's desired. r? lcnr
2024-02-20Move the peeling function for weak alias typesLeón Orell Valerian Liehr-28/+34
2024-02-20Use expand_weak_alias_tys when collecting constrained generics params in implsLeón Orell Valerian Liehr-40/+25
2024-02-20Expand weak alias types before collecting constrained and referenced late ↵León Orell Valerian Liehr-16/+18
bound regions
2024-02-20Introduce expand_weak_alias_tysLeón Orell Valerian Liehr-39/+103
2024-02-20Rename some normalization-related itemsLeón Orell Valerian Liehr-40/+51
2024-02-20Fix stray trait mismatch in resolve_associated_item for AsyncFnMichael Goulet-15/+3
2024-02-20Rollup merge of #121318 - kadiwa4:no_assembly_in_supposedly_safe_code, ↵Nilstrieb-2/+12
r=Nilstrieb Trigger `unsafe_code` lint on invocations of `global_asm` `unsafe_code` already warns about things that don't involve the `unsafe` keyword, e.g. `#[no_mangle]`. This makes it warn on `core::arch::global_asm` too. Fixes #103078
2024-02-20Rollup merge of #121291 - heiher:revert-medium-cmodel, r=NilstriebNilstrieb-4/+3
target: Revert default to the medium code model on LoongArch targets This reverts commit 35dad14dfb63d77cf4a2077f1e8e9cff5a02a92b. Fixes #121289
2024-02-20Rollup merge of #121286 - gurry:constprop-lint-rename, r=oli-obkNilstrieb-17/+19
Rename `ConstPropLint` to `KnownPanicsLint` `OverflowLint` is a clearer name because it communicates what the lint does instead of the underlying mechanism it uses (const propagation) which should be of secondary concern. `OverflowLint` isn't the most accurate name because the lint looks for other errors as well such as division by zero not just overflows, but I couldn't think of another equally succinct name. As a part of this change. I've also added/updated some of the comments. cc ```@RalfJung``` ```@oli-obk``` for visibility in case you go looking for the lint using the old name. Edit: Changed the name from `OverflowLint` to `KnownPanicsLint`
2024-02-20Rollup merge of #121167 - petrochenkov:unload2, r=wesleywiserNilstrieb-17/+18
resolve: Scale back unloading of speculatively loaded crates Fixes https://github.com/rust-lang/rust/issues/120830 and fixes https://github.com/rust-lang/rust/issues/120909 while still unblocking https://github.com/rust-lang/rust/pull/117772. I cannot reproduce https://github.com/parasyte/crash-rustc as an UI test for some reason, but I tested all the cases linked above manually.
2024-02-20Auto merge of #120576 - nnethercote:merge-Diagnostic-DiagnosticBuilder, ↵bors-788/+968
r=davidtwco Overhaul `Diagnostic` and `DiagnosticBuilder` Implements the first part of https://github.com/rust-lang/compiler-team/issues/722, which moves functionality and use away from `Diagnostic`, onto `DiagnosticBuilder`. Likely follow-ups: - Move things around, because this PR was written to minimize diff size, so some things end up in sub-optimal places. E.g. `DiagnosticBuilder` has impls in both `diagnostic.rs` and `diagnostic_builder.rs`. - Rename `Diagnostic` as `DiagInner` and `DiagnosticBuilder` as `Diag`. r? `@davidtwco`
2024-02-20Auto merge of #121087 - oli-obk:eager_const_failures, r=lcnrbors-29/+12
Always evaluate free constants and statics, even if previous errors occurred work towards https://github.com/rust-lang/rust/issues/79738 We will need to evaluate static items before the `definitions.freeze()` below, as we will start creating new `DefId`s (for nested allocations) within the `eval_static_initializer` query. But even without that motivation, this is a good change. Hard errors should always be reported and not silenced if other errors happened earlier.
2024-02-20Auto merge of #121327 - Nilstrieb:rollup-zxcwwwy, r=Nilstriebbors-1008/+1014
Rollup of 10 pull requests Successful merges: - #120716 (Change leak check and suspicious auto trait lint warning messages) - #121195 (unstable-book: Separate testing and production sanitizers) - #121205 (Merge `CompilerError::CompilationFailed` and `CompilerError::ICE`.) - #121233 (Move the extra directives for `Mode::CoverageRun` into `iter_header`) - #121256 (Allow AST and HIR visitors to return `ControlFlow`) - #121307 (Drive-by `DUMMY_SP` -> `Span` and fmt changes) - #121308 (Add regression test for #103369) - #121310 (Remove an old hack for rustdoc) - #121311 (Make `is_nonoverlapping` `#[inline]`) - #121319 (return `ty::Error` when equating `ty::Error`) r? `@ghost` `@rustbot` modify labels: rollup
2024-02-20Rollup merge of #121319 - compiler-errors:err, r=oli-obkNilstrieb-0/+5
return `ty::Error` when equating `ty::Error` This helps iron out a difference in diagnostics between `Sub` and `Equate` relations, which I'm currently trying to unify. r? oli-obk
2024-02-20Rollup merge of #121307 - estebank:drive-by, r=compiler-errorsNilstrieb-17/+20
Drive-by `DUMMY_SP` -> `Span` and fmt changes Noticed these while doing something else. There's no practical change, but it's preferable to use `DUMMY_SP` as little as possible, particularly when we have perfectlly useful `Span`s available.
2024-02-20Rollup merge of #121256 - Jarcho:visitor2, r=oli-obkNilstrieb-769/+959
Allow AST and HIR visitors to return `ControlFlow` Alternative to #108598. Since rust-lang/libs-team#187 was rejected, this implements our own version of the `Try` trait (`VisitorResult`) and the `try` macro (`try_visit`). Since this change still allows visitors to return `()`, no changes have been made to the existing ones. They can be done in a separate PR.
2024-02-20Rollup merge of #121205 - nnethercote:fix-stable-mir-CompilerError, r=oli-obkNilstrieb-10/+12
Merge `CompilerError::CompilationFailed` and `CompilerError::ICE`. `CompilerError` has `CompilationFailed` and `ICE` variants, which seems reasonable at first. But the way it identifies them is flawed: - If compilation errors out, i.e. `RunCompiler::run` returns an `Err`, it uses `CompilationFailed`, which is reasonable. - If compilation panics with `FatalError`, it catches the panic and uses `ICE`. This is sometimes right, because ICEs do cause `FatalError` panics, but sometimes wrong, because certain compiler errors also cause `FatalError` panics. (The compiler/rustdoc/clippy/whatever just catches the `FatalError` with `catch_with_exit_code` in `main`.) In other words, certain non-ICE compilation failures get miscategorized as ICEs. It's not possible to reliably distinguish the two cases, so this commit merges them. It also renames the combined variant as just `Failed`, to better match the existing `Interrupted` and `Skipped` variants. Here is an example of a non-ICE failure that causes a `FatalError` panic, from `tests/ui/recursion_limit/issue-105700.rs`: ``` #![recursion_limit="4"] #![invalid_attribute] #![invalid_attribute] #![invalid_attribute] #![invalid_attribute] #![invalid_attribute] //~^ERROR recursion limit reached while expanding fn main() {{}} ``` r? ``@spastorino``
2024-02-20Rollup merge of #120716 - spastorino:change-some-lint-msgs, r=lcnrNilstrieb-212/+18
Change leak check and suspicious auto trait lint warning messages The leak check lint message "this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!" is misleading as some cases may not be phased out and could end being accepted. This is under discussion still. The suspicious auto trait lint the change in behavior already happened, so the new message is probably more accurate. r? `@lcnr` Closes #93367
2024-02-20Auto merge of #120692 - Nadrieril:move-column-analysis-to-placeinfo, ↵bors-74/+90
r=compiler-errors pattern_analysis: Move constructor selection logic to `PlaceInfo` This is a small refactor PR. There was a dense bit of constructor-related logic in `compute_exhaustiveness_and_usefulness`. I'm moving it out into a `PlaceInfo` method to make it easier to follow both separately. I also have plans that will complicate it further so it's good that it's somewhat encapsulated. r? `@compiler-errors`
2024-02-20Don't use raw parameter types in find_builder_fnMichael Goulet-2/+6
2024-02-20Reduce capabilities of `Diagnostic`.Nicholas Nethercote-377/+476
Currently many diagnostic modifier methods are available on both `Diagnostic` and `DiagnosticBuilder`. This commit removes most of them from `Diagnostic`. To minimize the diff size, it keeps them within `diagnostic.rs` but changes the surrounding `impl Diagnostic` block to `impl DiagnosticBuilder`. (I intend to move things around later, to give a more sensible code layout.) `Diagnostic` keeps a few methods that it still needs, like `sub`, `arg`, and `replace_args`. The `forward!` macro, which defined two additional methods per call (e.g. `note` and `with_note`), is replaced by the `with_fn!` macro, which defines one additional method per call (e.g. `with_note`). It's now also only used when necessary -- not all modifier methods currently need a `with_*` form. (New ones can be easily added as necessary.) All this also requires changing `trait AddToDiagnostic` so its methods take `DiagnosticBuilder` instead of `Diagnostic`, which leads to many mechanical changes. `SubdiagnosticMessageOp` gains a type parameter `G`. There are three subdiagnostics -- `DelayedAtWithoutNewline`, `DelayedAtWithNewline`, and `InvalidFlushedDelayedDiagnosticLevel` -- that are created within the diagnostics machinery and appended to external diagnostics. These are handled at the `Diagnostic` level, which means it's now hard to construct them via `derive(Diagnostic)`, so instead we construct them by hand. This has no effect on what they look like when printed. There are lots of new `allow` markers for `untranslatable_diagnostics` and `diagnostics_outside_of_impl`. This is because `#[rustc_lint_diagnostics]` annotations were present on the `Diagnostic` modifier methods, but missing from the `DiagnosticBuilder` modifier methods. They're now present.
2024-02-20Simply do not ICEMichael Goulet-1/+4
2024-02-20Rename `ConstPropLint` to `KnownPanicsLint`Gurinder Singh-17/+19
It is a clearer name because it communicates what the lint does instead of the underlying mechanism it uses (const propagation).
2024-02-20Auto merge of #121296 - madsmtm:fix-mac-catalyst-deployment-target, r=shepmasterbors-72/+53
Fix `IPHONEOS_DEPLOYMENT_TARGET` on Mac Catalyst Some of the target code invalidly assumed that the deployment target variable on Mac Catalyst is `MACOSX_DEPLOYMENT_TARGET`, which is wrong, Mac Catalyst uses the same environment variable as iOS. Additionally, the deployment target was hardcoded to `14.0`, I've lowered this to `13.1` ([same default as Clang](https://github.com/llvm/llvm-project/blob/d022f32c73c57b59a9121eba909f5034e89c628e/clang/lib/Driver/ToolChains/Darwin.cpp#L2038)), and made it properly load from the environment. This shouldn't require any changes to the `cc` crate, as that uses `rustc --print=deployment-target` to get this information automatically. CC `@BlackHoleFox` r? `@rust-lang/macos`
2024-02-19return ty::Error when equating ty::ErrorMichael Goulet-0/+5
This helps iron out a difference between Sub and Equate
2024-02-20trigger `unsafe_code` on `global_asm!` invocationsKalle Wachsmuth-2/+12
2024-02-19Always evaluate free constants and statics, even if previous errors occurredOli Scherer-29/+12
2024-02-19Auto merge of #121211 - lcnr:nll-relate-handle-infer, r=BoxyUwUbors-542/+334
deduplicate infer var instantiation Having 3 separate implementations of one of the most subtle parts of our type system is not a good strategy if we want to maintain a sound type system :sparkles: while working on this I already found some subtle bugs in the existing code, so that's awesome :tada: cc #121159 This was necessary as I am not confident in my nll changes in #119106, so I am first cleaning this up in a separate PR. r? `@BoxyUwU`
2024-02-19Inline do_orphan_check_implSantiago Pastorino-17/+9
2024-02-19Remove suspicious auto trait lintSantiago Pastorino-195/+9
2024-02-19Drive-by `DUMMY_SP` -> `Span` and fmt changesEsteban Küber-17/+20
Noticed these while doing something else. There's no practical change, but it's preferable to use `DUMMY_SP` as little as possible, particularly when we have perfectlly useful `Span`s available.
2024-02-19Auto merge of #120463 - lcnr:eager-inference-replacement, r=compiler-errorsbors-917/+814
some trait system cleanups Always eagerly replace projections with infer vars if normalization is ambig. Unsure why we previously didn't do so, wasn't able to find an explanation in #90887. This adds some complexity to the trait system and is afaict unnecessary. The second commit simplifies `pred_known_to_hold_modulo_regions`, afaict the optional `fulfill` isn't necessary anymore. r? types cc `@jackh726`
2024-02-19Lower default Mac Catalyst deployment target to 13.1Mads Marquart-1/+2
Same default as Clang: https://github.com/llvm/llvm-project/blob/d022f32c73c57b59a9121eba909f5034e89c628e/clang/lib/Driver/ToolChains/Darwin.cpp#L2038
2024-02-19Merge deployment target variable loading on iOS and Mac CatalystMads Marquart-26/+21
2024-02-19Fix ld platform_version argument on Mac CatalystMads Marquart-29/+13
2024-02-19Rollup merge of #121230 - GuillaumeGomez:extend-level-api, r=NadrierilMatthias Krüger-13/+17
Extend Level API I need this API for https://github.com/rust-lang/rust-clippy/pull/12303: I have a nested `cfg` attribute (so a `MetaItem`) and I'd like to still be able to match against all possible kind of `Level`s.
2024-02-19Rollup merge of #121032 - oli-obk:cyclic_type_ice, r=cjgillotMatthias Krüger-2/+3
Continue reporting remaining errors instead of silently dropping them I was too eager to add assertions in https://github.com/rust-lang/rust/pull/120342/files#diff-593003090e0fb5c21f31413ce5feb506e235ec33c4775da88b853980429b9ff1R741 fixes #120864
2024-02-19Make LLVM target contain correct deployment target info on Mac CatalystMads Marquart-16/+23
2024-02-19Remove MACOSX_DEPLOYMENT_TARGET env var when linking Mac CatalystMads Marquart-10/+4
Mac Catalyst uses IPHONEOS_DEPLOYMENT_TARGET to specify the deployment target, so it makes no sense to remove that variable.
2024-02-19target: Revert default to the medium code model on LoongArch targetsWANG Rui-4/+3
This reverts commit 35dad14dfb63d77cf4a2077f1e8e9cff5a02a92b. Fixes #121289
2024-02-19Prefer `DiagnosticBuilder` over `Diagnostic` in diagnostic modifiers.Nicholas Nethercote-411/+492
There are lots of functions that modify a diagnostic. This can be via a `&mut Diagnostic` or a `&mut DiagnosticBuilder`, because the latter type wraps the former and impls `DerefMut`. This commit converts all the `&mut Diagnostic` occurrences to `&mut DiagnosticBuilder`. This is a step towards greatly simplifying `Diagnostic`. Some of the relevant function are made generic, because they deal with both errors and warnings. No function bodies are changed, because all the modifier methods are available on both `Diagnostic` and `DiagnosticBuilder`.
2024-02-19remove outdated commentlcnr-1/+1
2024-02-19split `project` into multiple fileslcnr-784/+797
2024-02-19`normalize_projection_ty` is not used with next-solverlcnr-14/+13
2024-02-19remove `pred_known_to_hold_modulo_regions`lcnr-47/+3
2024-02-19never normalize without eager inference replacementlcnr-82/+11