about summary refs log tree commit diff
path: root/compiler
AgeCommit message (Collapse)AuthorLines
2023-10-25Stop telling people to submit bugs for internal feature ICEsNilstrieb-15/+93
This keeps track of usage of internal features, and changes the message to instead tell them that using internal features is not supported. See MCP 620.
2023-10-25Add a public API to get all body localsKirby Linvill-0/+8
This is particularly helpful for the ui tests, but also could be helpful for Stable MIR users who just want all the locals without needing to concatenate responses
2023-10-25Make locals field privateKirby Linvill-5/+5
2023-10-25Add public API to retrieve internal localsKirby Linvill-2/+8
2023-10-25Replace arg_count in public API with return/arg gettersKirby Linvill-13/+37
This commit hides the arg_count field in Body and instead exposes more stable and user-friendly methods to get the return and argument locals. As a result, Body instances must now be constructed using the `new` function.
2023-10-25Add arg_count field to Body in Stable MIRKirby Linvill-0/+11
This field allows SMIR consumers to identify which locals correspond to argument locals. It simply exposes the arg_count field from the MIR representation.
2023-10-25Use let chains instead of let elseNilstrieb-19/+13
This makes it more obvious that we're looking at a special case.
2023-10-25Never consider raw pointer casts to be trivalNilstrieb-3/+15
HIR typeck tries to figure out which casts are trivial by doing them as coercions and seeing whether this works. Since HIR typeck is oblivious of lifetimes, this doesn't work for pointer casts that only change the lifetime of the pointee, which are, as borrowck will tell you, not trivial. This change makes it so that raw pointer casts are never considered trivial. This also incidentally fixes the "trivial cast" lint false positive on the same code. Unfortunately, "trivial cast" lints are now never emitted on raw pointer casts, even if they truly are trivial. This could be fixed by also doing the lint in borrowck for raw pointers specifically.
2023-10-25Return multiple object-safety violation errorsMaybe Waffle-35/+42
2023-10-25Don't allow dead codeMaybe Waffle-1/+0
2023-10-25Add a comment explaining some weird `is_vtable_safe_method` behaviorMaybe Waffle-0/+4
2023-10-25Auto merge of #117180 - matthiaskrgr:rollup-rxhl6ep, r=matthiaskrgrbors-60/+77
Rollup of 7 pull requests Successful merges: - #117111 (Remove support for alias `-Z instrument-coverage`) - #117141 (Require target features to match exactly during inlining) - #117152 (Fix unwrap suggestion for async fn) - #117154 (implement C ABI lowering for CSKY) - #117159 (Work around the fact that `check_mod_type_wf` may spuriously return `ErrorGuaranteed`) - #117163 (compiletest: Display compilation errors in mir-opt tests) - #117173 (Make `Iterator` a lang item) r? `@ghost` `@rustbot` modify labels: rollup
2023-10-25Avoid unbounded O(n^2) when parsing nested type argsEsteban Küber-6/+25
When encountering code like `f::<f::<f::<f::<f::<f::<f::<f::<...` with unmatched closing angle brackets, add a linear check that avoids the exponential behavior of the parse recovery mechanism. Fix #117080.
2023-10-25Directly check provenance from the AllocId.Camille GILLOT-1/+1
2023-10-25Rename has_provance and tweaks comments.Camille GILLOT-12/+24
2023-10-25Verify that the alloc_id is Memory.Camille GILLOT-1/+6
2023-10-25Rollup merge of #117173 - oli-obk:gen_fn_split2, r=compiler-errorsMatthias Krüger-0/+7
Make `Iterator` a lang item r? `@compiler-errors` pulled out of https://github.com/rust-lang/rust/pull/116447 We're doing this change on its own, because iterator was the one diagnostic item that was load bearing on us correctly emitting errors about `diagnostic_item` mis-uses. It was used in some diagnostics as an early abort, before the actual checks of the diagnostic, so effectively the compiler was *unconditionally* checking for the iterator diagnostic item, even if it didn't emit any diagnostics. Changing those uses to use the lang item, caused us not to invoke the `all_diagnostic_items` query anymore, which then caused us to miss some issues around diagnostic items until they were actually used. The reason we keep the diagnostic item around is that clippy uses it a lot and having `Iterator` be a lang item and a diagnostic item at the same time doesn't cost us anything, but makes clippy's internal code simpler
2023-10-25Rollup merge of #117159 - oli-obk:error_shenanigans, r=estebankMatthias Krüger-3/+11
Work around the fact that `check_mod_type_wf` may spuriously return `ErrorGuaranteed` Even if that error is only emitted by `check_mod_item_types`. fixes https://github.com/rust-lang/rust/issues/117153 A cleaner refactoring would merge/chain these queries in ways that ensure we only actually get an `ErrorGuaranteed` if there was an error emitted.
2023-10-25Rollup merge of #117154 - Dirreke:csky-unknown-linux-gunabiv2, r=bjorn3Matthias Krüger-8/+30
implement C ABI lowering for CSKY fix https://github.com/rust-lang/compiler-builtins/issues/551 ​Reference: [CSKY ABI Manual](https://occ-oss-prod.oss-cn-hangzhou.aliyuncs.com/resource//1695027452256/T-HEAD_800_Series_ABI_Standards_Manual.pdf) ​ Reference: [Clang CSKY lowering code](https://github.com/llvm/llvm-project/blob/4a074f32a6914f2a8d7215d78758c24942dddc3d/clang/lib/CodeGen/Targets/CSKY.cpp#L76-L162) r? `@bjorn3`
2023-10-25Rollup merge of #117152 - compiler-errors:no-ret-coercion, r=chenyukangMatthias Krüger-12/+10
Fix unwrap suggestion for async fn Use `body_fn_sig` to get the expected return type of the function instead of `ret_coercion` in `FnCtxt`. This avoids accessing the `ret_coercion` when it's already mutably borrowed (e.g. when checking `return` expressions). Fixes #117144 r? `@chenyukang`
2023-10-25Rollup merge of #117141 - tmiasko:inline-target-features, r=oli-obkMatthias Krüger-4/+2
Require target features to match exactly during inlining In general it is not correct to inline a callee with a target features that are subset of the callee. Require target features to match exactly during inlining. The exact match could be potentially relaxed, but this would require identifying specific feature that are allowed to differ, those that need to match, and those that can be present in caller but not in callee. This resolves MIR part of #116573. For other concerns with respect to the previous implementation also see areInlineCompatible in LLVM.
2023-10-25Rollup merge of #117111 - Zalathar:zinstrument, r=compiler-errorsMatthias Krüger-33/+17
Remove support for alias `-Z instrument-coverage` This flag was stabilized in rustc 1.60.0 (2022-04-07) as `-C instrument-coverage`, but the old unstable flag was kept around (with a warning) as an alias to ease migration. It should now be reasonable to remove the somewhat tricky code that implemented that alias. Fixes #116980.
2023-10-25Refactor away the need for some `descr` methods.Oli Scherer-38/+32
Instead we use `Display` impls and their `alternate` render scheme to decide whether we want backticks or not.
2023-10-25Rename in preparation for moving the `async` printing out of `CoroutineSource`Oli Scherer-1/+1
2023-10-25Add a IsIdentity extension trait for CanonicalUserTypeMichael Goulet-7/+11
2023-10-25Uplift Canonical to rustc_type_irMichael Goulet-95/+201
2023-10-25Make `Iterator` a lang itemOli Scherer-0/+7
2023-10-25Rename `AsyncCoroutineKind` to `CoroutineSource`Oli Scherer-49/+49
similar to how we have `MatchSource`, it explains where the desugaring came from.
2023-10-25Remove unnecessary CVarArgs name skipping logicDaniPopes-8/+1
2023-10-25Rollup merge of #117158 - matthewjasper:thir-unused-unsafe, r=oli-obkMatthias Krüger-74/+86
Update THIR unused_unsafe lint Updates THIR unsafeck behaviour to match the changes from #93678
2023-10-25Rollup merge of #117136 - compiler-errors:defid-list, r=oli-obkMatthias Krüger-3/+16
Intern `LocalDefId` list from `opaque_types_defined_by` query r? oli-obk
2023-10-25Rollup merge of #117133 - compiler-errors:coherence-constrained, r=oli-obkMatthias Krüger-6/+3
Merge `impl_wf_inference` (`check_mod_impl_wf`) check into coherence checking Problem here is that we call `collect_impl_trait_in_trait_types` when checking `check_mod_impl_wf` which is performed before coherence. Due to the `tcx.sess.track_errors`, since we end up reporting an error, we never actually proceed to coherence checking, where we would be emitting a more useful impl overlap error. This change means that we may report more errors in some cases, but can at least proceed far enough to leave a useful message for overlapping traits with RPITITs in them. Fixes #116982 r? types
2023-10-25Print variadic argument pattern in HIR pretty printerDaniPopes-7/+12
2023-10-25Add support for i586-unknown-netbsd as target.Havard Eidnes-0/+29
This restricts instructions to those offered by Pentium, to support e.g. AMD Geode. There is already an entry for this target in the NetBSD platform support page at src/doc/rustc/src/platform-support/netbsd.md ...so this should forestall its removal. Additional fixes are needed for some vendored modules, this is the changes in the rust compiler core itself.
2023-10-25Only call `mir_const_qualif` if absolutely necessaryOli Scherer-3/+23
2023-10-25Auto merge of #117113 - celinval:smir-stable-ty, r=oli-obkbors-387/+143
Remove fold code and add `Const::internal()` to StableMIR We are not planning to support user generated constant in the foreseeable future, so we are cleaning up the fold logic and user created type for now. Users should use `Instance::resolve` in order to trigger monomorphization. The Instance::resolve was however incomplete, since we weren't handling internalizing constants yet. Thus, I added that. I decided to keep the `Const` fields private in case we decide to translate them lazily.
2023-10-25implement C ABI lowering for CSKYdirreke-8/+30
2023-10-25Work around the fact that `check_mod_type_wf` may spuriously return ↵Oli Scherer-3/+11
`ErrorGuaranteed`, even if that error is only emitted by `check_modwitem_types`
2023-10-25Make THIR unused_unsafe lint consistent with MIRMatthew Jasper-74/+86
Updates THIR behavior to match the changes from #93678
2023-10-25Auto merge of #117076 - oli-obk:privacy_visitor_types, r=petrochenkovbors-64/+174
Refactor type visitor walking r? `@petrochenkov` pulling out the uncontroversial parts of https://github.com/rust-lang/rust/pull/113671
2023-10-25Auto merge of #116236 - dtolnay:builtinmacrocomment, r=cjgillotbors-94/+112
Modernize rustc_builtin_macros generics helpers - Rustfmt-compatible formatting for the code snippets in comments - Eliminate an _"Extra scope required"_ obsoleted by NLL
2023-10-25Do not merge fn pointer casts.Camille GILLOT-0/+9
2023-10-25Valtrees for primitive types are fine.Camille GILLOT-2/+3
2023-10-25Complete comments.Camille GILLOT-8/+5
2023-10-25Disambiguate non-deterministic constants.Camille GILLOT-44/+101
2023-10-25Take an AllocId in intern_const_alloc_for_constprop.Camille GILLOT-9/+3
2023-10-25Do not require absence of metadata.Camille GILLOT-4/+2
2023-10-25Fortify transmute check.Camille GILLOT-4/+3
2023-10-25Explain why we check variant equality.Camille GILLOT-0/+15
2023-10-25Move provenance checks out of interning method.Camille GILLOT-17/+20