Commit Graph

633 Commits

Author SHA1 Message Date
bors
21de280ccc Auto merge of #95884 - cjgillot:assoc-item, r=lcnr
Thin `AssocItem`

This PR removes a few fields from `AssocItem` that should be easily computed using other queries.
This simplifies some of the metadata decoding.
2022-08-01 21:43:35 +00:00
Camille GILLOT
957548183d Remove trait_of_item query. 2022-08-01 21:39:26 +02:00
Camille GILLOT
d7ea161b7e Remove DefId from AssocItemContainer. 2022-08-01 21:38:45 +02:00
Camille GILLOT
8ee4446ee5 Remove visibility from AssocItem. 2022-08-01 21:38:20 +02:00
Camille GILLOT
110f0656cb Store associated item defaultness in impl_defaultness. 2022-08-01 21:38:16 +02:00
bors
fe3342816a Auto merge of #99476 - dpaoliello:rawdylibvectorcall, r=michaelwoerister
Add tests for raw-dylib with vectorcall, and fix vectorcall code generation

* Adds tests for using `raw-dylib` (#58713) with `vectorcall`.
* Fixed code generation for `vectorcall` (parameters have to be marked with `InReg`, just like `fastcall`).
* Enabled running the `raw-dylib` `fastcall` tests when using MSVC (since I had to add support in the test for running MSVC-only tests since GCC doesn't support `vectorcall`).
2022-08-01 18:43:57 +00:00
Miguel Guarniz
16513d689e Rename local_did to def_id
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2022-07-29 18:26:10 -04:00
Miguel Guarniz
25bdc8965e Change maybe_body_owned_by to take local def id
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2022-07-29 18:25:58 -04:00
Yuki Okushi
645a88374a
Update mentions to rustc_metadata::rmeta::Lazy
Signed-off-by: Yuki Okushi <jtitor@2k36.org>
2022-07-27 20:09:46 +09:00
Yuki Okushi
3ca1c3100d
Rollup merge of #99698 - compiler-errors:no-doc-hidden, r=cjgillot
Prefer visibility map parents that are not `doc(hidden)` first

Far simpler approach to #98876.

This only fixes the case where the parent is `doc(hidden)`, not where the child is `doc(hidden)` since I don't know how to get the attrs on the import statement given a `ModChild`... I'll try to follow up with that, but this is a good first step.
2022-07-27 11:52:53 +09:00
Daniel Paoliello
722d67d5e7 Fix vectorcall 2022-07-26 14:11:37 -07:00
Michael Goulet
42a4419120 Do not prefer module parents which are doc(hidden) in visibility map 2022-07-24 21:27:03 +00:00
Pietro Albini
f1063c054d
remove new allocations from imported_source_files 2022-07-24 16:20:14 +02:00
Daniel Bevenius
db977ca37e Fix typo/grammar in locator.rs doc comment 2022-07-23 07:31:20 +02:00
David Wood
6246d66c6d passes: improved partial stabilization diagnostic
Improves the diagnostic when a feature attribute is specified
unnecessarily but the feature implies another (i.e. it was partially
stabilized) to refer to the implied feature.

Signed-off-by: David Wood <david.wood@huawei.com>
2022-07-20 14:53:01 +01:00
Caio
3266460749 Stabilize let_chains 2022-07-16 20:17:58 -03:00
bors
1ba1fec234 Auto merge of #96544 - m-ysk:feature/issue-96358, r=cjgillot
Stop keeping metadata in memory before writing it to disk

Fixes #96358

I created this PR according with the instruction given in the issue except for the following points:

- While the issue says "Write metadata into the temporary file in `encode_and_write_metadata` even if `!need_metadata_file`", I could not do that. That is because though I tried to do that and run `x.py test`, I got a lot of test failures as follows.

<details>
<summary>List of failed tests</summary>
<pre>
<code>
failures:
    [ui] src/test/ui/json-multiple.rs
    [ui] src/test/ui/json-options.rs
    [ui] src/test/ui/rmeta/rmeta-rpass.rs
    [ui] src/test/ui/save-analysis/emit-notifications.rs
    [ui] src/test/ui/svh/changing-crates.rs
    [ui] src/test/ui/svh/svh-change-lit.rs
    [ui] src/test/ui/svh/svh-change-significant-cfg.rs
    [ui] src/test/ui/svh/svh-change-trait-bound.rs
    [ui] src/test/ui/svh/svh-change-type-arg.rs
    [ui] src/test/ui/svh/svh-change-type-ret.rs
    [ui] src/test/ui/svh/svh-change-type-static.rs
    [ui] src/test/ui/svh/svh-use-trait.rs

test result: FAILED. 12915 passed; 12 failed; 100 ignored; 0 measured; 0 filtered out; finished in 71.41s

Some tests failed in compiletest suite=ui mode=ui host=x86_64-unknown-linux-gnu target=x86_64-unknown-linux-gnu
Build completed unsuccessfully in 0:01:58
</code>
</pre>
</details>

- I could not resolve the extra tasks about `create_rmeta_file` and `create_compressed_metadata_file` for my lack of ability.
2022-07-14 21:50:14 +00:00
Dylan DPC
ecae3d74e2
Rollup merge of #99000 - JulianKnodt:allow_resolve_no_substs, r=lcnr
Move abstract const to middle

Moves AbstractConst (and all associated methods) to rustc middle for use in `rustc_infer`.
This allows for const resolution in infer to use abstract consts to walk consts and check if
they are resolvable.

This attempts to resolve the issue where `Foo<{ concrete const }, generic T>` is incorrectly marked as conflicting, and is independent from the other issue where nested abstract consts must be resolved.

r? `@lcnr`
2022-07-14 19:24:04 +05:30
Joshua Nelson
3c9765cff1 Rename debugging_opts to unstable_opts
This is no longer used only for debugging options (e.g. `-Zoutput-width`, `-Zallow-features`).
Rename it to be more clear.
2022-07-13 17:47:06 -05:00
kadmin
e612e2603c Move abstract const to rustc_middle::ty 2022-07-12 02:21:31 +00:00
bors
1517f5de01 Auto merge of #99024 - matthiaskrgr:rollup-8ygpcpg, r=matthiaskrgr
Rollup of 9 pull requests

Successful merges:

 - #97917 (Implement ExitCodeExt for Windows)
 - #98844 (Reword comments and rename HIR visiting methods.)
 - #98979 (interpret: use AllocRange in UninitByteAccess)
 - #98986 (Fix missing word in comment)
 - #98994 (replace process exit with more detailed exit in src/bootstrap/*.rs)
 - #98995 (Add a test for #80471)
 - #99002 (suggest adding a derive for #[default] applied to variants)
 - #99004 (Add a test for #70408)
 - #99017 (Replace boolean argument for print_where_clause with an enum to make code more clear)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-07-07 20:55:34 +00:00
Camille GILLOT
111df9e6ed Reword comments and rename HIR visiting methods. 2022-07-07 16:01:43 +02:00
Camille GILLOT
43bb31b954 Allow to create definitions inside the query system. 2022-07-06 22:50:55 +02:00
bors
6a10920564 Auto merge of #97235 - nbdd0121:unwind, r=Amanieu
Fix FFI-unwind unsoundness with mixed panic mode

UB maybe introduced when an FFI exception happens in a `C-unwind` foreign function and it propagates through a crate compiled with `-C panic=unwind` into a crate compiled with `-C panic=abort` (#96926).

To prevent this unsoundness from happening, we will disallow a crate compiled with `-C panic=unwind` to be linked into `panic-abort` *if* it contains a call to `C-unwind` foreign function or function pointer. If no such call exists, then we continue to allow such mixed panic mode linking because it's sound (and stable). In fact we still need the ability to do mixed panic mode linking for std, because we only compile std once with `-C panic=unwind` and link it regardless panic strategy.

For libraries that wish to remain compile-once-and-linkable-to-both-panic-runtimes, a `ffi_unwind_calls` lint is added (gated under `c_unwind` feature gate) to flag any FFI unwind calls that will cause the linkable panic runtime be restricted.

In summary:
```rust
#![warn(ffi_unwind_calls)]

mod foo {
    #[no_mangle]
    pub extern "C-unwind" fn foo() {}
}

extern "C-unwind" {
    fn foo();
}

fn main() {
    // Call to Rust function is fine regardless ABI.
    foo::foo();
    // Call to foreign function, will cause the crate to be unlinkable to panic-abort if compiled with `-Cpanic=unwind`.
    unsafe { foo(); }
    //~^ WARNING call to foreign function with FFI-unwind ABI
    let ptr: extern "C-unwind" fn() = foo::foo;
    // Call to function pointer, will cause the crate to be unlinkable to panic-abort if compiled with `-Cpanic=unwind`.
    ptr();
    //~^ WARNING call to function pointer with FFI-unwind ABI
}
```

Fix #96926

`@rustbot` label: T-compiler F-c_unwind
2022-07-02 14:06:27 +00:00
Yoshiki Matsuda
7a5e773dc2 fall back on the blank path if out_filename is blank 2022-07-02 22:54:37 +09:00
Yoshiki Matsuda
a206121388 seek instead of opening a new file handle 2022-07-02 22:54:37 +09:00
Yoshiki Matsuda
ea0e0f4e13 avoid holding the temp_dir for empty metadata file 2022-07-02 22:54:37 +09:00
Yoshiki Matsuda
3e309350d2 add a comment about counting zero bytes 2022-07-02 22:54:37 +09:00
Yoshiki Matsuda
ad55481043 add some comments for encode_and_write_metadata 2022-07-02 22:54:37 +09:00
Yoshiki Matsuda
63dec941e1 fix an incorrect filename for an error message 2022-07-02 22:54:37 +09:00
Yoshiki Matsuda
0928061906 refactor encode_and_write_metadata 2022-07-02 22:54:37 +09:00
Yoshiki Matsuda
34e44e5774 Revert "write the root position at the end"
This reverts commit 44f66429e1fdba2cd167b4033f04f462a368b717.
2022-07-02 22:54:37 +09:00
Yoshiki Matsuda
ec64b4c90e add a comment about the drop order for EncodedMetadata 2022-07-02 22:54:37 +09:00
Yoshiki Matsuda
03de5c4a14 create an empty file even in case of MetadataKind::None 2022-07-02 22:54:37 +09:00
Yoshiki Matsuda
7eb64b4901 flush and assert when counting zero bytes 2022-07-02 22:54:37 +09:00
Yoshiki Matsuda
c57d778872 define MmapMut and use it in Decodable impl 2022-07-02 22:54:37 +09:00
Yoshiki Matsuda
47c36893a1 use &Path instead of AsRef<Path> 2022-07-02 22:54:37 +09:00
Yoshiki Matsuda
dcb599fe6c create tmp directory if there is no parent directory 2022-07-02 22:54:37 +09:00
Yoshiki Matsuda
8d35ff16d2 insert dummy 4 bytes to avoid the breaking change 2022-07-02 22:54:37 +09:00
Yoshiki Matsuda
e11dd802c1 seek before counting zero bytes 2022-07-02 22:54:37 +09:00
Yoshiki Matsuda
1ead92dd64 call EncodedMetadata::empty in case of MetadataKind::None 2022-07-02 22:54:37 +09:00
Yoshiki Matsuda
c8e49e4b25 write the root position at the end 2022-07-02 22:54:37 +09:00
Yoshiki Matsuda
aa8e06458e add Send to the argument type of encode_metadata 2022-07-02 22:51:42 +09:00
Yoshiki Matsuda
1be58056e1 use BufReader for counting zero bytes 2022-07-02 22:51:42 +09:00
Yoshiki Matsuda
34f888941e seek and write the root position to the metadata file 2022-07-02 22:51:42 +09:00
Yoshiki Matsuda
336af60eae write to a temporary file in Decodable for EncodedMetadata 2022-07-02 22:51:42 +09:00
Yoshiki Matsuda
8cfa7caac9 hold Mmap in EncodedMetadata 2022-07-02 22:51:42 +09:00
Yoshiki Matsuda
c26c461c0c construct EncodedMetadata in encode_and_write_metadata 2022-07-02 22:51:42 +09:00
Yoshiki Matsuda
bb75c4b46a call emit_metadata only when metadata_kind is None 2022-07-02 22:51:42 +09:00
Yoshiki Matsuda
e7f95ace08 use rustc_serialize::opaque::FileEncoder 2022-07-02 22:51:41 +09:00