about summary refs log tree commit diff
path: root/compiler/rustc_symbol_mangling
AgeCommit message (Collapse)AuthorLines
2021-10-03Remove re-export.Camille GILLOT-1/+2
2021-09-29Avoid more invocations of hir_crate query.Camille GILLOT-1/+1
2021-09-20Migrate to 2021Mark Rousskov-1/+1
2021-08-29Rollup merge of #85534 - csmoe:demagnle-assert, r=michaelwoeristerGuillaume Gomez-2/+10
add rustc-demangle assertion on mangled symbol cc https://github.com/rust-lang/rust/issues/60705#issuecomment-844880365 r? `@michaelwoerister`
2021-08-27add rustc-demangle assertion on mangled symbolcsmoe-2/+10
2021-08-26Auto merge of #87280 - lcnr:lazy-anon-const-default-substs, r=nikomatsakisbors-3/+5
lazily "compute" anon const default substs Continuing the work of #83086, this implements the discussed solution for the [unused substs problem](https://github.com/rust-lang/project-const-generics/blob/master/design-docs/anon-const-substs.md#unused-substs). As of now, anonymous constants inherit all of their parents generics, even if they do not use them, e.g. in `fn foo<T, const N: usize>() -> [T; N + 1]`, the array length has `T` as a generic parameter even though it doesn't use it. These *unused substs* cause some backwards incompatible, and imo incorrect behavior, e.g. #78369. --- We do not actually filter any generic parameters here and the `default_anon_const_substs` query still a dummy which only checks that - we now prevent the previously existing query cycles and are able to call `predicates_of(parent)` when computing the substs of anonymous constants - the default anon consts substs only include the typeflags we assume it does. Implementing that filtering will be left as future work. --- The idea of this PR is to delay the creation of the anon const substs until after we've computed `predicates_of` for the parent of the anon const. As the predicates of the parent can however contain the anon const we still have to create a `ty::Const` for it. We do this by changing the substs field of `ty::Unevaluated` to an option and modifying accesses to instead call the method `unevaluated.substs(tcx)` which returns the substs as before. If the substs - now `substs_` - of `ty::Unevaluated` are `None`, it means that the anon const currently has its default substs, i.e. the substs it has when first constructed, which are the generic parameters it has available. To be able to call `unevaluated.substs(tcx)` in a `TypeVisitor`, we add the non-defaulted method `fn tcx_for_anon_const_substs(&self) -> Option<TyCtxt<'tcx>>`. In case `tcx_for_anon_const_substs` returns `None`, unknown anon const default substs are skipped entirely. Even when `substs_` is `None` we still have to treat the constant as if it has its default substs. To do this, `TypeFlags` are modified so that it is clear whether they can still change when *exposing* any anon const default substs. A new flag, `HAS_UNKNOWN_DEFAULT_CONST_SUBSTS`, is added in case some default flags are missing. The rest of this PR are some smaller changes to either not cause cycles by trying to access the default anon const substs too early or to be able to access the `tcx` in previously unused locations. cc `@rust-lang/project-const-generics` r? `@nikomatsakis`
2021-08-26reviewlcnr-2/+3
2021-08-26update `TypeFlags` to deal with missing ct substslcnr-2/+3
2021-08-24Update rustc-demangle to 0.1.21.Eduard-Mihai Burtescu-1/+1
2021-08-24rustc_symbol_mangling: support structural constants and &str in v0.Eduard-Mihai Burtescu-0/+104
2021-08-24rustc_symbol_mangling: never cache placeholders in print_const.Eduard-Mihai Burtescu-22/+36
2021-08-21Remove `Session.used_attrs` and move logic to `CheckAttrVisitor`Aaron Hill-2/+2
Instead of updating global state to mark attributes as used, we now explicitly emit a warning when an attribute is used in an unsupported position. As a side effect, we are to emit more detailed warning messages (instead of just a generic "unused" message). `Session.check_name` is removed, since its only purpose was to mark the attribute as used. All of the callers are modified to use `Attribute.has_name` Additionally, `AttributeType::AssumedUsed` is removed - an 'assumed used' attribute is implemented by simply not performing any checks in `CheckAttrVisitor` for a particular attribute. We no longer emit unused attribute warnings for the `#[rustc_dummy]` attribute - it's an internal attribute used for tests, so it doesn't mark sense to treat it as 'unused'. With this commit, a large source of global untracked state is removed.
2021-08-12Auto merge of #85296 - bjorn3:plugin_cleanup, r=petrochenkovbors-4/+0
Plugin interface cleanup The first commit performs two uncontroversial cleanups. The second commit removes `#[plugin_registrar]` and instead requires you to export a `__rustc_plugin_registrar` function, this will require a change to servo's script_plugins (cc `@jdm)`
2021-08-11Rollup merge of #87582 - tmiasko:symbol-printer, r=michaelwoeristerYuki Okushi-5/+6
Implement `Printer` for `&mut SymbolPrinter` to avoid passing `SymbolPrinter` by value.
2021-08-10Replace #[plugin_registrar] with exporting __rustc_plugin_registrarbjorn3-4/+0
2021-08-02Auto merge of #87535 - lf-:authors, r=Mark-Simulacrumbors-1/+0
rfc3052 followup: Remove authors field from Cargo manifests Since RFC 3052 soft deprecated the authors field, hiding it from crates.io, docs.rs, and making Cargo not add it by default, and it is not generally up to date/useful information for contributors, we may as well remove it from crates in this repo.
2021-07-29rfc3052: Remove authors field from Cargo manifestsJade-1/+0
Since RFC 3052 soft deprecated the authors field anyway, hiding it from crates.io, docs.rs, and making Cargo not add it by default, and it is not generally up to date/useful information, we should remove it from crates in this repo.
2021-07-29Implement `Printer` for `&mut SymbolMangler`Tomasz Miąsko-14/+14
to avoid passing the symbol mangler by value.
2021-07-29Flatten compression caches into symbol manglerTomasz Miąsko-25/+18
The compression caches currently don't have any dedicated functionality that would benefit from being separated. Incorporating caches directly into the symbol manger also avoids dynamic memory allocation. The symbol mangler, which is often passed by value, is now slightly larger. This aspect will be addressed by a follow-up commit.
2021-07-29Remove redundant option around compression cachesTomasz Miąsko-16/+10
Compression caches are always present. Remove unnecessary option.
2021-07-29Implement `Printer` for `&mut SymbolPrinter`Tomasz Miąsko-5/+6
to avoid passing `SymbolPrinter` by value.
2021-07-06Revert "Revert "Merge CrateDisambiguator into StableCrateId""bjorn3-8/+9
This reverts commit 8176ab8bc18fdd7d3c2cf7f720c51166364c33a3.
2021-07-01Skip layout query when computing integer type size during manglingTomasz Miąsko-5/+5
2021-06-25rustc_symbol_mangling: Remove unused dependency rustc_astJosh Triplett-1/+0
Unused since commit 50e1ae15e9f3035b06bae00e1b1dc7a358546d3e ("Use ty::{IntTy,UintTy,FloatTy} in rustc").
2021-06-07Revert "Merge CrateDisambiguator into StableCrateId"bjorn3-9/+8
This reverts commit d0ec85d3fb6d322496cb8f4bc1c21e19f23284ad.
2021-06-02Restrict access to crate_name.Camille GILLOT-2/+2
Also remove original_crate_name, which had the exact same implementation
2021-06-01Revert "Reduce the amount of untracked state in TyCtxt"Camille Gillot-2/+2
2021-05-30Restrict access to crate_name.Camille GILLOT-2/+2
Also remove original_crate_name, which had the exact same implementation
2021-05-30Merge CrateDisambiguator into StableCrateIdbjorn3-9/+8
2021-05-24remove cfg(bootstrap)Pietro Albini-1/+0
2021-05-18Rollup merge of #83767 - camelid:mangle-v0-fix, r=nikomatsakisJack Huey-6/+37
Fix v0 symbol mangling bug Fixes #83611. r? ``@jackh726``
2021-05-15Change to just use first binders and add testJack Huey-26/+47
2021-05-13Fix v0 symbol mangling bugCamelid-16/+26
2021-05-12Use () for proc_macro_decls_static.Camille GILLOT-1/+1
2021-05-12Use () for plugin_registrar_fn.Camille GILLOT-1/+1
2021-04-05Rollup merge of #80525 - devsnek:wasm64, r=nagisaDylan DPC-1/+1
wasm64 support There is still some upstream llvm work needed before this can land.
2021-04-04wasm64Gus Caplan-1/+1
2021-03-31Add var to BoundRegion. Add query to get bound vars for applicable items.Jack Huey-1/+1
2021-03-31Add tcx lifetime to BinderJack Huey-3/+3
2021-03-19stabilize or_patternsmark-1/+1
2021-03-09rustc_target: add "unwind" payloads to `Abi`katelyn a. martin-1/+1
### Overview This commit begins the implementation work for RFC 2945. For more information, see the rendered RFC [1] and tracking issue [2]. A boolean `unwind` payload is added to the `C`, `System`, `Stdcall`, and `Thiscall` variants, marking whether unwinding across FFI boundaries is acceptable. The cases where each of these variants' `unwind` member is true correspond with the `C-unwind`, `system-unwind`, `stdcall-unwind`, and `thiscall-unwind` ABI strings introduced in RFC 2945 [3]. ### Feature Gate and Unstable Book This commit adds a `c_unwind` feature gate for the new ABI strings. Tests for this feature gate are included in `src/test/ui/c-unwind/`, which ensure that this feature gate works correctly for each of the new ABIs. A new language features entry in the unstable book is added as well. ### Further Work To Be Done This commit does not proceed to implement the new unwinding ABIs, and is intentionally scoped specifically to *defining* the ABIs and their feature flag. ### One Note on Test Churn This will lead to some test churn, in re-blessing hash tests, as the deleted comment in `src/librustc_target/spec/abi.rs` mentioned, because we can no longer guarantee the ordering of the `Abi` variants. While this is a downside, this decision was made bearing in mind that RFC 2945 states the following, in the "Other `unwind` Strings" section [3]: > More unwind variants of existing ABI strings may be introduced, > with the same semantics, without an additional RFC. Adding a new variant for each of these cases, rather than specifying a payload for a given ABI, would quickly become untenable, and make working with the `Abi` enum prone to mistakes. This approach encodes the unwinding information *into* a given ABI, to account for the future possibility of other `-unwind` ABI strings. ### Ignore Directives `ignore-*` directives are used in two of our `*-unwind` ABI test cases. Specifically, the `stdcall-unwind` and `thiscall-unwind` test cases ignore architectures that do not support `stdcall` and `thiscall`, respectively. These directives are cribbed from `src/test/ui/c-variadic/variadic-ffi-1.rs` for `stdcall`, and `src/test/ui/extern/extern-thiscall.rs` for `thiscall`. This would otherwise fail on some targets, see: https://github.com/rust-lang-ci/rust/commit/fcf697f90206e9c87b39d494f94ab35d976bfc60 ### Footnotes [1]: https://github.com/rust-lang/rfcs/blob/master/text/2945-c-unwind-abi.md [2]: https://github.com/rust-lang/rust/issues/74990 [3]: https://github.com/rust-lang/rfcs/blob/master/text/2945-c-unwind-abi.md#other-unwind-abi-strings
2021-02-15Use less HirId when referring to items.Camille GILLOT-6/+6
2021-02-15Only store a LocalDefId in hir::ForeignItem.Camille GILLOT-1/+1
2021-02-15Only store a LocalDefId in hir::ImplItem.Camille GILLOT-1/+1
2021-02-15Only store a LocalDefId in hir::TraitItem.Camille GILLOT-1/+1
2021-02-15Only store a LocalDefId in hir::Item.Camille GILLOT-1/+1
Items are guaranteed to be HIR owner.
2021-01-30Rollup merge of #80959 - jhpratt:unsigned_abs-stabilization, r=m-ou-seYuki Okushi-1/+1
Stabilize `unsigned_abs` Resolves #74913. This PR stabilizes the `i*::unsigned_abs()` method, which returns the absolute value of an integer _as its unsigned equivalent_. This has the advantage that it does not overflow on `i*::MIN`. I have gone ahead and used this in a couple locations throughout the repository.
2021-01-18Use ty::{IntTy,UintTy,FloatTy} in rustcLeSeulArtichaut-2/+1
2021-01-13Use unsigned_abs throughout repositoryJacob Pratt-1/+1
2021-01-10Rollup merge of #79968 - bjorn3:better_drop_glue_debuginfo, r=matthewjasperYuki Okushi-1/+9
Improve core::ptr::drop_in_place debuginfo * Use span of the dropped type as function span when possible. * Rename symbol from `core::ptr::drop_in_place::$hash` to `{{drop}}::<$TYPE>::$hash`. Fixes #77465 (I haven't yet updated the tests)