about summary refs log tree commit diff
path: root/src
AgeCommit message (Collapse)AuthorLines
2022-12-03fix #101749, use . instead of :: when accessing a method of an objectyukang-51/+128
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
2022-11-21Assert that various types have the right amount of generic args and fix the ↵Oli Scherer-1/+1
sites that used the wrong amount
2022-11-21Auto merge of #104120 - mejrs:diag, r=davidtwcobors-132/+167
Match and enforce crate and slug names Some of these were in the wrong place or had a name that didn't match.
2022-11-21Auto merge of #104673 - matthiaskrgr:rollup-85f65ov, r=matthiaskrgrbors-100/+84
Rollup of 9 pull requests Successful merges: - #104420 (Fix doc example for `wrapping_abs`) - #104499 (rustdoc JSON: Use `Function` everywhere and remove `Method`) - #104500 (`rustc_ast`: remove `ref` patterns) - #104511 (Mark functions created for `raw-dylib` on x86 with DllImport storage class) - #104595 (Add `PolyExistentialPredicate` type alias) - #104605 (deduplicate constant evaluation in cranelift backend) - #104628 (Revert "Update CI to use Android NDK r25b") - #104662 (Streamline deriving on packed structs.) - #104667 (Revert formatting changes of a test) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-11-21Fix make testmejrs-3/+3
2022-11-21Improve slug name errormejrs-0/+35
2022-11-21Fix testsmejrs-129/+129
2022-11-21Rollup merge of #104667 - WaffleLapkin:unfmttest, r=Dylan-DPCMatthias Krüger-5/+5
Revert formatting changes of a test See https://github.com/rust-lang/rust/pull/99935/files#r1027259119 cc ``@CAD97``
2022-11-21Rollup merge of #104662 - nnethercote:tweak-deriving-for-packed-non-copy, ↵Matthias Krüger-17/+6
r=jackh726 Streamline deriving on packed structs. The current approach to field accesses in derived code: - Normal case: `&self.0` - In a packed struct that derives `Copy`: `&{self.0}` - In a packed struct that doesn't derive `Copy`: `let Self(ref x) = *self` The `let` pattern used in the third case is equivalent to the simpler field access in the first case. This commit changes the third case to use a field access. The commit also combines two boolean arguments (`is_packed` and `always_copy`) into a single field (`copy_fields`) earlier, to save passing both around. r? ``@jackh726``
2022-11-21Rollup merge of #104628 - alex-pinkus:revert-android-ndk-upgrade, r=pietroalbiniMatthias Krüger-29/+42
Revert "Update CI to use Android NDK r25b" This reverts commit bf7f1ca316a249cf99d722d79a0db12fef687142 (pull request #102332). The relevant discussion can be found in #103673, where it was agreed that more time is needed to warn the community of the upcoming breakage. This PR is for the `master` branch, where a conflict was recently introduced due to 6d8160261ff3aee3b6eaacc37ac96cafff530980. The conflict is in `cc_detect.rs`, where the code that corrects the target triple was moved to a new function called `ndk_compiler()`. This puts the old logic in the `ndk_compiler` function, and assumes that it works properly in the other location where that code is being called. I would appreciate review from ``@pietroalbini`` to understand how we can test that the reverted logic is also suitable for the additional use case (seems to be related to setting `cc` and `cxx`). I've confirmed already that with these changes I can compile for `armv7-linux-androideabi`, `aarch64-linux-android`, `i686-linux-android`, and `x86_64-linux-android` using `x.py`. A separate revert for the `beta` branch will be required, since the original change has already made it to beta. The beta revert is available at https://github.com/alex-pinkus/rust/commit/3fa0d94674fbe37090ebe44ac1f06e2233f3121e, but I'm not sure of the process for staging that PR.
2022-11-21Rollup merge of #104595 - compiler-errors:poly-existential-predicate, r=lcnrMatthias Krüger-1/+1
Add `PolyExistentialPredicate` type alias Wrapping `ExistentialPredicate`s in a binder is very common, and this alias already exists for the `PolyExistential{TraitRef,Projection}` types.
2022-11-21Rollup merge of #104511 - dpaoliello:privateglobalworkaround, r=michaelwoeristerMatthias Krüger-0/+16
Mark functions created for `raw-dylib` on x86 with DllImport storage class Fix for #104453 ## Issue Details On x86 Windows, LLVM uses 'L' as the prefix for any private global symbols (`PrivateGlobalPrefix`), so when the `raw-dylib` feature creates an undecorated function symbol that begins with an 'L' LLVM misinterprets that as a private global symbol that it created and so fails the compilation at a later stage since such a symbol must have a definition. ## Fix Details Mark the function we are creating for `raw-dylib` with `DllImport` storage class (this was already being done for MSVC at a later point for `callee::get_fn` but not for GNU (due to "backwards compatibility")): this will cause LLVM to prefix the name with `__imp_` and so it won't mistake it for a private global symbol.
2022-11-21Rollup merge of #104499 - Enselic:no-method-in-rustdoc-json, r=GuillaumeGomezMatthias Krüger-48/+14
rustdoc JSON: Use `Function` everywhere and remove `Method` Closes #100259
2022-11-21Auto merge of #103491 - cjgillot:self-rpit, r=oli-obkbors-79/+230
Support using `Self` or projections inside an RPIT/async fn I reuse the same idea as https://github.com/rust-lang/rust/pull/103449 to use variances to encode whether a lifetime parameter is captured by impl-trait. The current implementation of async and RPIT replace all lifetimes from the parent generics by `'static`. This PR changes the scheme ```rust impl<'a> Foo<'a> { fn foo<'b, T>() -> impl Into<Self> + 'b { ... } } opaque Foo::<'_a>::foo::<'_b, T>::opaque<'b>: Into<Foo<'_a>> + 'b; impl<'a> Foo<'a> { // OLD fn foo<'b, T>() -> Foo::<'static>::foo::<'static, T>::opaque::<'b> { ... } ^^^^^^^ the `Self` becomes `Foo<'static>` // NEW fn foo<'b, T>() -> Foo::<'a>::foo::<'b, T>::opaque::<'b> { ... } ^^ the `Self` stays `Foo<'a>` } ``` There is the same issue with projections. In the example, substitute `Self` by `<T as Trait<'b>>::Assoc` in the sugared version, and `Foo<'_a>` by `<T as Trait<'_b>>::Assoc` in the desugared one. This allows to support `Self` in impl-trait, since we do not replace lifetimes by `'static` any more. The same trick allows to use projections like `T::Assoc` where `Self` is allowed. The feature is gated behind a `impl_trait_projections` feature gate. The implementation relies on 2 tweaking rules for opaques in 2 places: - we only relate substs that correspond to captured lifetimes during TypeRelation; - we only list captured lifetimes in choice region computation. For simplicity, I encoded the "capturedness" of lifetimes as a variance, `Bivariant` vs `Invariant` for unused vs captured lifetimes. The `variances_of` query used to ICE for opaques. Impl-trait that do not reference `Self` or projections will have their variances as: - `o` (invariant) for each parent type or const; - `*` (bivariant) for each parent lifetime --> will not participate in borrowck; - `o` (invariant) for each own lifetime. Impl-trait that does reference `Self` and/or projections will have some parent lifetimes marked as `o` (as the example above), and participate in type relation and borrowck. In the example above, `variances_of(opaque) = ['_a: o, '_b: *, T: o, 'b: o]`. r? types cc `@compiler-errors` , as you asked about the issue with `Self` and projections.
2022-11-21Revert formatting changes of a testMaybe Waffle-5/+5
2022-11-21Auto merge of #103454 - camsteffen:remove-conservatively-uninhabited, r=oli-obkbors-3/+3
Factor out `conservative_is_privately_uninhabited` After #102660 there is no more need for `conservative_is_privately_uninhabited`. r? `@oli-obk`
2022-11-21Streamline deriving on packed structs.Nicholas Nethercote-17/+6
The current approach to field accesses in derived code: - Normal case: `&self.0` - In a packed struct that derives `Copy`: `&{self.0}` - In a packed struct that doesn't derive `Copy`: `let Self(ref x) = *self` The `let` pattern used in the third case is equivalent to the simpler field access in the first case. This commit changes the third case to use a field access. The commit also combines two boolean arguments (`is_packed` and `always_copy`) into a single field (`copy_fields`) earlier, to save passing both around.
2022-11-21Auto merge of #102717 - beetrees:repr128-c-style-debuginfo, r=nagisabors-0/+39
Pass 128-bit C-style enum enumerator values to LLVM Pass the full 128 bits of C-style enum enumerators through to LLVM. This means that debuginfo for C-style repr128 enums is now emitted correctly for DWARF platforms (as compared to not being correctly emitted on any platform). Tracking issue: #56071
2022-11-20Factor out conservative_is_privately_uninhabitedCameron Steffen-2/+2
2022-11-20Change to Ty::is_inhabited_fromCameron Steffen-1/+1
2022-11-20Rollup merge of #104581 - notriddle:notriddle/js-iife-2, r=GuillaumeGomezMatthias Krüger-6/+3
rustdoc: remove unused JS IIFE from main.js This [IIFE] made sense when it was added in deaf5e200e79a75ac57d3f0952f6758a38168e52 and there was a local variable scoped to it, but now it calls a function, but declares nothing. [IIFE]: https://developer.mozilla.org/en-US/docs/Glossary/IIFE "immediately invoked function expression"
2022-11-20Rollup merge of #104504 - compiler-errors:fru-syntax-note, r=estebankMatthias Krüger-19/+65
Add a detailed note for missing comma typo w/ FRU syntax Thanks to `@pierwill` for working on this with me! Fixes #104373, perhaps `@alice-i-cecile` can comment on the new error for the example provided on that issue -- feedback is welcome. ``` error[E0063]: missing field `defaulted` in initializer of `Outer` --> $DIR/multi-line-fru-suggestion.rs:14:5 | LL | Outer { | ^^^^^ missing `defaulted` | note: this expression may have been misinterpreted as a `..` range expression --> $DIR/multi-line-fru-suggestion.rs:16:16 | LL | inner: Inner { | ________________^ LL | | a: 1, LL | | b: 2, LL | | } | |_________^ this expression does not end in a comma... LL | ..Default::default() | ^^^^^^^^^^^^^^^^^^^^ ... so this is interpreted as a `..` range expression, instead of functional record update syntax help: to set the remaining fields from `Default::default()`, separate the last named field with a comma | LL | }, | + error: aborting due to previous error For more information about this error, try `rustc --explain E0063`. ```
2022-11-20Rollup merge of #104487 - klensy:ntapi, r=Mark-SimulacrumMatthias Krüger-6/+6
update ntapi dep to remove future-incompat warning This fixes warning https://github.com/rust-lang-ci/rust/actions/runs/3477235400/jobs/5813202075#step:25:217 `warning: the following packages contain code that will be rejected by a future version of Rust: ntapi v0.3.7` by upgrading `sysinfo` version (https://github.com/GuillaumeGomez/sysinfo/blob/master/CHANGELOG.md#0267) There was some breaking changes in `sysinfo`: * 0.25.0 (System::refresh_cpu behaviour changed: it only computes CPU usage and doesn't retrieve CPU frequency.) not affected? * 0.26.0 (Switch memory unit from kilobytes to bytes) fixed.
2022-11-20Rollup merge of #104640 - GuillaumeGomez:migrate-kdb-css, r=notriddleMatthias Krüger-18/+50
Migrate kdb style to CSS variables r? `@notriddle`
2022-11-20Rollup merge of #104611 - notriddle:notriddle/scrape-examples-button, ↵Matthias Krüger-5/+77
r=GuillaumeGomez rustdoc: use real buttons for scrape examples controls This makes the expand and switch controls keyboard-accessible. Preview: https://notriddle.com/notriddle-rustdoc-demos/scrape-examples-button/test_dingus/fn.test.html
2022-11-20Extend GUI tests to check kbd colorsGuillaume Gomez-0/+38
2022-11-20Migrate kdb colors to CSS variablesGuillaume Gomez-18/+12
2022-11-20Auto merge of #104617 - RalfJung:miri, r=RalfJungbors-114/+152
update Miri r? `@thomcc` for the lib changes (removing a `cfg(miri)` that is no longer needed)
2022-11-20rustdoc JSON: Clarify that `Function` is also used for methodsMartin Nordholts-0/+1
2022-11-20Auto merge of #2683 - RalfJung:align_offset, r=RalfJungbors-0/+12
make align_offset always work on no-provenance pointers Fixes https://github.com/rust-lang/miri/issues/2682
2022-11-20Auto merge of #103390 - compiler-errors:metadata-mod-regions, r=eholkbors-0/+17
Check fat pointer metadata compatibility modulo regions Regions don't really mean anything anyways during hir typeck. If this `erase_regions` makes anyone nervous, it's probably equally valid to just equate the types using a type relation, but regardless we should _not_ be using strict type equality while region variables are present. Fixes #103384
2022-11-20make align_offset always work on no-provenance pointersRalf Jung-0/+12
2022-11-20make miri-seed a regular integer, and also set layout-seed in many-seedsRalf Jung-9/+8
2022-11-20Auto merge of #98914 - fee1-dead-contrib:min-deref-patterns, r=compiler-errorsbors-91/+246
Minimal implementation of implicit deref patterns for Strings cc `@compiler-errors` `@BoxyUwU` https://github.com/rust-lang/lang-team/issues/88 #87121 ~~I forgot to add a feature gate, will do so in a minute~~ Done
2022-11-20fix unused warning in a testRalf Jung-1/+1
2022-11-20Merge from rustcRalf Jung-632/+1142
2022-11-20Preparing for merge from rustcRalf Jung-1/+1
2022-11-20Rollup merge of #104467 - ↵Yuki Okushi-0/+45
fuzzypixelz:fix/attempt-to-substract-with-overflow, r=compiler-errors Fix substraction with overflow in `wrong_number_of_generic_args.rs` Fixes #104287 This issue happens in the `suggest_moving_args_from_assoc_fn_to_trait_for_qualified_path` function, which seems to run before the error checking facilities can catch an invalid use of generic arguments. Thus we get a subtraction with overflow because the code implicitly assumes that the source program makes sense (or is this assumption not true even if the program is correct?).
2022-11-20Rollup merge of #104435 - scottmcm:iter-repeat-n, r=thomccYuki Okushi-0/+56
`VecDeque::resize` should re-use the buffer in the passed-in element Today it always copies it for *every* appended element, but one of those clones is avoidable. This adds `iter::repeat_n` (https://github.com/rust-lang/rust/issues/104434) as the primitive needed to do this. If this PR is acceptable, I'll also use this in `Vec` rather than its custom `ExtendElement` type & infrastructure that is harder to share between multiple different containers: https://github.com/rust-lang/rust/blob/101e1822c3e54e63996c8aaa014d55716f3937eb/library/alloc/src/vec/mod.rs#L2479-L2492
2022-11-19Revert "Update CI to use Android NDK r25b"Alex Pinkus-29/+42
This reverts commit bf7f1ca316a249cf99d722d79a0db12fef687142.
2022-11-19rustdoc: fix test caseMichael Howell-1/+1
2022-11-19rustdoc: add test case for scraped example expand GUIMichael Howell-0/+63
2022-11-19implement clock_gettime on macosRalf Jung-27/+56