about summary refs log tree commit diff
path: root/compiler/rustc_middle/src
AgeCommit message (Collapse)AuthorLines
2022-08-28improve OFFSET_IS_ADDR docsRalf Jung-2/+6
2022-08-28More descriptive argument placeholdersMichael Goulet-0/+6
2022-08-27interpret: make read-pointer-as-bytes *always* work in MiriRalf Jung-97/+85
and show some extra information when it happens in CTFE
2022-08-27rustc_middle: Remove `Visibility::Invisible`Vadim Petrochenkov-11/+1
2022-08-27interpret: rename relocation → provenanceRalf Jung-115/+112
2022-08-27Auto merge of #100999 - nnethercote:shrink-FnAbi, r=bjorn3bors-2/+2
Shrink `FnAbi` Because they can take up a lot of memory in debug and release builds. r? `@bjorn3`
2022-08-27Auto merge of #100946 - jyn514:query-system-3, r=cjgillotbors-2/+2
Simplify the arguments to macros generated by the `rustc_queries` proc macro Very small cleanup. Based on https://github.com/rust-lang/rust/pull/100436 which modifies some of the same code. r? `@cjgillot`
2022-08-27Auto merge of #101074 - JohnTitor:rollup-zwznihq, r=JohnTitorbors-24/+2
Rollup of 11 pull requests Successful merges: - #96240 (Stabilize `const_ptr_offset_from`.) - #99784 (Make forward compatibility lint deprecated_cfg_attr_crate_type_name deny by default) - #100811 (Fix wrong compiletest filters on Windows) - #100924 (Smaller improvements of tidy and the unicode generator) - #100953 (Update documentation for `write!` and `writeln!`) - #101018 (rustdoc: omit start/end tags for empty item description blocks) - #101044 (rustdoc: remove unused CSS for `hidden-by-*-hider`) - #101046 (rustdoc: remove incorrect CSS selector `.impl-items table td`) - #101057 (Merge implementations of HIR fn_decl and fn_sig.) - #101062 (rustdoc: remove empty extern_crates and type="text/javascript" on script) - #101063 (Merge duplicated CSS rules) Failed merges: - #101055 (Use smaller span for suggestions) r? `@ghost` `@rustbot` modify labels: rollup
2022-08-27Rollup merge of #101057 - cjgillot:one-fn-sig, r=compiler-errorsYuki Okushi-24/+2
Merge implementations of HIR fn_decl and fn_sig.
2022-08-27Auto merge of #100732 - dpaoliello:import_name_type, r=wesleywiserbors-0/+3
Implementation of import_name_type Fixes #96534 by implementing https://github.com/rust-lang/compiler-team/issues/525 Symbols that are exported or imported from a binary on 32bit x86 Windows can be named in four separate ways, corresponding to the [import name types](https://docs.microsoft.com/en-us/windows/win32/debug/pe-format#import-name-type) from the PE-COFF spec. The exporting and importing binaries must use the same name encoding, otherwise mismatches can lead to link failures due to "missing symbols" or to 0xc0000139 (`STATUS_ENTRYPOINT_NOT_FOUND`) errors when the executable/library is loaded. For details, see the comments on the raw-dylib feature's https://github.com/rust-lang/rust/issues/58713. To generate the correct import libraries for these DLLs, therefore, rustc must know the import name type for each `extern` function, and there is currently no way for users to provide this information. This change adds a new `MetaNameValueStr` key to the `#[link]` attribute called `import_name_type`, and which accepts one of three values: `decorated`, `noprefix`, and `undecorated`. A single DLL is likely to export all its functions using the same import type name, hence `import_name_type` is a parameter of `#[link]` rather than being its own attribute that is applied per-function. It is possible to have a single DLL that exports different functions using different import name types, but users could express such cases by providing multiple export blocks for the same DLL, each with a different import name type. Note: there is a fourth import name type defined in the PE-COFF spec, `IMPORT_ORDINAL`. This case is already handled by the `#[link_ordinal]` attribute. While it could be merged into `import_type_name`, that would not make sense as `#[link_ordinal]` provides per-function information (namely the ordinal itself). Design decisions (these match the MCP linked above): * For GNU, `decorated` matches the PE Spec and MSVC rather than the default behavior of `dlltool` (i.e., there will be a leading `_` for `stdcall`). * If `import_name_type` is not present, we will keep our current behavior of matching the environment (MSVC vs GNU) default for decorating. * Using `import_name_type` on architectures other than 32bit x86 will result in an error. * Using `import_name_type` with link kinds other than `"raw-dylib"` will result in an error.
2022-08-26Auto merge of #100043 - RalfJung:scalar-always-init, r=RalfJungbors-174/+17
interpret: remove support for uninitialized scalars With Miri no longer supporting `-Zmiri-allow-uninit-numbers`, we no longer need to support storing uninit data in a `Scalar`. We anyway already only use this representation for types with *initialized* `Scalar` layout (and we have to, due to partial initialization), so let's get rid of the `ScalarMaybeUninit` type entirely. I tried to stage this into meaningful commits, but the one that changes `read_immediate` to always trigger UB on uninit is the largest chunk of the PR and I don't see how it could be subdivided. Fixes https://github.com/rust-lang/miri/issues/2187 r? `@oli-obk`
2022-08-26Merge implementations of HIR fn_decl and fn_sig.Camille GILLOT-24/+2
2022-08-26remove now-unused ScalarMaybeUninitRalf Jung-134/+1
2022-08-26make read_immediate error immediately on uninit, so ImmTy can carry ↵Ralf Jung-21/+12
initialized Scalar
2022-08-26remove some now-unnecessary parameters from check_bytesRalf Jung-19/+4
2022-08-26Implementation of import_name_typeDaniel Paoliello-0/+3
2022-08-26Replace `Body::basic_blocks()` with field accessTomasz Miąsko-19/+14
2022-08-26Auto merge of #100944 - nnethercote:shrink-thir-Expr, r=cjgillotbors-64/+66
Shrink `thir::Expr` r? `@cjgillot`
2022-08-26Suggest returning closure as impl FnMichael Goulet-0/+41
2022-08-26Rollup merge of #100034 - tmiasko:elaborate-box-derefs, r=oli-obkYuki Okushi-0/+1
Elaborate all box dereferences in `ElaborateBoxDerefs` so that it is the only pass responsible for elaboration, instead of splitting this responsibility between the `StateTransform` and `ElaborateBoxDerefs`.
2022-08-26Change `FnAbi::args` to a boxed slice.Nicholas Nethercote-1/+1
2022-08-26Change `FnAbi::fixed_count` to a `u32`.Nicholas Nethercote-1/+1
2022-08-25Auto merge of #100748 - SparrowLii:query_depth, r=cjgillotbors-39/+29
add `depth_limit` in `QueryVTable` to avoid entering a new tcx in `layout_of` Fixes #49735 Updates #48685 The `layout_of` query needs to check whether it overflows the depth limit, and the current implementation needs to create a new `ImplicitCtxt` inside `layout_of`. However, `start_query` will already create a new `ImplicitCtxt`, so we can check the depth limit in `start_query`. We can tell whether we need to check the depth limit simply by whether the return value of `to_debug_str` of the query is `layout_of`. But I think adding the `depth_limit` field in `QueryVTable` may be more elegant and more scalable.
2022-08-25allow non-monomorphize modules to access hard-coded error message through ↵Nathan Stocks-3/+3
new struct, use fluent message in monomorphize
2022-08-25Inline trivial `From<Local> for Place<'_>` implTomasz Miąsko-0/+1
2022-08-25Auto merge of #100436 - jyn514:macro-query-system, r=cjgillotbors-18/+18
try and simplify some things in the query system
2022-08-24Auto merge of #99946 - tmiasko:elide-storage-makers, r=oli-obkbors-20/+6
Elide superfluous storage markers Follow the existing strategy of omitting the storage markers for temporaries introduced for internal usage when elaborating derefs and deref projections. Those temporaries are simple scalars which are used immediately after being defined and never have their address taken. There is no benefit from storage markers from either liveness analysis or code generation perspective.
2022-08-24Note binding obligation causes for const equate errorsMichael Goulet-0/+7
2022-08-24Simplify the syntax for macros generated by `rustc_queries`Joshua Nelson-2/+2
- Disallow multiple macros callbacks in the same invocation. In practice, this was never used. - Remove the `[]` brackets around the macro name - Require an `ident`, not an arbitrary `tt`
2022-08-24Add some more THIR size assertions.Nicholas Nethercote-0/+3
2022-08-24Rename `thir::Adt` as `thir::AdtExpr`.Nicholas Nethercote-5/+5
This matches the naming scheme used elsewhere, e.g. in the AST, and avoids name clashes with the `ExprKind::Closure` variant.
2022-08-24Box `thir::ExprKind::InlineAsm`.Nicholas Nethercote-9/+12
This shrinks `thir::Expr`.
2022-08-24Box `thir::ExprKind::Closure`.Nicholas Nethercote-10/+20
This shrinks `thir::Expr`.
2022-08-24Store blocks in `Thir`.Nicholas Nethercote-5/+6
Like expressions, statements, and match arms. This shrinks `thir::Stmt` and is a precursor to further shrinking `thir::Expr`.
2022-08-24Box `user_ty` fields in `thir::ExprKind`.Nicholas Nethercote-12/+12
This shrinks several large variants of `ExprKind`.
2022-08-23Remove `$tcx` metavariable from `rustc_query_append`Joshua Nelson-18/+18
It's not actually necessary and it makes the code harder to read.
2022-08-24add `depth_limit` in `QueryVTable`SparrowLii-39/+29
2022-08-24Define index types within `thir_with_elements`.Nicholas Nethercote-28/+13
The macro already generates other stuff, might as well generate these index types as well.
2022-08-23Use par_body_owners for livenessSeo Sanghyeon-2/+2
2022-08-23Remove support for adding statement to all successorsTomasz Miąsko-17/+0
This feature of MIR patch system is no longer used.
2022-08-23Elide storage markers when elaborating deref projectionsTomasz Miąsko-3/+6
2022-08-22Auto merge of #99963 - cjgillot:iter-submodule, r=compiler-errorsbors-19/+13
Simplify implementation for par_for_each_module
2022-08-22Auto merge of #100676 - lcnr:implied-bounds-yay, r=nikomatsakisbors-0/+12
implied bounds: explicitly state which types are assumed to be wf Adds a new query which maps each definition to the types which that definition assumes to be well formed. The intent is to make it easier to reason about implied bounds. This change should not influence the user-facing behavior of rustc. Notably, `borrowck` still only assumes that the function signature of associated functions is well formed while `wfcheck` assumes that the both the function signature and the impl trait ref is well formed. Not sure if that by itself can trigger UB or whether it's just annoying. As a next step, we can add `WellFormed` predicates to `predicates_of` of these items and can stop adding the wf bounds at each place which uses them. I also intend to move the computation from `assumed_wf_types` to `implied_bounds` into the `param_env` computation. This requires me to take a deeper look at `compare_predicate_entailment` which is currently somewhat weird wrt implied bounds so I am not touching this here. r? `@nikomatsakis`
2022-08-21More docsMichael Goulet-5/+15
2022-08-21Rework ambiguity errorsMichael Goulet-0/+11
2022-08-21Rework point-at-argMichael Goulet-0/+4
2022-08-20Rollup merge of #100691 - compiler-errors:issue-100690, r=estebankMatthias Krüger-0/+4
Make `same_type_modulo_infer` a proper `TypeRelation` Specifically, this fixes #100690 because we no longer consider a `ReLateBound` and a `ReVar` to be equal. `ReVar` can only be equal to free regions or static.
2022-08-19use <[u8]>::escape_ascii instead of core::ascii::escape_defaultKaDiWa-17/+2
2022-08-19Rollup merge of #100081 - RalfJung:unused-unsafe-in-unsafe-fn, r=jackh726Dylan DPC-20/+2
never consider unsafe blocks unused if they would be required with deny(unsafe_op_in_unsafe_fn) Judging from https://github.com/rust-lang/rust/issues/71668#issuecomment-1200317370 the consensus nowadays seems to be that we should never consider an unsafe block unused if it was required with `deny(unsafe_op_in_unsafe_fn)`, no matter whether that lint is actually enabled or not. So let's adjust rustc accordingly. The first commit does the change, the 2nd does some cleanup.
2022-08-18Rollup merge of #99966 - RalfJung:try-dont-panic, r=lcnrMatthias Krüger-1/+3
avoid assertion failures in try_to_scalar_int Given that this is called `try_to_scalar_int`, we probably shouldn't `assert_int` here. Similarly `try_to_bits` also doesn't `assert!` that the size is correct. Also add some `track_caller` for debugging, while we are at it. r? ```@oli-obk```