about summary refs log tree commit diff
path: root/compiler/rustc_passes
AgeCommit message (Collapse)AuthorLines
2022-05-13remove HirVisitorMiguel Guarniz-10/+4
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2022-05-13remove DebuggerVisualizerCollectorMiguel Guarniz-90/+68
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2022-05-13replace hir().def_kind for def_kind query in rustc_passesMiguel Guarniz-5/+5
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2022-05-13check def_kind before fetching itemMiguel Guarniz-21/+27
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2022-05-13remove CollectPrivateImplItemsVisitorMiguel Guarniz-70/+57
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2022-05-13remove LayoutTestMiguel Guarniz-79/+67
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2022-05-13remove OuterVisitorMiguel Guarniz-39/+52
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2022-05-13optimize find_item to fetch Item only when neededMiguel Guarniz-26/+39
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2022-05-13remove ItemLikeVisitor impl for EntryContextMiguel Guarniz-23/+8
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2022-05-13remove DiagnosticItemCollectorMiguel Guarniz-39/+28
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2022-05-13remove LifeSeederMiguel Guarniz-52/+69
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2022-05-13replace usage of visit_item_likes_in_modules with hir_module_items queryMiguel Guarniz-2/+20
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2022-05-13Remove CheckConstTraitVisitorMiguel Guarniz-68/+54
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2022-05-10fix typolcnr-1/+1
2022-05-10only_local: always check for misuselcnr-9/+9
2022-05-09Auto merge of #96473 - lcnr:querify-codegen-fn-attrs, r=cjgillotbors-21/+52
store `codegen_fn_attrs` in crate metadata extracted from #95562 because the change isn't trivial.
2022-05-09reviewlcnr-3/+3
2022-05-09only compute `codegen_fn_attrs` where neededlcnr-21/+52
2022-05-09use hir::Let in hir::GuardSparrowLii-5/+5
2022-05-08Warn on unused doc(hidden) on trait impl itemsLeón Orell Valerian Liehr-2/+74
2022-05-06use def_span and def_kind queries instead of calling tcx.hir() methodsMiguel Guarniz-2/+2
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2022-05-05Auto merge of #96520 - lcnr:general-incoherent-impls, r=petrochenkovbors-1/+27
generalize "incoherent impls" impl for user defined types To allow the move of `trait Error` into core. continues the work from #94963, finishes https://github.com/rust-lang/compiler-team/issues/487 r? `@petrochenkov` cc `@yaahc`
2022-05-05generalize "incoherent impls" impl for custom typeslcnr-1/+27
2022-05-04Cleanup broken doc links.ridwanabdillahi-1/+1
2022-05-03Add support for a new attribute `#[debugger_visualizer]` to support ↵ridwanabdillahi-0/+200
embedding debugger visualizers into a generated PDB. Cleanup `DebuggerVisualizerFile` type and other minor cleanup of queries. Merge the queries for debugger visualizers into a single query. Revert move of `resolve_path` to `rustc_builtin_macros`. Update dependencies in Cargo.toml for `rustc_passes`. Respond to PR comments. Load visualizer files into opaque bytes `Vec<u8>`. Debugger visualizers for dynamically linked crates should not be embedded in the current crate. Update the unstable book with the new feature. Add the tracking issue for the debugger_visualizer feature. Respond to PR comments and minor cleanups.
2022-05-02rustc: Panic by default in `DefIdTree::parent`Vadim Petrochenkov-9/+8
Only crate root def-ids don't have a parent, and in majority of cases the argument of `DefIdTree::parent` cannot be a crate root. So we now panic by default in `parent` and introduce a new non-panicing function `opt_parent` for cases where the argument can be a crate root. Same applies to `local_parent`/`opt_local_parent`.
2022-04-30Box HIR Generics and Impl.Camille GILLOT-2/+2
2022-04-25Auto merge of #95604 - nbdd0121:used2, r=petrochenkovbors-0/+5
Generate synthetic object file to ensure all exported and used symbols participate in the linking Fix #50007 and #47384 This is the synthetic object file approach that I described in https://github.com/rust-lang/rust/pull/95363#issuecomment-1079932354, allowing all exported and used symbols to be linked while still allowing them to be GCed. Related #93791, #95363 r? `@petrochenkov` cc `@carbotaniuman`
2022-04-25Auto merge of #96246 - SparrowLii:bound_contxet, r=compiler-errorsbors-1/+2
Add `BoundKind` in `visit_param_bounds` to check questions in bounds From the FIXME in the impl of `AstValidator`. Better bound checks by adding `BoundCtxt` type parameter to `visit_param_bound` cc `@ecstatic-morse`
2022-04-23Fix lints.Camille GILLOT-35/+14
2022-04-23Drop vis in Item.Camille GILLOT-1/+1
2022-04-23Drop vis in FieldDef.Camille GILLOT-4/+14
2022-04-21rename to `BoundKind` and add commentsSparrowLii-2/+2
2022-04-20Add `BoundCtxt` in `visit_param_bounds` to check questions in boundsSparrowLii-1/+2
2022-04-19Rollup merge of #96142 - cjgillot:no-crate-def-index, r=petrochenkovDylan DPC-35/+26
Stop using CRATE_DEF_INDEX outside of metadata encoding. `CRATE_DEF_ID` and `CrateNum::as_def_id` are almost always what we want. We should not manipulate raw `DefIndex` outside of metadata encoding.
2022-04-18Make `#[used]` considered reachableGary Guo-0/+5
2022-04-17Stop using CRATE_DEF_INDEX.Camille GILLOT-35/+26
`CRATE_DEF_ID` and `CrateNum::as_def_id` are almost always what we want.
2022-04-17Auto merge of #95655 - kckeiks:create-hir-crate-items-query, r=cjgillotbors-59/+48
Refactor HIR item-like traversal (part 1) Issue #95004 - Create hir_crate_items query which traverses tcx.hir_crate(()).owners to return a hir::ModuleItems - use tcx.hir_crate_items in tcx.hir().items() to return an iterator of hir::ItemId - use tcx.hir_crate_items to introduce a tcx.hir().par_items(impl Fn(hir::ItemId)) to traverse all items in parallel; Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com> cc `@cjgillot`
2022-04-16Rollup merge of #95006 - tmiasko:thread-local-static, r=wesleywiserDylan DPC-0/+16
Reject `#[thread_local]` attribute on non-static items
2022-04-16Auto merge of #94468 - Amanieu:global_asm_sym, r=nagisabors-6/+54
Implement sym operands for global_asm! Tracking issue: #93333 This PR is pretty much a complete rewrite of `sym` operand support for inline assembly so that the same implementation can be shared by `asm!` and `global_asm!`. The main changes are: - At the AST level, `sym` is represented as a special `InlineAsmSym` AST node containing a path instead of an `Expr`. - At the HIR level, `sym` is split into `SymStatic` and `SymFn` depending on whether the path resolves to a static during AST lowering (defaults to `SynFn` if `get_early_res` fails). - `SymFn` is just an `AnonConst`. It runs through typeck and we just collect the resulting type at the end. An error is emitted if the type is not a `FnDef`. - `SymStatic` directly holds a path and the `DefId` of the `static` that it is pointing to. - The representation at the MIR level is mostly unchanged. There is a minor change to THIR where `SymFn` is a constant instead of an expression. - At the codegen level we need to apply the target's symbol mangling to the result of `tcx.symbol_name()` depending on the target. This is done by calling the LLVM name mangler, which handles all of the details. - On Mach-O, all symbols have a leading underscore. - On x86 Windows, different mangling is used for cdecl, stdcall, fastcall and vectorcall. - No mangling is needed on other platforms. r? `@nagisa` cc `@eddyb`
2022-04-15Rollup merge of #96027 - matthiaskrgr:clippy_rec, r=fee1-deadDylan DPC-3/+2
remove function parameters only used in recursion
2022-04-14Reimplement lowering of sym operands for asm! so that it also works with ↵Amanieu d'Antras-6/+54
global_asm!
2022-04-14remove redundant function param in check_for_self_assign_helper()Matthias Krüger-3/+2
2022-04-13couple of clippy::complexity fixesMatthias Krüger-2/+2
2022-04-09restrict access to span only when we emit diagnosticMiguel Guarniz-1/+1
2022-04-08add mapping from DefKind to Target and remove more ItemLikeVisitor implsMiguel Guarniz-62/+36
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2022-04-08remove some uses of visit_all_item_likes in typeck, symbol_mangling and ↵Miguel Guarniz-1/+16
passes crates Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2022-04-08check_doc_keyword: don't alloc string for emptiness checkklensy-32/+28
check_doc_alias_value: get argument as Symbol to prevent needless string convertions check_doc_attrs: don't alloc vec, iterate over slice. Vec introduced in #83149, but no perf run posted on merge replace as_str() check with symbol check get_single_str_from_tts: don't prealloc string trivial string to str replace LifetimeScopeForPath::NonElided use Vec<Symbol> instead of Vec<String> AssertModuleSource use BTreeSet<Symbol> instead of BTreeSet<String> CrateInfo.crate_name replace FxHashMap<CrateNum, String> with FxHashMap<CrateNum, Symbol>
2022-04-05span: move `MultiSpan`David Wood-2/+2
`MultiSpan` contains labels, which are more complicated with the introduction of diagnostic translation and will use types from `rustc_errors` - however, `rustc_errors` depends on `rustc_span` so `rustc_span` cannot use types like `DiagnosticMessage` without dependency cycles. Introduce a new `rustc_error_messages` crate that can contain `DiagnosticMessage` and `MultiSpan`. Signed-off-by: David Wood <david.wood@huawei.com>
2022-04-03Rollup merge of #95553 - jam1garner:naked-function-compile-error, r=tmiaskoDylan DPC-3/+22
Don't emit non-asm contents error for naked function composed of errors ## Motivation For naked functions an error is emitted when they are composed of anything other than a single asm!() block. However, this error triggers in a couple situations in which it adds no additional information or is actively misleading. One example is if you do have an asm!() block but simply one with a syntax error: ```rust #[naked] unsafe extern "C" fn compiler_errors() { asm!(invalid_syntax) } ``` This results in two errors, one for the syntax error itself and another telling you that you need an asm block in your function: ```rust error[E0787]: naked functions must contain a single asm block --> src/main.rs:6:1 | 6 | / unsafe extern "C" fn naked_compile_error() { 7 | | asm!(blah) 8 | | } | |_^ ``` This issue also comes up when [utilizing `compile_error!()` for improving your diagnostics](https://twitter.com/steveklabnik/status/1509538243020218372), such as raising a compiler error when compiling for an unsupported target. ## Implementation The rules this PR implements are as follows: 1. If any non-erroneous non-asm statement is included, an error will still occur 2. If multiple asm statements are included, an error will still occur 3. If 0 or 1 asm statements are present, as well as any non-zero number of erroneous statements, then this error will *not* be raised as it is likely either redundant or incorrect The rule of thumb is effectively "if an error is present and its correction could change things, don't raise an error".