about summary refs log tree commit diff
path: root/src
AgeCommit message (Collapse)AuthorLines
2022-11-23add more testsb-naber-0/+31
2022-11-23add testsb-naber-0/+21
2022-11-23Auto merge of #102750 - the8472:opt-field-order, r=wesleywiserbors-25/+47
optimize field ordering by grouping m*2^n-sized fields with equivalently aligned ones ```rust use std::ptr::addr_of; use std::mem; struct Foo { word: u32, byte: u8, ary: [u8; 4] } fn main() { let foo: Foo = unsafe { mem::zeroed() }; println!("base: {:p}\nword: {:p}\nbyte: {:p}\nary: {:p}", &foo, addr_of!(foo.word), addr_of!(foo.byte), addr_of!(foo.ary)); } ``` prints ``` base: 0x7fffc1a8a668 word: 0x7fffc1a8a668 byte: 0x7fffc1a8a66c ary: 0x7fffc1a8a66d ``` I.e. the `u8` in the middle causes the array to sit at an odd offset, which might prevent optimizations, especially on architectures where unaligned loads are costly. Note that this will make field ordering niche-dependent, i.e. a `Bar<T>` with `T=char` and `T=u32` may result in different field order, this may break some code that makes invalid assumptions about `repr(Rust)` types.
2022-11-23Auto merge of #104758 - Manishearth:rollup-rh1tfum, r=Manishearthbors-254/+413
Rollup of 6 pull requests Successful merges: - #103488 (Allow opaque types in trait impl headers and rely on coherence to reject unsound cases) - #104359 (Refactor must_use lint into two parts) - #104612 (Lower return type outside async block creation) - #104621 (Fix --extern library finding errors) - #104647 (enable fuzzy_provenance_casts lint in liballoc and libstd) - #104750 (Bump `fd-lock` in `bootstrap` again) Failed merges: - #104732 (Refactor `ty::ClosureKind` related stuff) r? `@ghost` `@rustbot` modify labels: rollup
2022-11-22Rollup merge of #104750 - mati865:bump-fd-lock-again, r=jyn514Manish Goregaokar-61/+22
Bump `fd-lock` in `bootstrap` again Followup to https://github.com/rust-lang/rust/pull/103778 Sorry for the quick succession but this fixes one more building issue for Tier 3 `windows-gnullvm` that I have previously missed, and it would be nice to have it in the release.
2022-11-22Rollup merge of #104621 - YC:master, r=davidtwcoManish Goregaokar-0/+41
Fix --extern library finding errors - `crate_name` is not specified/passed to `metadata_crate_location_unknown_type` https://github.com/rust-lang/rust/blob/c493bae0d8efd75723460ce5c371f726efa93f15/compiler/rustc_error_messages/locales/en-US/metadata.ftl#L274-L275 - `metadata_lib_filename_form` is missing `$` - Add additional check to ensure that library is file Testing 1. Create file `a.rs` ```rust extern crate t; fn main() {} ``` 1. Create empty file `x` 1. Create empty directory `y` 1. Run ```sh $ rustc -o a a.rs --extern t=x $ rustc -o a a.rs --extern t=y ``` Both currently panic with stable.
2022-11-22Rollup merge of #104359 - Nilstrieb:plus-one, r=fee1-deadManish Goregaokar-33/+56
Refactor must_use lint into two parts Before, the lint did the checking for `must_use` and pretty printing the types in a special format in one pass, causing quite complex and untranslatable code. Now the collection and printing is split in two. That should also make it easier to translate or extract the type pretty printing in the future. Also fixes an integer overflow in the array length pluralization calculation. fixes #104352
2022-11-22Rollup merge of #103488 - oli-obk:impl_trait_for_tait, r=lcnrManish Goregaokar-160/+294
Allow opaque types in trait impl headers and rely on coherence to reject unsound cases r? ````@lcnr```` fixes #99840
2022-11-23Auto merge of #104752 - weihanglo:update-cargo, r=weihanglobors-0/+0
Update cargo 7 commits in eb5d35917b2395194593c9ca70c3778f60c1573b..ba607b23db8398723d659249d9abf5536bc322e5 2022-11-17 22:08:43 +0000 to 2022-11-22 20:52:39 +0000 - Fix failure to parse rustc's JSON output if it is too nested (rust-lang/cargo#11368) - Add suggestions when `cargo add` multiple packages (rust-lang/cargo#11186) - Update mod.rs (rust-lang/cargo#11395) - Fix typo `try use` -> `try to use` (rust-lang/cargo#11394) - Add warning when `cargo tree -i <spec>` can not find packages (rust-lang/cargo#11377) - Clean profile, patch, and replace in cargo remove (rust-lang/cargo#11194) - chore: Upgrade miow (rust-lang/cargo#11391)
2022-11-23Update cargoWeihang Lo-0/+0
7 commits in eb5d35917b2395194593c9ca70c3778f60c1573b..ba607b23db8398723d659249d9abf5536bc322e5 2022-11-17 22:08:43 +0000 to 2022-11-22 20:52:39 +0000 - Fix failure to parse rustc's JSON output if it is too nested (rust-lang/cargo#11368) - Add suggestions when `cargo add` multiple packages (rust-lang/cargo#11186) - Update mod.rs (rust-lang/cargo#11395) - Fix typo `try use` -> `try to use` (rust-lang/cargo#11394) - Add warning when `cargo tree -i <spec>` can not find packages (rust-lang/cargo#11377) - Clean profile, patch, and replace in cargo remove (rust-lang/cargo#11194) - chore: Upgrade miow (rust-lang/cargo#11391)
2022-11-23Bump `fd-lock` in `bootstrap` againMateusz Mikuła-61/+22
Followup to https://github.com/rust-lang/rust/pull/103778 Sorry for the quick succession but this fixes one more building issue for Tier 3 `windows-gnullvm` that I have previously missed, and it would be nice to have it in the release.
2022-11-22add tests for field ordering optimizationThe 8472-0/+21
2022-11-22fix tests, update size assertsThe 8472-25/+26
2022-11-23Rollup merge of #104724 - WaffleLapkin:to_def_idn't, r=compiler-errorsYuki Okushi-9/+32
Fix `ClosureKind::to_def_id` `Fn` and `FnOnce` were mixed up in https://github.com/rust-lang/rust/pull/99131.
2022-11-23Rollup merge of #104722 - mejrs:stress, r=ChrisDentonYuki Okushi-16/+51
Speed up mpsc_stress test See https://rust-lang.zulipchat.com/#narrow/stream/122651-general/topic/mpsc_stress for context r? windows
2022-11-23Rollup merge of #104720 - notriddle:notriddle/popover-before-display-inline, ↵Yuki Okushi-2/+0
r=GuillaumeGomez rustdoc: remove no-op CSS `.popover::before / a.test-arrow { display: inline-block }` Since this box is absolutely positioned, its display type is [blockified] anyway. We just need to make sure it isn't `display: none`. [blockified]: https://www.w3.org/TR/css-display-3/#transformations
2022-11-23Rollup merge of #104717 - ↵Yuki Okushi-0/+31
GuillaumeGomez:test-projection-used-as-const-generic, r=oli-obk Add failing test for projections used as const generic Based on the experiment done in https://github.com/rust-lang/rust/pull/104443, we realized it's currently not possible to support projections in const generics. More information about it in https://github.com/rust-lang/rust/pull/104443#discussion_r1029375633. This PR adds the UI test in any case so we can gather data in order to work towards adding `TyAlias` into the ABI in the future. r? ``@oli-obk``
2022-11-23Rollup merge of #102293 - ecnelises:aix.initial, r=davidtwcoYuki Okushi-1/+2
Add powerpc64-ibm-aix as Tier-3 target This is part of the effort mentioned in https://github.com/rust-lang/compiler-team/issues/553. A reference to these options are definitions from [clang](https://github.com/llvm/llvm-project/blob/ad6fe32032a6229e0c40510e9bed419a01c695b3/clang/lib/Basic/Targets/PPC.h#L414-L448) and [llvm](https://github.com/llvm/llvm-project/blob/main/llvm/lib/Target/PowerPC/PPCTargetMachine.cpp). AIX has a system `ld` but [its options and behaviors](https://www.ibm.com/docs/en/aix/7.3?topic=l-ld-command) are different from GNU ld. Thanks to ``@bzEq`` for contributing the linking args.
2022-11-22Speed up mpsc_stress testmejrs-16/+51
2022-11-22Auto merge of #104688 - flip1995:clippyup, r=Manishearth,flip1995bors-18373/+8247
Update Clippy r? `@Manishearth` Sorry for taking so long. There were so many blockers and so little time. This situation should be mitigated with #104007 in the future.
2022-11-22Fix `ClosureKind::to_def_id`Maybe Waffle-9/+32
2022-11-22rustdoc: remove no-op CSS `a.test-arrow { display: inline-block }`Michael Howell-1/+0
Since this box is absolutely positioned, its display type is [blockified] anyway. We just need to make sure it isn't `display: none`. [blockified]: https://www.w3.org/TR/css-display-3/#transformations
2022-11-22rustdoc: remove no-op CSS `.popover::before { display: inline-block }`Michael Howell-1/+0
Since this box is absolutely positioned, its display type is [blockified] anyway. We just need to make sure it isn't `display: none`. [blockified]: https://www.w3.org/TR/css-display-3/#transformations
2022-11-22Add failing test for projections used as const genericGuillaume Gomez-0/+31
2022-11-22Clippy: Workaround for let_chains issuePhilipp Krones-5/+6
2022-11-22Auto merge of #104711 - Dylan-DPC:rollup-gkw1qr8, r=Dylan-DPCbors-0/+36
Rollup of 6 pull requests Successful merges: - #104295 (Check generics parity before collecting return-position `impl Trait`s in trait) - #104464 (Reduce exceptions overallocation on non Windows x86_64) - #104615 (Create def_id for async fns during lowering) - #104669 (Only declare bindings for if-let guards once per arm) - #104701 (Remove a lifetime resolution hack from `compare_predicate_entailment`) - #104710 (disable strict-provenance-violating doctests in Miri) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-11-22Rollup merge of #104669 - LeSeulArtichaut:88015-if-let-guard-bindings, ↵Dylan DPC-0/+7
r=cjgillot Only declare bindings for if-let guards once per arm Currently, each candidate for a match arm uses separate locals for the bindings in the if-let guard, causing problems (#88015) when those branches converge in the arm body. Fixes #88015 (🤞)
2022-11-22Rollup merge of #104295 - compiler-errors:rpitit-generics-parity, r=eholkDylan DPC-0/+29
Check generics parity before collecting return-position `impl Trait`s in trait The only thing is that this duplicates the error message for number of generics mismatch, but we already deduplicate that error message in Cargo. I could add a flag to delay the error if the reviewer cares. Fixes #104281 Also drive-by adds a few comments to the `collect_trait_impl_trait_tys` method, and removes an unused argument from `compare_number_of_generics`.
2022-11-22Auto merge of #103578 - petrochenkov:nofict, r=nagisabors-330/+158
Unreserve braced enum variants in value namespace With this PR braced enum variants (`enum E { V { /*...*/ } }`) no longer take a slot in value namespace, so the special case mentioned in the note in https://github.com/rust-lang/rfcs/blob/master/text/1506-adt-kinds.md#braced-structs is removed. Report - https://github.com/rust-lang/rust/pull/103578#issuecomment-1292594900.
2022-11-22Tests for bad --extern library path and fileSteven Tang-0/+41
2022-11-22Rollup merge of #104622 - nicholasbishop:bishop-uefi-clang, r=Mark-SimulacrumManish Goregaokar-1/+59
Use clang for the UEFI targets This fixes an issue where the C and asm sources built by compiler_builtins were being compiled as ELF objects instead of PE objects. This wasn't noticed before because it doesn't cause compiler_builtins or rustc to fail to build. You only see a failure when a program is built that references one of the symbols in an ELF object. Compiling with clang fixes this because the cc crate converts the UEFI targets into Windows targets that clang understands, causing it to produce PE objects. Also update compiler_builtins to 0.1.84 to pull in some necessary fixes for compiling the UEFI targets with clang. Fixes https://github.com/rust-lang/rust/issues/104326
2022-11-22Delay bug to deduplicate diagnosticsMichael Goulet-11/+1
2022-11-22Check generics parity between impl and trait before collecting RPITITsMichael Goulet-0/+39
2022-11-22Auto merge of #104696 - matthiaskrgr:rollup-gi1pdb0, r=matthiaskrgrbors-69/+165
Rollup of 11 pull requests Successful merges: - #103396 (Pin::new_unchecked: discuss pinning closure captures) - #104416 (Fix using `include_bytes` in pattern position) - #104557 (Add a test case for async dyn* traits) - #104559 (Split `MacArgs` in two.) - #104597 (Probe + better error messsage for `need_migrate_deref_output_trait_object`) - #104656 (Move tests) - #104657 (Do not check transmute if has non region infer) - #104663 (rustdoc: factor out common button CSS) - #104666 (Migrate alias search result to CSS variables) - #104674 (Make negative_impl and negative_impl_exists take the right types) - #104692 (Update test's cfg-if dependency to 1.0) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-11-22Rollup merge of #104666 - GuillaumeGomez:migrate-alias-search-result, ↵Matthias Krüger-41/+52
r=notriddle Migrate alias search result to CSS variables r? `@notriddle`
2022-11-22Rollup merge of #104663 - notriddle:notriddle/button-cursor, r=GuillaumeGomezMatthias Krüger-8/+28
rustdoc: factor out common button CSS
2022-11-22Rollup merge of #104657 - hi-rustin:rustin-patch-check-transmute, ↵Matthias Krüger-0/+19
r=compiler-errors Do not check transmute if has non region infer close https://github.com/rust-lang/rust/issues/104609 See: https://github.com/rust-lang/rust/issues/104609#issuecomment-1320956351 r? `@compiler-errors`
2022-11-22Rollup merge of #104656 - c410-f3r:moar-errors, r=petrochenkovMatthias Krüger-1/+1
Move tests r? `@petrochenkov`
2022-11-22Rollup merge of #104597 - ↵Matthias Krüger-2/+2
compiler-errors:need_migrate_deref_output_trait_object-msg, r=eholk Probe + better error messsage for `need_migrate_deref_output_trait_object` 1. Use `InferCtxt::probe` in `need_migrate_deref_output_trait_object` -- that normalization *could* technically do type inference as a side-effect, and this is a lint, so it should have no side-effects. 2. Return the trait-ref so we format the error message correctly. See the UI test change -- `(dyn A + 'static)` is not a trait.
2022-11-22Rollup merge of #104559 - nnethercote:split-MacArgs, r=petrochenkovMatthias Krüger-16/+20
Split `MacArgs` in two. `MacArgs` is an enum with three variants: `Empty`, `Delimited`, and `Eq`. It's used in two ways: - For representing attribute macro arguments (e.g. in `AttrItem`), where all three variants are used. - For representing function-like macros (e.g. in `MacCall` and `MacroDef`), where only the `Delimited` variant is used. In other words, `MacArgs` is used in two quite different places due to them having partial overlap. I find this makes the code hard to read. It also leads to various unreachable code paths, and allows invalid values (such as accidentally using `MacArgs::Empty` in a `MacCall`). This commit splits `MacArgs` in two: - `DelimArgs` is a new struct just for the "delimited arguments" case. It is now used in `MacCall` and `MacroDef`. - `AttrArgs` is a renaming of the old `MacArgs` enum for the attribute macro case. Its `Delimited` variant now contains a `DelimArgs`. Various other related things are renamed as well. These changes make the code clearer, avoids several unreachable paths, and disallows the invalid values. r? `@petrochenkov`
2022-11-22Rollup merge of #104557 - eholk:dyn-star-in-traits, r=compiler-errorsMatthias Krüger-0/+36
Add a test case for async dyn* traits This adds a test case that approximates async functions in dyn traits using `dyn*`. The purpose is to have an example of where we are with `dyn*` and the goal of using it for dyn traits. Issue #102425 r? `@compiler-errors`
2022-11-22Rollup merge of #104416 - clubby789:fix-104414, r=eholkMatthias Krüger-1/+7
Fix using `include_bytes` in pattern position Fix #104414
2022-11-22Split `MacArgs` in two.Nicholas Nethercote-16/+20
`MacArgs` is an enum with three variants: `Empty`, `Delimited`, and `Eq`. It's used in two ways: - For representing attribute macro arguments (e.g. in `AttrItem`), where all three variants are used. - For representing function-like macros (e.g. in `MacCall` and `MacroDef`), where only the `Delimited` variant is used. In other words, `MacArgs` is used in two quite different places due to them having partial overlap. I find this makes the code hard to read. It also leads to various unreachable code paths, and allows invalid values (such as accidentally using `MacArgs::Empty` in a `MacCall`). This commit splits `MacArgs` in two: - `DelimArgs` is a new struct just for the "delimited arguments" case. It is now used in `MacCall` and `MacroDef`. - `AttrArgs` is a renaming of the old `MacArgs` enum for the attribute macro case. Its `Delimited` variant now contains a `DelimArgs`. Various other related things are renamed as well. These changes make the code clearer, avoids several unreachable paths, and disallows the invalid values.
2022-11-21Auto merge of #104533 - oli-obk:method_callee, r=lcnrbors-28/+56
Clean up and harden various methods around trait substs r? `@lcnr`
2022-11-21Simplify testOli Scherer-3/+1
Co-authored-by: lcnr <rust@lcnr.de>
2022-11-21Use `as_closure` helper methodOli Scherer-1/+1
Co-authored-by: lcnr <rust@lcnr.de>
2022-11-21Stop passing the self-type as a separate argument.Oli Scherer-12/+8
2022-11-21Fix clippy's missing substsOli Scherer-13/+19
2022-11-21Fix an ICE that I just made worseOli Scherer-0/+28
2022-11-21Allow iterators instead of requiring slices that will get turned into iteratorsOli Scherer-4/+4