about summary refs log tree commit diff
path: root/compiler/rustc_middle
AgeCommit message (Collapse)AuthorLines
2022-11-08add 'ty_error_with_guaranteed' and 'const_error_with_guaranteed'yukang-0/+16
2022-11-07fix: lint against lint functionsRejyr-0/+1
fix: lint against the functions `LintContext::{lookup_with_diagnostics,lookup,struct_span_lint,lint}`, `TyCtxt::struct_lint_node`, `LintLevelsBuilder::struct_lint`.
2022-11-07less unsupported errors in Miri, and clarifying commentsRalf Jung-9/+9
2022-11-07Add an optional Span to BrAnon and use it to print better error for HRTB ↵Jack Huey-11/+15
error from generator interior
2022-11-07Only assume Stacked Borrows if -Zunsound-mir-opts is givenJannis Christopher Köhl-0/+9
2022-11-07Prevent registration inside references if target is !FreezeJannis Christopher Köhl-1/+1
2022-11-07Only track (trivially) freeze typesJannis Christopher Köhl-1/+1
2022-11-07try to make things faster when only ptr provenance can existRalf Jung-5/+17
2022-11-07Rollup merge of #104059 - Rejyr:rustc_middle-lint-typo, r=petrochenkovYuki Okushi-1/+1
Fix typo in `rustc_middle/lint.rs`
2022-11-06cfg-step codeMark Rousskov-1/+0
2022-11-06Auto merge of #99943 - compiler-errors:tuple-trait, r=jackh726bors-0/+2
Implement `std::marker::Tuple`, use it in `extern "rust-call"` and `Fn`-family traits Implements rust-lang/compiler-team#537 I made a few opinionated decisions in this implementation, specifically: 1. Enforcing `extern "rust-call"` on fn items during wfcheck, 2. Enforcing this for all functions (not just ones that have bodies), 3. Gating this `Tuple` marker trait behind its own feature, instead of grouping it into (e.g.) `unboxed_closures`. Still needing to be done: 1. Enforce that `extern "rust-call"` `fn`-ptrs are well-formed only if they have 1/2 args and the second one implements `Tuple`. (Doing this would fix ICE in #66696.) 2. Deny all explicit/user `impl`s of the `Tuple` trait, kinda like `Sized`. 3. Fixing `Tuple` trait built-in impl for chalk, so that chalkification tests are un-broken. Open questions: 1. Does this need t-lang or t-libs signoff? Fixes #99820
2022-11-06make uninit_mask a unit testRalf Jung-1/+22
2022-11-06fix: typoRejyr-1/+1
2022-11-06move InitMask to its own moduleRalf Jung-592/+578
2022-11-06dont debug-print allocations, that's too verboseRalf Jung-4/+4
2022-11-06interpret: support for per-byte provenanceRalf Jung-204/+328
2022-11-06Auto merge of #103720 - crlf0710:most_translation_attr, r=compiler-errorsbors-1/+4
Lint against usages of `struct_span_lint_hir`. r? `@compiler-errors`
2022-11-06Rollup merge of #104016 - Nilstrieb:query-descs-more, r=compiler-errorsMatthias Krüger-1/+17
Add internal descriptions to a few queries helps with #104008
2022-11-06Auto merge of #103975 - oli-obk:tracing, r=jackh726bors-2/+2
Some tracing and comment cleanups Pulled out of https://github.com/rust-lang/rust/pull/101900 to see if that is the perf impact
2022-11-05Use `FmtPrinter` instead of creating `Instance`clubby789-0/+6
2022-11-05Enforce rust-check ABI in signatures, callsMichael Goulet-0/+2
2022-11-05Add internal descriptions to a few queriesNilstrieb-1/+17
2022-11-05resolve: Fill effective visibilities for import def ids in a separate passVadim Petrochenkov-2/+28
This should result in less update calls than doing it repeatedly during the fix point iteration.
2022-11-05privacy: Check effective visibility invariantsVadim Petrochenkov-1/+50
2022-11-05resolve: More detailed effective visibility tracking for importsVadim Petrochenkov-18/+25
Also drop `extern` blocks from the effective visibility table, they are nominally private and it doesn't make sense to keep them there.
2022-11-05Rollup merge of #103984 - V0ldek:103974-refactor-mk_const, r=BoxyUwUMatthias Krüger-36/+31
Refactor tcx mk_const parameters. Unroll the `ty::ConstS` parameter to `TyCtxt::mk_const` into separate `ty::ConstKind` and `Ty` parameters. Signature change is in: https://github.com/V0ldek/rust/blob/c97fd8183a98d6a89b8fc2e02eb068298e6fb7dc/compiler/rustc_middle/src/ty/context.rs#L2234 and https://github.com/V0ldek/rust/blob/c97fd8183a98d6a89b8fc2e02eb068298e6fb7dc/compiler/rustc_middle/src/ty/context.rs#L2572-L2575 the rest is callsites. Closes #103974 r? `@oli-obk`
2022-11-04Refactor tcx mk_const parameters.Mateusz-36/+31
2022-11-04Rollup merge of #103937 - BoxyUwU:misc_cleanups, r=compiler-errorsMatthias Krüger-1/+15
minor changes to make method lookup diagnostic code easier to read The end result of around 4 days of trying to understand this 1000+ line long function- a bunch of tiny nitpicks r? `@compiler-errors`
2022-11-04Some tracing and comment cleanupsOli Scherer-2/+2
2022-11-04Auto merge of #103954 - matthiaskrgr:rollup-tskpxnj, r=matthiaskrgrbors-24/+11
Rollup of 10 pull requests Successful merges: - #103825 (Remove let_underscore_must_use from list of uplifted lints) - #103884 (Add visit_fn_ret_ty to hir intravisit) - #103892 (Properly render asyncness for trait fns without default body) - #103905 (rustdoc: remove redundant mobile CSS `.sidebar-elems { background }`) - #103912 (Add howto for adding new targets) - #103915 (Improve use of ErrorGuaranteed and code cleanup) - #103930 (Move some tests from `src/test/ui` to more reasonable places) - #103931 (Add note to RELEASES.md regarding issue 102754.) - #103938 (rustdoc: clean up hardcoded CSS border color on search results) - #103940 (rustdoc: remove no-op CSS `#main-content > .item-info { margin-top: 0 }`) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-11-04Rollup merge of #103915 - chenyukang:yukang/fix-103874, r=lcnrMatthias Krüger-24/+11
Improve use of ErrorGuaranteed and code cleanup Part of #103874
2022-11-03CleanupsBoxy-1/+15
2022-11-02rustdoc: use ThinVec for cleaned genericsMichael Howell-1/+1
2022-11-03change error_reported to use Result instead of an optionyukang-8/+5
2022-11-02deprecate DelaySpanBugEmitted and use ErrorGuaranteed directlyyukang-17/+7
2022-11-01Format dyn Trait better in type_name intrinsicMichael Goulet-1/+1
2022-11-01Use Key impl to select cache.Camille GILLOT-12/+20
2022-11-01Move keys module.Camille GILLOT-0/+588
2022-11-01Use VecCache for LocalDefId.Camille GILLOT-0/+8
2022-11-01Remove CacheSelector.Camille GILLOT-9/+3
2022-11-01Rollup merge of #103061 - Amanieu:rewrite_alloc_error_handler, r=bjorn3Dylan DPC-0/+11
Rewrite implementation of `#[alloc_error_handler]` The new implementation doesn't use weak lang items and instead changes `#[alloc_error_handler]` to an attribute macro just like `#[global_allocator]`. The attribute will generate the `__rg_oom` function which is called by the compiler-generated `__rust_alloc_error_handler`. If no `__rg_oom` function is defined in any crate then the compiler shim will call `__rdl_oom` in the alloc crate which will simply panic. This also fixes link errors with `-C link-dead-code` with `default_alloc_error_handler`: `__rg_oom` was previously defined in the alloc crate and would attempt to reference the `oom` lang item, even if it didn't exist. This worked as long as `__rg_oom` was excluded from linking since it was not called. This is a prerequisite for the stabilization of `default_alloc_error_handler` (#102318).
2022-11-01Rollup merge of #103772 - compiler-errors:better-strict-coherence-err, ↵Yuki Okushi-2/+24
r=davidtwco better error for `rustc_strict_coherence` misuse Fixes #103753
2022-11-01Fix ICE in default impl error reportingMichael Goulet-1/+3
2022-10-31Rewrite implementation of `#[alloc_error_handler]`Amanieu d'Antras-0/+11
The new implementation doesn't use weak lang items and instead changes `#[alloc_error_handler]` to an attribute macro just like `#[global_allocator]`. The attribute will generate the `__rg_oom` function which is called by the compiler-generated `__rust_alloc_error_handler`. If no `__rg_oom` function is defined in any crate then the compiler shim will call `__rdl_oom` in the alloc crate which will simply panic. This also fixes link errors with `-C link-dead-code` with `default_alloc_error_handler`: `__rg_oom` was previously defined in the alloc crate and would attempt to reference the `oom` lang item, even if it didn't exist. This worked as long as `__rg_oom` was excluded from linking since it was not called. This is a prerequisite for the stabilization of `default_alloc_error_handler` (#102318).
2022-10-31Rollup merge of #103603 - camsteffen:refactor-lang, r=oli-obkDylan DPC-6/+2
Lang item cleanups Various cleanups related to lang items.
2022-10-31Auto merge of #103787 - notriddle:rollup-q1vmxsb, r=notriddlebors-17/+17
Rollup of 8 pull requests Successful merges: - #97971 (Enable varargs support for calling conventions other than C or cdecl ) - #101428 (Add mir building test directory) - #101944 (rustdoc: clean up `#toggle-all-docs`) - #102101 (check lld version to choose correct option to disable multi-threading in tests) - #102689 (Add a tier 3 target for the Sony PlayStation 1) - #103746 (rustdoc: add support for incoherent impls on structs and traits) - #103758 (Add regression test for reexports in search results) - #103764 (All verbosity checks in `PrettyPrinter` now go through `PrettyPrinter::should_print_verbose`) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-10-30Rollup merge of #103764 - SarthakSingh31:issue-94187-2, r=compiler-errorsMichael Howell-17/+17
All verbosity checks in `PrettyPrinter` now go through `PrettyPrinter::should_print_verbose` Follow-up to #103428. That pr only partially fixed #94187. In some cases (like closures) `std::any::type_name` was still producing a different output when `-Zverbose` was enabled. This pr fixes those cases and adds a new function `PrettyPrinter::should_print_verbose`. This function should always be used over `self.tcx().sess.verbose()` inside a `impl PrettyPrinter`. Maybe closes #94187 now. r? ``@compiler-errors``
2022-10-31Use `br` instead of `switch` in more cases.Nicholas Nethercote-0/+5
`codegen_switchint_terminator` already uses `br` instead of `switch` when there is one normal target plus the `otherwise` target. But there's another common case with two normal targets and an `otherwise` target that points to an empty unreachable BB. This comes up a lot when switching on the tags of enums that use niches. The pattern looks like this: ``` bb1: ; preds = %bb6 %3 = load i8, ptr %_2, align 1, !range !9, !noundef !4 %4 = sub i8 %3, 2 %5 = icmp eq i8 %4, 0 %_6 = select i1 %5, i64 0, i64 1 switch i64 %_6, label %bb3 [ i64 0, label %bb4 i64 1, label %bb2 ] bb3: ; preds = %bb1 unreachable ``` This commit adds code to convert the `switch` to a `br`: ``` bb1: ; preds = %bb6 %3 = load i8, ptr %_2, align 1, !range !9, !noundef !4 %4 = sub i8 %3, 2 %5 = icmp eq i8 %4, 0 %_6 = select i1 %5, i64 0, i64 1 %6 = icmp eq i64 %_6, 0 br i1 %6, label %bb4, label %bb2 bb3: ; No predecessors! unreachable ``` This has a surprisingly large effect on compile times, with reductions of 5% on debug builds of some crates. The reduction is all due to LLVM taking less time. Maybe LLVM is just much better at handling `br` than `switch`. The resulting code is still suboptimal. - The `icmp`, `select`, `icmp` sequence is silly, converting an `i1` to an `i64` and back to an `i1`. But with the current code structure it's hard to avoid, and LLVM will easily clean it up, in opt builds at least. - `bb3` is usually now truly dead code (though not always, so it can't be removed universally).
2022-10-30better error for rustc_strict_coherence misuseMichael Goulet-2/+24
2022-10-30All verbosity checks in `PrettyPrinter` now go through ↵Sarthak Singh-17/+17
`PrettyPrinter::should_print_verbose`