about summary refs log tree commit diff
path: root/src
AgeCommit message (Collapse)AuthorLines
2022-07-26codegen: use new {re,de,}allocator annotations in llvmAugie Fackler-0/+183
This obviates the patch that teaches LLVM internals about _rust_{re,de}alloc functions by putting annotations directly in the IR for the optimizer. The sole test change is required to anchor FileCheck to the body of the `box_uninitialized` method, so it doesn't see the `allocalign` on `__rust_alloc` and get mad about the string `alloca` showing up. Since I was there anyway, I added some checks on the attributes to prove the right attributes got set. While we're here, we also emit allocator attributes on __rust_alloc_zeroed. This should allow LLVM to perform more optimizations for zeroed blocks, and probably fixes #90032. [This comment](https://github.com/rust-lang/rust/issues/24194#issuecomment-308791157) mentions "weird UB-like behaviour with bitvec iterators in rustc_data_structures" so we may need to back this change out if things go wrong. The new test cases require LLVM 15, so we copy them into LLVM 14-supporting versions, which we can delete when we drop LLVM 14.
2022-07-25Rollup merge of #99581 - nnethercote:improve-derive-packed-errors, r=estebankYuki Okushi-46/+60
Improve error messages involving `derive` and `packed`. There are two errors involving `derive` and `packed`. ``` `#[derive]` can't be derived on a `#[repr(packed)]` struct with type or const parameters `#[derive]` can't be derived on a `#[repr(packed)]` struct that does not derive Copy ``` The second one overstates things. It is possible to use derive on a repr(packed) struct that doesn't derive Copy in two cases. - If all the fields within the struct meet the required alignment: 1 for `repr(packed)`, or `N` for `repr(packed(N))`. - If `Default` is the only trait derived. This commit improves things in a few ways. - Changes the errors to say `this trait can't be derived on this ...`. This is more accurate, because it's just *this* trait and *this* packed struct that are a problem, not *all* derived traits on *all* packed structs. - Adds more details to the "ERROR" lines in the test case, enough to distinguish between the two error messages. - Adds more cases to the test case that don't cause errors, e.g. `Default` derives. - Uses a wider variety of builtin traits in the test case, for better coverage. r? `@estebank`
2022-07-25Rollup merge of #99494 - tmiasko:no-pie, r=Mark-SimulacrumYuki Okushi-1/+1
Use non-relocatable code in nofile-limit.rs test To avoid using static-pie which is not essential to the test but which was reported to cause problems on Void Linux where glibc is build without support for static-pie.
2022-07-25Improve error messages involving `derive` and `packed`.Nicholas Nethercote-46/+60
There are two errors involving `derive` and `packed`. ``` `#[derive]` can't be derived on a `#[repr(packed)]` struct with type or const parameters `#[derive]` can't be derived on a `#[repr(packed)]` struct that does not derive Copy ``` The second one overstates things. It is possible to use derive on a repr(packed) struct that doesn't derive Copy in two cases. - If all the fields within the struct meet the required alignment: 1 for `repr(packed)`, or `N` for `repr(packed(N))`. - If `Default` is the only trait derived. This commit improves things in a few ways. - Changes the errors to say `$TRAIT can't be derived on this ...`. This is more accurate, because it's just $TRAIT and *this* packed struct that are a problem, not *all* derived traits on *all* packed structs. - Adds more details to the "ERROR" lines in the test case, enough to distinguish between the two error messages. - Adds more cases to the test case that don't cause errors, e.g. `Default` derives. - Uses a wider variety of builtin traits in the test case, for better coverage.
2022-07-25Auto merge of #97581 - ↵bors-12/+124
AngelicosPhosphoros:improve_calloc_check_in_vec_macro_for_tuples, r=Mark-Simulacrum Support vec zero-alloc optimization for tuples and byte arrays * Implement IsZero trait for tuples up to 8 IsZero elements; * Implement IsZero for u8/i8, leading to implementation of it for arrays of them too; * Add more codegen tests for this optimization. * Lower size of array for IsZero trait because it fails to inline checks
2022-07-24Auto merge of #99603 - fasterthanlime:ra-subtree-2, r=jyn514bors-15/+346064
Convert rust-analyzer to an in-tree tool This re-adds `rust-lang/rust-analyzer` as a git subtree rather than a submodule. Closes https://github.com/rust-lang/rust-analyzer/issues/12815. Prior attempt (research PR): https://github.com/rust-lang/rust/pull/99465 * [x] Remove submodule: `git rm -f src/tools/rust-analyzer` * [x] Add subtree: `git subtree add -P src/tools/rust-analyzer https://github.com/rust-lang/rust-analyzer.git master` * [x] Move to `SourceType::InTree`, * [x] Enable `rust-analyzer/in-rust-tree` feature when built through `x.py` * [x] Add 'check' step * [x] Add 'test' step With this PR, rust-analyzer becomes an "in-tree" tool. Syncs can happen in both directions, see [clippy's relevant book section](https://doc.rust-lang.org/nightly/clippy/development/infrastructure/sync.html). Making sure `proc-macro-srv` doesn't break when the proc_macro bridge changes effectively becomes the responsibility of `rust-lang/rust` contributors. These days, that's mostly `@mystor,` who has been consulted throughout the process. I'm also making myself available in case there's questions / work needed that nobody else signed up for. This doesn't change rust-analyzer's release cycle. After this PR is merged and the next nightly goes out, one can point `rust-analyzer.procMacro.server` to the rustup-provided `rust-analyzer` binary. Changes to improve the situation further (auto-discovery/install of the rust-analyzer component) will happen in `rust-lang/rust-analyzer` and be synced here eventually.
2022-07-24Support vec zero-alloc optimization for tuples and byte arraysAngelicosPhosphoros-12/+124
* Implement IsZero trait for tuples up to 8 IsZero elements; * Implement IsZero for u8/i8, leading to implementation of it for arrays of them too; * Add more codegen tests for this optimization. * Lower size of array for IsZero trait because it fails to inline checks
2022-07-24Only run proc-macro-srv tests for now (after discussion with @Veykril, ↵Amos Wenger-4/+7
@jyn514, and @lnicola)
2022-07-24Auto merge of #99687 - RalfJung:rollup-bojacrc, r=RalfJungbors-53/+55
Rollup of 4 pull requests Successful merges: - #99644 (remove some provenance-related machine hooks that Miri no longer needs) - #99657 (Docs - remove unnecessary `mut` that gives a warning) - #99672 (Remove Clean trait implementation for more items) - #99678 (Update doc comments that refer to config parameter) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-07-24Auto merge of #99409 - tmiasko:atomic-tests, r=m-ou-sebors-1/+109
Test codegen of atomic compare-exchange with additional memory orderings * Add a test for atomic operations introduced in #97423 & #98383. * Add a test for fallback code generation strategy used on LLVM 12 introduced in #98385. Use a separate test case instead of a revision system since test will be gone once LLVM 12 is no longer supported.
2022-07-24Make macros test order-resistantAmos Wenger-2/+7
2022-07-24Sort when iterating through CrateGraphAmos Wenger-18/+15
2022-07-24Sort in DefMap::dump, since HashMap iteration order isn't definedAmos Wenger-34/+33
2022-07-24hir-def tests: sort results before comparing, since FxHashSet iteration ↵Amos Wenger-25/+28
order isn't guaranteed (And, in fact, it failed on i686)
2022-07-24Remove Clean trait implementation for ConstantGuillaume Gomez-26/+27
2022-07-24Remove Clean trait implementation for FieldDefGuillaume Gomez-27/+28
2022-07-24Fix .gitattributes for test_dataAmos Wenger-224/+225
2022-07-24Auto merge of #93429 - fee1-dead-contrib:allow-super-trait-tilde-const, ↵bors-0/+100
r=oli-obk Allow `trait A: ~const B` What's included: a minimal working change set for `~const` supertraits to work. r? `@oli-obk`
2022-07-24Small fixupsJoshua Nelson-6/+8
- use `path` instead of `paths` - don't mark rust-analyzer as an optional tool - print the cargo command that's run in the proc-macro-test build script this originally was part of a change to fix `test --stage 0 rust-analyzer`, but I'm going to leave that for a separate PR so it's easier to review.
2022-07-24Move cfg attrs up to the mod definitions to disable sourcegenAmos Wenger-32/+7
2022-07-24Disable all source-gen tests at compile timeAmos Wenger-5/+63
2022-07-24Don't run slow tests in Rust CI, only RA CIAmos Wenger-3/+8
2022-07-24Add comment about CARGO_WORKSPACE_DIRAmos Wenger-0/+2
2022-07-24Use top-level path in tool StepAmos Wenger-1/+1
2022-07-24Allow cross-compiling, build all cratesAmos Wenger-3/+3
2022-07-24Use compiler.stageAmos Wenger-1/+1
Co-authored-by: Joshua Nelson <github@jyn.dev>
2022-07-24Add test step for rust-analyzer, run it by defaultAmos Wenger-0/+50
2022-07-24Check only tests and benches, not examplesAmos Wenger-2/+5
2022-07-24Add check step, stuck on 'no output generated for libgoto_def-hash rmeta'Amos Wenger-0/+60
2022-07-24Convert rust-analyzer to 'in-tree' tool, pass 'in-rust-tree' feature by defaultAmos Wenger-4/+47
2022-07-24Add 'src/tools/rust-analyzer/' from commit ↵Amos Wenger-0/+345854
'977e12a0bdc3e329af179ef3a9d466af9eb613bb' git-subtree-dir: src/tools/rust-analyzer git-subtree-mainline: 3c98486a0cdb6d92f0fca34ffb1fd46c0e498653 git-subtree-split: 977e12a0bdc3e329af179ef3a9d466af9eb613bb
2022-07-24Remove rust-analyzer submoduleAmos Wenger-11/+0
2022-07-24Auto merge of #99251 - cuviper:hashbrown-0.12, r=Mark-Simulacrumbors-1/+1
Upgrade indexmap and thorin-dwp to use hashbrown 0.12 This removes the last dependencies on hashbrown 0.11. This also upgrades to hashbrown 0.12.3 to fix a double-free (#99372).
2022-07-24Auto merge of #95548 - rcvalle:rust-cfi-2, r=nagisabors-68/+712
Add fine-grained LLVM CFI support to the Rust compiler This PR improves the LLVM Control Flow Integrity (CFI) support in the Rust compiler by providing forward-edge control flow protection for Rust-compiled code only by aggregating function pointers in groups identified by their return and parameter types. Forward-edge control flow protection for C or C++ and Rust -compiled code "mixed binaries" (i.e., for when C or C++ and Rust -compiled code share the same virtual address space) will be provided in later work as part of this project by identifying C char and integer type uses at the time types are encoded (see Type metadata in the design document in the tracking issue https://github.com/rust-lang/rust/issues/89653). LLVM CFI can be enabled with -Zsanitizer=cfi and requires LTO (i.e., -Clto). Thank you again, `@eddyb,` `@nagisa,` `@pcc,` and `@tmiasko` for all the help!
2022-07-23Auto merge of #99652 - GuillaumeGomez:rollup-38v0x7y, r=GuillaumeGomezbors-180/+238
Rollup of 6 pull requests Successful merges: - #99298 (Make `ui-fulldeps/gated-plugins` and `ui-fulldeps/multiple-plugins` tests stage 2 only) - #99396 (Add some additional double-adjustment regression tests) - #99449 (Do not resolve associated const when there is no provided value) - #99595 (Mark atomics as unsupported on thumbv6m) - #99627 (Lock stdout once when listing tests) - #99638 (Remove Clean trait implementation for hir::Ty and middle::Ty) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-07-23Rollup merge of #99638 - GuillaumeGomez:rm-clean-trait, r=notriddleGuillaume Gomez-136/+153
Remove Clean trait implementation for hir::Ty and middle::Ty While going through the code, I realized that the "remove the Clean trait" effort which was started a while ago was never finished. The idea behind it was to make it much simpler to go through the different clean steps (which is definitely not easy when you just have `something.clean(cx)`). I'm planning to finish this effort. cc ``@camelid`` r? ``@notriddle``
2022-07-23Rollup merge of #99449 - compiler-errors:assoc-const-missing-item, r=lcnrGuillaume Gomez-40/+33
Do not resolve associated const when there is no provided value Fixes #98629, since now we just delay a bug when we're not able to evaluate a const item due to the value not actually being provided by anything. This means compilation proceeds forward to where the "missing item in impl" error is emitted. ---- The root issue here is that when we're looking for the defining `LeafDef` in `resolve_associated_item`, we end up getting the trait's AssocItem instead of the impl's AssocItem (which does not exist). This resolution "succeeds" even if the trait's item has no default value, and then since this item has no value to evaluate, it turns into a const eval error. This root issue becomes problematic (as in #98629) when this const eval error happens in wfcheck (for example, due to normalizing the param-env of something that references this const). Since this happens sooner than the check that an impl actually provides all of the items that a trait requires (which happens during later typecheck), we end up aborting compilation early with only this un-informative message. I'm not exactly sure _why_ this bug arises due to #96591 -- perhaps valtrees are evaluated more eagerly than in the old system? r? ``@oli-obk`` or ``@lcnr`` since y'all are familiar with const eval and reviewed #96591, though feel free to reassign. This is a regression from stable to beta, so I would be open to considering this for beta backport. It seems correct to me, especially given the improvements in the other UI tests this PR touches, but may have some side-effects that I'm unaware of...?
2022-07-23Rollup merge of #99396 - compiler-errors:missing-tests, r=Mark-SimulacrumGuillaume Gomez-0/+46
Add some additional double-adjustment regression tests I accidentally missed these when I rebased #98785 cc #98894 and #98897
2022-07-23Rollup merge of #99298 - ChrisDenton:ignore-plugins-stage1, r=Mark-SimulacrumGuillaume Gomez-4/+6
Make `ui-fulldeps/gated-plugins` and `ui-fulldeps/multiple-plugins` tests stage 2 only These test can fail on stage 1. Fixes #99295
2022-07-23Auto merge of #98208 - ivanloz:master, r=nagisabors-2/+39
Add support for LLVM ShadowCallStack. LLVMs ShadowCallStack provides backward edge control flow integrity protection by using a separate shadow stack to store and retrieve a function's return address. LLVM currently only supports this for AArch64 targets. The x18 register is used to hold the pointer to the shadow stack, and therefore this only works on ABIs which reserve x18. Further details are available in the [LLVM ShadowCallStack](https://clang.llvm.org/docs/ShadowCallStack.html) docs. # Usage `-Zsanitizer=shadow-call-stack` # Comments/Caveats * Currently only enabled for the aarch64-linux-android target * Requires the platform to define a runtime to initialize the shadow stack, see the [LLVM docs](https://clang.llvm.org/docs/ShadowCallStack.html) for more detail.
2022-07-23Update documentation for LLVM CFI supportRamon de C Valle-29/+85
This commit updates the documentation for the LLVM Control Flow Integrity (CFI) support in the Rust compiler (see #95548 and #89653).
2022-07-23Add fine-grained LLVM CFI support to the Rust compilerRamon de C Valle-39/+627
This commit improves the LLVM Control Flow Integrity (CFI) support in the Rust compiler by providing forward-edge control flow protection for Rust-compiled code only by aggregating function pointers in groups identified by their return and parameter types. Forward-edge control flow protection for C or C++ and Rust -compiled code "mixed binaries" (i.e., for when C or C++ and Rust -compiled code share the same virtual address space) will be provided in later work as part of this project by identifying C char and integer type uses at the time types are encoded (see Type metadata in the design document in the tracking issue #89653). LLVM CFI can be enabled with -Zsanitizer=cfi and requires LTO (i.e., -Clto).
2022-07-23Add testsDeadbeef-0/+100
2022-07-23Remove Clean trait implementation for hir::Ty and middle::TyGuillaume Gomez-136/+153
2022-07-23Rollup merge of #99617 - ehuss:update-mdbook, r=Dylan-DPCMatthias Krüger-1/+1
Update mdbook This updates mdbook from 0.4.20 to 0.4.21 Changelog: https://github.com/rust-lang/mdBook/blob/master/CHANGELOG.md#mdbook-0421 This contains a single fix that prevents mdbook from compiling on nightly (due to #99413). This will be necessary to keep everything working after the next master bootstrap switch.
2022-07-23Rollup merge of #99580 - fmease:fix-issue-99565, r=estebankMatthias Krüger-2/+23
Don't suggest unnameable generic arguments Fixes #99565. `@rustbot` label T-compiler A-diagnostics r? `@rust-lang/wg-diagnostics`
2022-07-23Auto merge of #99599 - RalfJung:miri-stage-0, r=RalfJungbors-8/+16
miri: make --stage 0 testing work This needs https://github.com/rust-lang/miri/pull/2415 or it'll break Miri entirely. also fixes https://github.com/rust-lang/rust/issues/99589
2022-07-23Auto merge of #99623 - RalfJung:rollup-0h066kc, r=RalfJungbors-1/+28
Rollup of 3 pull requests Successful merges: - #99588 (Update books) - #99602 (cargotest: do not run quickcheck tests in xsv) - #99607 (interpret: fix vtable check debug assertion) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-07-22Rollup merge of #99602 - RalfJung:xsv, r=Mark-SimulacrumRalf Jung-1/+28
cargotest: do not run quickcheck tests in xsv Fixes https://github.com/rust-lang/rust/issues/73514 I know https://github.com/rust-lang/rust/issues/70659 discusses a larger overhaul of cargotest, but that seems to have stalled and I'd like to fix the immediate issue of PRs failing due to random test failures in xsv. This still runs the vast majority of tests by numbers: ``` test result: ok. 394 passed; 0 failed; 0 ignored; 0 measured; 32 filtered out; finished in 1.84s ``` So the loss in test coverage is hopefully not too big.
2022-07-22Rollup merge of #99588 - ehuss:update-books, r=ehussRalf Jung-0/+0
Update books ## nomicon 1 commits in 70db9e4189f64d1d8e2451b1046111fb356b6dc2..8d1e4dccf71114ff56f328f671f2026d8e6b62a2 2022-06-27 20:47:21 +0900 to 2022-07-18 18:12:35 -0400 - Should be `align_of` instead of `size_of` ## reference 11 commits in 9fce337a55ee4a4629205f6094656195cecad231..a92be0fef439b3d8e0468d82cb24812d303520a0 2022-06-22 13:59:28 -0700 to 2022-07-21 19:01:23 -0700 - Add `IntoFuture::into_future` desugaring (rust-lang/reference#1233) - Remove uses of the phrase "in Rust" (rust-lang/reference#1241) - Revert "Add stable references of `macro_metavar_expr`" (rust-lang/reference#1242) - tweaks - further tweak addr_of exposition - edits - Apply suggestions from code review - document raw-addr-of operators - update union field type rules (rust-lang/reference#1238) - clarify that references size_of_val can never exceed isize::MAX (rust-lang/reference#1186) - Describe what `windows_subsystem` does (rust-lang/reference#1232) ## book 9 commits in cf2653a5ca553cbbb4a17f1a7db1947820f6a775..36383b4da21dbd0a0781473bc8ad7ef0ed1b6751 2022-07-05 12:07:58 -0400 to 2022-07-19 21:03:20 -0400 - Update ch16-02-message-passing.md - Update snapshots with edits made to src that need to be checked - Remove inconsistent newline. Fixes rust-lang/book#3240. - add missing `b` in chapter 15.6 - Grammar: corrected 'as much' to 'as such' - grammar: add missing 'of' - Fix incorrect link for listing 13-06 - Correct method name - Remove unused theme directories. ## rust-by-example 2 commits in 83724ca387a2a1cd3e8d848f62820020760e358b..3155db49b0d57cd82c65456ac210b69ecec5ccb1 2022-07-05 10:38:07 -0300 to 2022-07-05 20:35:53 -0300 - fix-type (rust-lang/rust-by-example#1565) - add-examples-to-destructure-tuples (rust-lang/rust-by-example#1566) ## rustc-dev-guide 27 commits in eb83839e903a0a8f1406f7e941886273f189b26b..d5201cddace979b299ec1bf9fd8997338151aa9d 2022-07-03 15:17:39 +0900 to 2022-07-21 04:48:49 +0200 - Debuginfo tests now also support revisions. - Link to rendered book directly - Fix link to clippy sync docs - remove stray markup - renamed - sync with hackmd version - replace misleading name (rust-lang/rustc-dev-guide#1401) - Remove a mention to Steve on r? example - obey line length limit (part 3) - obey line length limit (part 2) - obey line length limit - sync with hackmd - add draft chapter - add mdbook-mermaid - use relative links - fix some typos (rust-lang/rustc-dev-guide#1398) - typo: monomorph docs - Rename debugging_opts to unstable_opts, use link - address review comment - update date reference on MIR inliner - remove outdated info on debugging - small fixes to ty chapter (rust-lang/rustc-dev-guide#1390) - Update the build instructions for the standard library - overview.md: Link to existing Macro Expansion and Name Resolution docs (rust-lang/rustc-dev-guide#1388) - Git-ignore `pulls.json` (rust-lang/rustc-dev-guide#1386) - Revert "Add the config needed to get rust-analyzer working on src/bootstrap (rust-lang/rustc-dev-guide#1381)" - Use `x.py check` instead of `cargo check` for build scripts (rust-lang/rustc-dev-guide#1384)