about summary refs log tree commit diff
path: root/compiler/rustc_metadata
AgeCommit message (Collapse)AuthorLines
2024-09-22Reformat using the new identifier sorting from rustfmtMichael Goulet-46/+40
2024-09-16Encode coroutine_by_move_body_def_id in crate metadataMichael Goulet-1/+12
2024-09-16Rollup merge of #123436 - ↵Matthias Krüger-1/+40
amyspark:allow-msvc-to-use-meson-and-mingw-import-libraries, r=petrochenkov linker: Allow MSVC to use import libraries following the Meson/MinGW convention Hi all, This PR implements support for `MsvcLinker` to use import libraries following Meson and the MinGW toolchain's naming convention. Meson [follows the `libfoo.dll.a` naming convention](https://mesonbuild.com/FAQ.html#why-does-building-my-project-with-msvc-output-static-libraries-called-libfooa) to disambiguate between static and import libraries. This support already existed for static libraries (see #100101), but not for dynamic libraries. The latter case was added by duplicating the logic in `native_libs::find_native_static_library`, but a separate case was added in `link_dylib_by_name` for the Windows CRT libraries which must be handled by the linker itself. See for prerequisites #129366, #126094, and #128370. All feedback is appreciated! Fixes #122455 cc `@sdroege` `@nirbheek`
2024-09-08Auto merge of #130036 - weiznich:diagnostic_unstable_tracking, r=compiler-errorsbors-2/+8
Correctly handle stability of `#[diagnostic]` attributes This commit changes the way we treat the stability of attributes in the `#[diagnostic]` namespace. Instead of relaying on ad-hoc checks to ensure at call side that a certain attribute is really usable at that location it centralises the logic to one place. For diagnostic attributes comming from other crates it just skips serializing attributes that are not stable and that do not have the corresponding feature enabled. For attributes from the current crate we can just use the feature information provided by `TyCtx`. r​? `@compiler-errors`
2024-09-08MsvcLinker: allow linking dynamically to Meson and MinGW-style named librariesL. E. Segovia-1/+40
Fixes #122455
2024-09-06Auto merge of #128776 - Bryanskiy:deep-reject-ctxt, r=lcnrbors-1/+1
Use `DeepRejectCtxt` to quickly reject `ParamEnv` candidates The description is on the [zulip thread](https://rust-lang.zulipchat.com/#narrow/stream/144729-t-types/topic/.5Basking.20for.20help.5D.20.60DeepRejectCtxt.60.20for.20param.20env.20candidates) r? `@lcnr`
2024-09-06Correctly handle stability of `#[diagnostic]` attributesGeorg Semmler-2/+8
This commit changes the way we treat the stability of attributes in the `#[diagnostic]` namespace. Instead of relaying on ad-hoc checks to ensure at call side that a certain attribute is really usable at that location it centralises the logic to one place. For diagnostic attributes comming from other crates it just skips serializing attributes that are not stable and that do not have the corresponding feature enabled. For attributes from the current crate we can just use the feature information provided by `TyCtx`.
2024-09-04Make supertrait and implied predicates queries defaultedMichael Goulet-10/+8
2024-09-02Rollup merge of #129829 - compiler-errors:decode-non-optional, r=lcnrMatthias Krüger-5/+18
Make decoding non-optional `LazyArray` panic if not set Tables may be [defined](https://github.com/rust-lang/rust/blob/9649706eada1b2c68cf6504356efb058f68ad739/compiler/rustc_metadata/src/rmeta/mod.rs#L377) as `optional:` or `defaulted:`. If optional, if we try to read a value from a key that was never encoded, we should panic. This has high value in ensuring correctness over a defaulted table, so the tradeoff is worth considering, since it signals the compiler has a buggy encode impl, rather than just defaulting to a value. HOWEVER, `optional:` arrays were side-stepping this. So this PR fixes that, and makes `optional:` tables of `LazyArray` act like `LazyValue`, and panic if it's not assigned a value during encoding. During this PR, I found that `deduced_param_attrs` has buggy (?? i think??) implementation where it will refuse to encode cross-crate `deduced_param_attrs` unless we're codegening, we're optimizing the library, and incremental is disabled. This seems incredibly wrong, but I don't want to fix it in this PR. https://github.com/rust-lang/rust/blob/9649706eada1b2c68cf6504356efb058f68ad739/compiler/rustc_metadata/src/rmeta/encoder.rs#L1733-L1747
2024-09-02Use `DeepRejectCtxt` to quickly reject `ParamEnv` candidatesBryanskiy-1/+1
2024-09-01Revert "Auto merge of #127537 - veluca93:struct_tf, r=BoxyUwU"Jakub Beránek-6/+1
This reverts commit acb4e8b6251f1d8da36f08e7a70fa23fc581839e, reversing changes made to 100fde5246bf56f22fb5cc85374dd841296fce0e.
2024-08-31Make decoding non-optional LazyArray panic if not setMichael Goulet-5/+18
2024-08-31Rollup merge of #129725 - compiler-errors:predicates-of, r=fmeaseMatthias Krüger-6/+28
Stop using `ty::GenericPredicates` for non-predicates_of queries `GenericPredicates` is a struct of several parts: A list of of an item's own predicates, and a parent def id (and some effects related stuff, but ignore that since it's kinda irrelevant). When instantiating these generic predicates, it calls `predicates_of` on the parent and instantiates its predicates, and appends the item's own instantiated predicates too: https://github.com/rust-lang/rust/blob/acb4e8b6251f1d8da36f08e7a70fa23fc581839e/compiler/rustc_middle/src/ty/generics.rs#L407-L413 Notice how this should result in a recursive set of calls to `predicates_of`... However, `GenericPredicates` is *also* misused by a bunch of *other* queries as a convenient way of passing around a list of predicates. For these queries, we don't ever set the parent def id of the `GenericPredicates`, but if we did, then this would be very easy to mistakenly call `predicates_of` instead of some other intended parent query. Given that footgun, and the fact that we don't ever even *use* the parent def id in the `GenericPredicates` returned from queries like `explicit_super_predicates_of`, It really has no benefit over just returning `&'tcx [(Clause<'tcx>, Span)]`. This PR additionally opts to wrap the results of `EarlyBinder`, as we've tended to use that in the return type of these kinds of queries to properly convey that the user has params to deal with, and it also gives a convenient way of iterating over a slice of things after instantiating.
2024-08-31Rollup merge of #129723 - compiler-errors:extern-providers, r=lcnrMatthias Krüger-43/+21
Simplify some extern providers Simplifies some extern crate providers: 1. Generalize the `ProcessQueryValue` identity impl to work on non-`Option` types. 2. Allow `ProcessQueryValue` to wrap its output in an `EarlyBinder`, to simplify `explicit_item_bounds`/`explicit_item_super_predicates`. 3. Use `{ table }` and friends more when possible.
2024-08-31Rollup merge of #129366 - petrochenkov:libsearch, r=jieyouxuMatthias Krüger-11/+86
linker: Synchronize native library search in rustc and linker Also search for static libraries with alternative naming (`libname.a`) on MSVC when producing executables or dynamic libraries, and not just rlibs. This unblocks https://github.com/rust-lang/rust/pull/123436. try-job: x86_64-msvc
2024-08-29Simplify some extern providersMichael Goulet-43/+21
2024-08-29Add `warn(unreachable_pub)` to `rustc_metadata`.Nicholas Nethercote-7/+8
2024-08-29Stop using ty::GenericPredicates for non-predicates_of queriesMichael Goulet-6/+28
2024-08-28Rollup merge of #129689 - compiler-errors:impl-lifetime, r=michaelwoeristerJubilee-14/+18
Move `'tcx` lifetime off of impl and onto methods for `CrateMetadataRef` Unconstrained type and const variables are not allowed, but unconstrained lifetimes are. This is not very good style, though, and it leads to unnecessary captures of a lifetime in edition 2024 (not that it matters, but it does trigger the edition migration lint).
2024-08-28Move 'tcx lifetime off of impl and onto methodsMichael Goulet-14/+18
2024-08-28Implement RFC 3525.Luca Versari-1/+6
2024-08-27linker: Synchronize native library search in rustc and linkerVadim Petrochenkov-11/+86
2024-08-26Remove some unnecessary TODOsMichael Goulet-5/+0
2024-08-26Stop using a special inner body for the coroutine by-move body for async ↵Michael Goulet-11/+29
closures
2024-08-24Fix `elided_named_lifetimes` in codePavel Grigorenko-1/+1
2024-08-21Simplify some redundant field namesMichael Goulet-6/+2
2024-08-12Rollup merge of #128886 - GrigorenkoPV:untranslatable-diagnostic, r=nnethercoteGuillaume Gomez-6/+17
Get rid of some `#[allow(rustc::untranslatable_diagnostic)]` `@rustbot` label +A-translation cc https://github.com/rust-lang/rust/issues/100717
2024-08-11Ask the user to use `feature(rustc_private)` when linking to `rustc_driver`John Kåre Alsaker-8/+22
2024-08-11Link `std` statically in `rustc_driver`John Kåre Alsaker-6/+30
2024-08-10rustc_metadata: make "link {arg,cfg} is unstable" translatablePavel Grigorenko-5/+17
2024-08-10rustc_metadata: remove a redundant `#[allow(rustc::untranslatable_diagnostic)]`Pavel Grigorenko-1/+0
2024-07-29Reformat `use` declarations.Nicholas Nethercote-82/+79
The previous commit updated `rustfmt.toml` appropriately. This commit is the outcome of running `x fmt --all` with the new formatting options.
2024-07-25Rollup merge of #127528 - estebank:ascii-control-chars, r=oli-obkMatthias Krüger-2/+0
Replace ASCII control chars with Unicode Control Pictures Replace ASCII control chars like `CR` with Unicode Control Pictures like `␍`: ``` error: bare CR not allowed in doc-comment --> $DIR/lex-bare-cr-string-literal-doc-comment.rs:3:32 | LL | /// doc comment with bare CR: '␍' | ^ ``` Centralize the checking of unicode char width for the purposes of CLI display in one place. Account for the new replacements. Remove unneeded tracking of "zero-width" unicode chars, as we calculate these in the `SourceMap` as needed now.
2024-07-21Auto merge of #120812 - compiler-errors:impl-sorting, r=lcnrbors-67/+21
Remove unnecessary impl sorting in queries and metadata Removes unnecessary impl sorting because queries already return their keys in HIR definition order: https://github.com/rust-lang/rust/issues/120371#issuecomment-1926422838 r? `@cjgillot` or `@lcnr` -- unless I totally misunderstood what was being asked for here? 😆 fixes #120371
2024-07-18Move query providersMichael Goulet-25/+0
2024-07-18Avoid unnecessary sorting of traitsMichael Goulet-44/+23
2024-07-18Be more accurate about calculating `display_col` from a `BytePos`Esteban Küber-2/+0
No longer track "zero-width" chars in `SourceMap`, read directly from the line when calculating the `display_col` of a `BytePos`. Move `char_width` to `rustc_span` and use it from the emitter. This change allows the following to properly align in terminals (depending on the font, the replaced control codepoints are rendered as 1 or 2 width, on my terminal they are rendered as 1, on VSCode text they are rendered as 2): ``` error: this file contains an unclosed delimiter --> $DIR/issue-68629.rs:5:17 | LL | ␜␟ts␀![{i | -- unclosed delimiter | | | unclosed delimiter LL | ␀␀ fn rݻoa>rݻm | ^ ```
2024-07-17Add cross-crate precise capturing support to rustdocMichael Goulet-0/+21
2024-07-11report pat no field error no recoverd struct variantyukang-1/+1
2024-06-29Auto merge of #120639 - fee1-dead-contrib:new-effects-desugaring, r=oli-obkbors-1/+15
Implement new effects desugaring cc `@rust-lang/project-const-traits.` Will write down notes once I have finished. * [x] See if we want `T: Tr` to desugar into `T: Tr, T::Effects: Compat<true>` * [x] Fix ICEs on `type Assoc: ~const Tr` and `type Assoc<T: ~const Tr>` * [ ] add types and traits to minicore test * [ ] update rustc-dev-guide Fixes #119717 Fixes #123664 Fixes #124857 Fixes #126148
2024-06-28implement new effects desugaringDeadbeef-1/+15
2024-06-27Make queries more explicitMichael Goulet-9/+9
2024-06-21Fix remaining casesMichael Goulet-2/+2
2024-06-18Use a dedicated type instead of a reference for the diagnostic contextOli Scherer-6/+6
This paves the way for tracking more state (e.g. error tainting) in the diagnostic context handle
2024-06-18Prefer `dcx` methods over fields or fields' methodsOli Scherer-1/+1
2024-06-16Rename InstanceDef -> InstanceKindMichael Goulet-2/+2
2024-06-16rustc_span: Minor improvementsVadim Petrochenkov-2/+2
Introduce `{IndexNewtype,SyntaxContext}::from_u16` for convenience because small indices are sometimes encoded as `u16`. Use `SpanData::span` instead of `Span::new` where appropriate. Add a clarifying comment about decoding span parents.
2024-06-14Use is_lang_item more aggressivelyMichael Goulet-1/+1
2024-06-07Only compute specializes query if specialization is enabled in the crate of ↵Michael Goulet-0/+4
the specialized impl
2024-06-06Rollup merge of #126099 - Nilstrieb:crate-loader-cleanups, r=jieyouxuJubilee-20/+15
Crate loader cleanups Minor cleanups I found while trying to understand how all of this works