]> git.lizzy.rs Git - rust.git/log
rust.git
18 months agoRollup merge of #103396 - RalfJung:pinning-closure-captures, r=dtolnay
Matthias Krüger [Mon, 21 Nov 2022 23:01:06 +0000 (00:01 +0100)]
Rollup merge of #103396 - RalfJung:pinning-closure-captures, r=dtolnay

Pin::new_unchecked: discuss pinning closure captures

Regardless of how the discussion in https://github.com/rust-lang/rust/pull/102737 turns out, pinning closure captures is super subtle business and probably worth discussing separately.

18 months agoAuto merge of #104120 - mejrs:diag, r=davidtwco
bors [Mon, 21 Nov 2022 18:36:26 +0000 (18:36 +0000)]
Auto merge of #104120 - mejrs:diag, r=davidtwco

Match and enforce crate and slug names

Some of these were in the wrong place or had a name that didn't match.

18 months agoAuto merge of #104673 - matthiaskrgr:rollup-85f65ov, r=matthiaskrgr
bors [Mon, 21 Nov 2022 15:22:54 +0000 (15:22 +0000)]
Auto merge of #104673 - matthiaskrgr:rollup-85f65ov, r=matthiaskrgr

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

18 months agoFix make test
mejrs [Sun, 13 Nov 2022 14:51:05 +0000 (15:51 +0100)]
Fix make test

18 months agoImprove slug name error
mejrs [Sun, 13 Nov 2022 12:10:36 +0000 (13:10 +0100)]
Improve slug name error

18 months agoFix tests
mejrs [Mon, 7 Nov 2022 23:42:00 +0000 (00:42 +0100)]
Fix tests

18 months agoMatch crate and slug names
mejrs [Mon, 7 Nov 2022 18:47:32 +0000 (19:47 +0100)]
Match crate and slug names

18 months agoRollup merge of #104667 - WaffleLapkin:unfmttest, r=Dylan-DPC
Matthias Krüger [Mon, 21 Nov 2022 13:11:13 +0000 (14:11 +0100)]
Rollup merge of #104667 - WaffleLapkin:unfmttest, r=Dylan-DPC

Revert formatting changes of a test

See https://github.com/rust-lang/rust/pull/99935/files#r1027259119
cc ``@CAD97``

18 months agoRollup merge of #104662 - nnethercote:tweak-deriving-for-packed-non-copy, r=jackh726
Matthias Krüger [Mon, 21 Nov 2022 13:11:13 +0000 (14:11 +0100)]
Rollup merge of #104662 - nnethercote:tweak-deriving-for-packed-non-copy, 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``

18 months agoRollup merge of #104628 - alex-pinkus:revert-android-ndk-upgrade, r=pietroalbini
Matthias Krüger [Mon, 21 Nov 2022 13:11:12 +0000 (14:11 +0100)]
Rollup merge of #104628 - alex-pinkus:revert-android-ndk-upgrade, r=pietroalbini

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.

18 months agoRollup merge of #104605 - RalfJung:clf_consts, r=bjorn3
Matthias Krüger [Mon, 21 Nov 2022 13:11:12 +0000 (14:11 +0100)]
Rollup merge of #104605 - RalfJung:clf_consts, r=bjorn3

deduplicate constant evaluation in cranelift backend

The cranelift backend had two matches on `ConstantKind`, which can be avoided, and used this `eval_for_mir` that nothing else uses... this makes things more consistent with the (better-tested) LLVM backend.

I noticed this because cranelift was the only user of `eval_for_mir`. However `try_eval_for_mir` still has one other user in `eval`... the odd thing is that the interpreter has its own `eval_mir_constant` which seems to duplicate the same functionality and does not use `try_eval_for_mir`. No idea what is happening here.

r? ``@bjorn3``
Cc ``@lcnr``

18 months agoRollup merge of #104595 - compiler-errors:poly-existential-predicate, r=lcnr
Matthias Krüger [Mon, 21 Nov 2022 13:11:11 +0000 (14:11 +0100)]
Rollup merge of #104595 - compiler-errors:poly-existential-predicate, r=lcnr

Add `PolyExistentialPredicate` type alias

Wrapping `ExistentialPredicate`s in a binder is very common, and this alias already exists for the `PolyExistential{TraitRef,Projection}` types.

18 months agoRollup merge of #104511 - dpaoliello:privateglobalworkaround, r=michaelwoerister
Matthias Krüger [Mon, 21 Nov 2022 13:11:10 +0000 (14:11 +0100)]
Rollup merge of #104511 - dpaoliello:privateglobalworkaround, r=michaelwoerister

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.

18 months agoRollup merge of #104500 - WaffleLapkin:deref-the-compiler, r=wesleywiser
Matthias Krüger [Mon, 21 Nov 2022 13:11:10 +0000 (14:11 +0100)]
Rollup merge of #104500 - WaffleLapkin:deref-the-compiler, r=wesleywiser

`rustc_ast`: remove `ref` patterns

Or in other words use match ergonomics in `rustc_ast`. I do plan to do the same with other crates, but to keep the diff sane, let's do them one at a time.

18 months agoRollup merge of #104499 - Enselic:no-method-in-rustdoc-json, r=GuillaumeGomez
Matthias Krüger [Mon, 21 Nov 2022 13:11:09 +0000 (14:11 +0100)]
Rollup merge of #104499 - Enselic:no-method-in-rustdoc-json, r=GuillaumeGomez

rustdoc JSON: Use `Function` everywhere and remove `Method`

Closes #100259

18 months agoRollup merge of #104420 - TethysSvensson:master, r=JohnTitor
Matthias Krüger [Mon, 21 Nov 2022 13:11:09 +0000 (14:11 +0100)]
Rollup merge of #104420 - TethysSvensson:master, r=JohnTitor

Fix doc example for `wrapping_abs`

The `max` variable is unused. This change introduces the `min_plus` variable, to make the example similar to the one from `saturating_abs`. An alternative would be to remove the unused variable.

18 months agoAuto merge of #103491 - cjgillot:self-rpit, r=oli-obk
bors [Mon, 21 Nov 2022 12:17:03 +0000 (12:17 +0000)]
Auto merge of #103491 - cjgillot:self-rpit, r=oli-obk

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.

18 months agoRevert formatting changes of a test
Maybe Waffle [Mon, 21 Nov 2022 10:23:53 +0000 (10:23 +0000)]
Revert formatting changes of a test

18 months agoRemove `ref` patterns from `rustc_ast`
Maybe Waffle [Wed, 16 Nov 2022 19:26:38 +0000 (19:26 +0000)]
Remove `ref` patterns from `rustc_ast`

Also use if let chains in one case.

18 months agoAuto merge of #103454 - camsteffen:remove-conservatively-uninhabited, r=oli-obk
bors [Mon, 21 Nov 2022 04:42:43 +0000 (04:42 +0000)]
Auto merge of #103454 - camsteffen:remove-conservatively-uninhabited, r=oli-obk

Factor out `conservative_is_privately_uninhabited`

After #102660 there is no more need for `conservative_is_privately_uninhabited`.

r? `@oli-obk`

18 months agoStreamline deriving on packed structs.
Nicholas Nethercote [Mon, 21 Nov 2022 00:48:25 +0000 (11:48 +1100)]
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.

18 months agoAuto merge of #102717 - beetrees:repr128-c-style-debuginfo, r=nagisa
bors [Mon, 21 Nov 2022 01:44:12 +0000 (01:44 +0000)]
Auto merge of #102717 - beetrees:repr128-c-style-debuginfo, r=nagisa

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

18 months agoFactor out conservative_is_privately_uninhabited
Cameron Steffen [Sun, 23 Oct 2022 22:32:40 +0000 (17:32 -0500)]
Factor out conservative_is_privately_uninhabited

18 months agoChange to Ty::is_inhabited_from
Cameron Steffen [Sun, 23 Oct 2022 22:32:17 +0000 (17:32 -0500)]
Change to Ty::is_inhabited_from

18 months agoFix typo
Cameron Steffen [Sun, 23 Oct 2022 23:19:06 +0000 (18:19 -0500)]
Fix typo

18 months agoAuto merge of #104655 - matthiaskrgr:rollup-r5kfffy, r=matthiaskrgr
bors [Sun, 20 Nov 2022 23:03:20 +0000 (23:03 +0000)]
Auto merge of #104655 - matthiaskrgr:rollup-r5kfffy, r=matthiaskrgr

Rollup of 9 pull requests

Successful merges:

 - #101310 (Clarify and restrict when `{Arc,Rc}::get_unchecked_mut` is allowed.)
 - #104461 (Fix building of `aarch64-pc-windows-gnullvm`)
 - #104487 (update ntapi dep to remove future-incompat warning)
 - #104504 (Add a detailed note for missing comma typo w/ FRU syntax)
 - #104581 (rustdoc: remove unused JS IIFE from main.js)
 - #104632 (avoid non-strict-provenance casts in libcore tests)
 - #104634 (move core::arch into separate file)
 - #104641 (replace unusual grammar)
 - #104643 (add examples to chunks remainder methods. )

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

18 months agoRollup merge of #104643 - pnkfelix:examples-for-chunks-remainder, r=scottmcm
Matthias Krüger [Sun, 20 Nov 2022 22:50:30 +0000 (23:50 +0100)]
Rollup merge of #104643 - pnkfelix:examples-for-chunks-remainder, r=scottmcm

add examples to chunks remainder methods.

add examples to chunks remainder methods.

my motivation for adding the examples was to make it very clear that the state of the iterator (in terms of where its cursor lies) has no effect on what remainder returns.

Also fixed some links to rchunk remainder methods.

18 months agoRollup merge of #104641 - tshepang:grammar, r=Mark-Simulacrum
Matthias Krüger [Sun, 20 Nov 2022 22:50:29 +0000 (23:50 +0100)]
Rollup merge of #104641 - tshepang:grammar, r=Mark-Simulacrum

replace unusual grammar

18 months agoRollup merge of #104634 - RalfJung:core-arch, r=Mark-Simulacrum
Matthias Krüger [Sun, 20 Nov 2022 22:50:29 +0000 (23:50 +0100)]
Rollup merge of #104634 - RalfJung:core-arch, r=Mark-Simulacrum

move core::arch into separate file

This works around https://github.com/rust-lang/rust/issues/104633 which otherwise leads to warnings in miri-test-libstd.

18 months agoRollup merge of #104632 - RalfJung:core-test-strict-provenance, r=thomcc
Matthias Krüger [Sun, 20 Nov 2022 22:50:28 +0000 (23:50 +0100)]
Rollup merge of #104632 - RalfJung:core-test-strict-provenance, r=thomcc

avoid non-strict-provenance casts in libcore tests

r? `@thomcc`

18 months agoRollup merge of #104581 - notriddle:notriddle/js-iife-2, r=GuillaumeGomez
Matthias Krüger [Sun, 20 Nov 2022 22:50:28 +0000 (23:50 +0100)]
Rollup merge of #104581 - notriddle:notriddle/js-iife-2, r=GuillaumeGomez

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"

18 months agoRollup merge of #104504 - compiler-errors:fru-syntax-note, r=estebank
Matthias Krüger [Sun, 20 Nov 2022 22:50:27 +0000 (23:50 +0100)]
Rollup merge of #104504 - compiler-errors:fru-syntax-note, r=estebank

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`.
```

18 months agoRollup merge of #104487 - klensy:ntapi, r=Mark-Simulacrum
Matthias Krüger [Sun, 20 Nov 2022 22:50:27 +0000 (23:50 +0100)]
Rollup merge of #104487 - klensy:ntapi, r=Mark-Simulacrum

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.

18 months agoRollup merge of #104461 - mati865:gnullvm-aarch64-fixup, r=Mark-Simulacrum
Matthias Krüger [Sun, 20 Nov 2022 22:50:26 +0000 (23:50 +0100)]
Rollup merge of #104461 - mati865:gnullvm-aarch64-fixup, r=Mark-Simulacrum

Fix building of `aarch64-pc-windows-gnullvm`

That change had been lost during rebase of my last PR (https://github.com/rust-lang/rust/pull/103894).

18 months agoRollup merge of #101310 - zachs18:rc_get_unchecked_mut_docs_soundness, r=Mark-Simulacrum
Matthias Krüger [Sun, 20 Nov 2022 22:50:26 +0000 (23:50 +0100)]
Rollup merge of #101310 - zachs18:rc_get_unchecked_mut_docs_soundness, r=Mark-Simulacrum

Clarify and restrict when `{Arc,Rc}::get_unchecked_mut` is allowed.

(Tracking issue for `{Arc,Rc}::get_unchecked_mut`: #63292)

(I'm using `Rc` in this comment, but it applies for `Arc` all the same).

As currently documented, `Rc::get_unchecked_mut` can lead to unsoundness when multiple `Rc`/`Weak` pointers to the same allocation exist. The current documentation only requires that other `Rc`/`Weak` pointers to the same allocation "must not be dereferenced for the duration of the returned borrow". This can lead to unsoundness in (at least) two ways: variance, and `Rc<str>`/`Rc<[u8]>` aliasing. ([playground link](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=d7e2d091c389f463d121630ab0a37320)).

This PR changes the documentation of `Rc::get_unchecked_mut` to restrict usage to when all `Rc<T>`/`Weak<T>` have the exact same `T` (including lifetimes). I believe this is sufficient to prevent unsoundness, while still allowing `get_unchecked_mut` to be called on an aliased `Rc` as long as the safety contract is upheld by the caller.

## Alternatives

* A less strict, but still sound alternative would be to say that the caller must only write values which are valid for all aliased `Rc`/`Weak` inner types. (This was [mentioned](https://github.com/rust-lang/rust/issues/63292#issuecomment-568284090) in the tracking issue). This may be too complicated to clearly express in the documentation.
* A more strict alternative would be to say that there must not be any aliased `Rc`/`Weak` pointers, i.e. it is required that get_mut would return `Some(_)`. (This was also mentioned in the tracking issue). There is at least one codebase that this would cause to become unsound ([here](https://github.com/kaimast/lsm-rs/blob/be5a164d770d850d905e510e2966ad4b1cc9aa5e/src/memtable.rs#L166), where additional locking is used to ensure unique access to an aliased `Rc<T>`;  I saw this because it was linked on the tracking issue).

18 months agoAuto merge of #104646 - matthiaskrgr:rollup-7xnhzf0, r=matthiaskrgr
bors [Sun, 20 Nov 2022 19:14:14 +0000 (19:14 +0000)]
Auto merge of #104646 - matthiaskrgr:rollup-7xnhzf0, r=matthiaskrgr

Rollup of 6 pull requests

Successful merges:

 - #104537 (fix std::thread docs are unclear regarding stack sizes)
 - #104558 (Don't assume `FILE_ID_BOTH_DIR_INFO` will be aligned)
 - #104564 (interpret: use Either over Result when it is not representing an error condition)
 - #104568 (clarify that realloc refreshes pointer provenance even when the allocation remains in-place)
 - #104611 (rustdoc: use real buttons for scrape examples controls)
 - #104640 (Migrate kdb style to CSS variables)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

18 months agoRollup merge of #104640 - GuillaumeGomez:migrate-kdb-css, r=notriddle
Matthias Krüger [Sun, 20 Nov 2022 17:21:49 +0000 (18:21 +0100)]
Rollup merge of #104640 - GuillaumeGomez:migrate-kdb-css, r=notriddle

Migrate kdb style to CSS variables

r? `@notriddle`

18 months agoRollup merge of #104611 - notriddle:notriddle/scrape-examples-button, r=GuillaumeGomez
Matthias Krüger [Sun, 20 Nov 2022 17:21:49 +0000 (18:21 +0100)]
Rollup merge of #104611 - notriddle:notriddle/scrape-examples-button, 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

18 months agoRollup merge of #104568 - RalfJung:realloc, r=Amanieu
Matthias Krüger [Sun, 20 Nov 2022 17:21:48 +0000 (18:21 +0100)]
Rollup merge of #104568 - RalfJung:realloc, r=Amanieu

clarify that realloc refreshes pointer provenance even when the allocation remains in-place

This [matches what C does](https://en.cppreference.com/w/c/memory/realloc):

> The original pointer ptr is invalidated and any access to it is undefined behavior (even if reallocation was in-place).

Cc `@rust-lang/wg-allocators`

18 months agoRollup merge of #104564 - RalfJung:either, r=oli-obk
Matthias Krüger [Sun, 20 Nov 2022 17:21:48 +0000 (18:21 +0100)]
Rollup merge of #104564 - RalfJung:either, r=oli-obk

interpret: use Either over Result when it is not representing an error condition

r? `@oli-obk`

18 months agoRollup merge of #104558 - thomcc:unalign-diriter, r=ChrisDenton
Matthias Krüger [Sun, 20 Nov 2022 17:21:47 +0000 (18:21 +0100)]
Rollup merge of #104558 - thomcc:unalign-diriter, r=ChrisDenton

Don't assume `FILE_ID_BOTH_DIR_INFO` will be aligned

Fixes #104530. See that issue for info.

r? `@ChrisDenton`

18 months agoRollup merge of #104537 - HintringerFabian:docs_default_min_stack_size, r=the8472
Matthias Krüger [Sun, 20 Nov 2022 17:21:47 +0000 (18:21 +0100)]
Rollup merge of #104537 - HintringerFabian:docs_default_min_stack_size, r=the8472

fix std::thread docs are unclear regarding stack sizes

Improves the documentation about the default stack size of a spawned thread
Fixes #102671

18 months agoadd examples to chunks remainder methods. Also fixed some links to rchunk remainder...
Felix S. Klock II [Sun, 20 Nov 2022 16:43:23 +0000 (11:43 -0500)]
add examples to chunks remainder methods. Also fixed some links to rchunk remainder methods.

18 months agoreplace unusual grammar
Tshepang Mbambo [Sun, 20 Nov 2022 15:28:34 +0000 (17:28 +0200)]
replace unusual grammar

18 months agoenable fuzzy_provenance_casts in libcore+tests
Ralf Jung [Sun, 20 Nov 2022 10:28:08 +0000 (11:28 +0100)]
enable fuzzy_provenance_casts in libcore+tests

18 months agoExtend GUI tests to check kbd colors
Guillaume Gomez [Sun, 20 Nov 2022 13:32:10 +0000 (14:32 +0100)]
Extend GUI tests to check kbd colors

18 months agoMigrate kdb colors to CSS variables
Guillaume Gomez [Sun, 20 Nov 2022 13:32:27 +0000 (14:32 +0100)]
Migrate kdb colors to CSS variables

18 months agoAuto merge of #104617 - RalfJung:miri, r=RalfJung
bors [Sun, 20 Nov 2022 12:57:48 +0000 (12:57 +0000)]
Auto merge of #104617 - RalfJung:miri, r=RalfJung

update Miri

r? `@thomcc` for the lib changes (removing a `cfg(miri)` that is no longer needed)

18 months agorustdoc JSON: Clarify that `Function` is also used for methods
Martin Nordholts [Sun, 20 Nov 2022 12:48:45 +0000 (13:48 +0100)]
rustdoc JSON: Clarify that `Function` is also used for methods

18 months agoIncorporate review feedback
Tethys Svensson [Sun, 20 Nov 2022 11:30:14 +0000 (12:30 +0100)]
Incorporate review feedback

18 months agocfg(miri) no longer needed in sys/unix/time.rs
Ralf Jung [Sat, 19 Nov 2022 22:50:57 +0000 (23:50 +0100)]
cfg(miri) no longer needed in sys/unix/time.rs

18 months agoupdate lockfile
Ralf Jung [Sun, 20 Nov 2022 08:15:12 +0000 (09:15 +0100)]
update lockfile

18 months agoAuto merge of #2683 - RalfJung:align_offset, r=RalfJung
bors [Sun, 20 Nov 2022 10:16:02 +0000 (10:16 +0000)]
Auto merge of #2683 - RalfJung:align_offset, r=RalfJung

make align_offset always work on no-provenance pointers

Fixes https://github.com/rust-lang/miri/issues/2682

18 months agoAuto merge of #103390 - compiler-errors:metadata-mod-regions, r=eholk
bors [Sun, 20 Nov 2022 10:09:39 +0000 (10:09 +0000)]
Auto merge of #103390 - compiler-errors:metadata-mod-regions, r=eholk

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

18 months agomake align_offset always work on no-provenance pointers
Ralf Jung [Sun, 20 Nov 2022 10:01:00 +0000 (11:01 +0100)]
make align_offset always work on no-provenance pointers

18 months agoAuto merge of #2681 - RalfJung:seed, r=oli-obk
bors [Sun, 20 Nov 2022 09:49:34 +0000 (09:49 +0000)]
Auto merge of #2681 - RalfJung:seed, r=oli-obk

make miri-seed a regular integer, and also set layout-seed in many-seeds

This makes the seed format consistent between `-Zlayout-seed` and `-Zmiri-seed`.

18 months agomake miri-seed a regular integer, and also set layout-seed in many-seeds
Ralf Jung [Sun, 20 Nov 2022 08:38:02 +0000 (09:38 +0100)]
make miri-seed a regular integer, and also set layout-seed in many-seeds

18 months agomove core::arch into separate file
Ralf Jung [Sun, 20 Nov 2022 09:27:38 +0000 (10:27 +0100)]
move core::arch into separate file

18 months agoImprove documentation of Stack size
Fabian Hintringer [Thu, 17 Nov 2022 15:59:17 +0000 (16:59 +0100)]
Improve documentation of Stack size

18 months agoavoid non-strict-provenance casts in libcore tests
Ralf Jung [Sun, 20 Nov 2022 08:58:29 +0000 (09:58 +0100)]
avoid non-strict-provenance casts in libcore tests

18 months agoAuto merge of #98914 - fee1-dead-contrib:min-deref-patterns, r=compiler-errors
bors [Sun, 20 Nov 2022 07:16:42 +0000 (07:16 +0000)]
Auto merge of #98914 - fee1-dead-contrib:min-deref-patterns, r=compiler-errors

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

18 months agoAuto merge of #2680 - RalfJung:rustup, r=RalfJung
bors [Sun, 20 Nov 2022 07:06:11 +0000 (07:06 +0000)]
Auto merge of #2680 - RalfJung:rustup, r=RalfJung

Rustup

18 months agofix unused warning in a test
Ralf Jung [Sun, 20 Nov 2022 07:04:36 +0000 (08:04 +0100)]
fix unused warning in a test

18 months agoMerge from rustc
Ralf Jung [Sun, 20 Nov 2022 06:48:27 +0000 (07:48 +0100)]
Merge from rustc

18 months agoPreparing for merge from rustc
Ralf Jung [Sun, 20 Nov 2022 06:48:21 +0000 (07:48 +0100)]
Preparing for merge from rustc

18 months agoAuto merge of #104629 - JohnTitor:rollup-vp3m98i, r=JohnTitor
bors [Sun, 20 Nov 2022 04:28:21 +0000 (04:28 +0000)]
Auto merge of #104629 - JohnTitor:rollup-vp3m98i, r=JohnTitor

Rollup of 6 pull requests

Successful merges:

 - #103901 (Add tracking issue for `const_arguments_as_str`)
 - #104112 (rustdoc: Add copy to the description of repeat)
 - #104435 (`VecDeque::resize` should re-use the buffer in the passed-in element)
 - #104467 (Fix substraction with overflow in `wrong_number_of_generic_args.rs`)
 - #104608 (Cleanup macro matching recovery)
 - #104626 (Fix doctest errors related to rustc_middle)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

18 months agoRollup merge of #104626 - reez12g:issue-99144-2, r=jyn514
Yuki Okushi [Sun, 20 Nov 2022 04:16:00 +0000 (13:16 +0900)]
Rollup merge of #104626 - reez12g:issue-99144-2, r=jyn514

Fix doctest errors related to rustc_middle

Helps with https://github.com/rust-lang/rust/issues/99144

18 months agoRollup merge of #104608 - Nilstrieb:fixmed, r=compiler-errors
Yuki Okushi [Sun, 20 Nov 2022 04:15:59 +0000 (13:15 +0900)]
Rollup merge of #104608 - Nilstrieb:fixmed, r=compiler-errors

Cleanup macro matching recovery

The retry has been implemented already in #104335. Also removes a `HACK` comment that's not really needed anymore because the "don't recover during macro matching" isn't really a hack but correct behavior.

18 months agoRollup merge of #104467 - fuzzypixelz:fix/attempt-to-substract-with-overflow, r=compi...
Yuki Okushi [Sun, 20 Nov 2022 04:15:59 +0000 (13:15 +0900)]
Rollup merge of #104467 - 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?).

18 months agoRollup merge of #104435 - scottmcm:iter-repeat-n, r=thomcc
Yuki Okushi [Sun, 20 Nov 2022 04:15:59 +0000 (13:15 +0900)]
Rollup merge of #104435 - scottmcm:iter-repeat-n, r=thomcc

`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

18 months agoRollup merge of #104112 - yancyribbens:add-copy-to-repeat-description, r=JohnTitor
Yuki Okushi [Sun, 20 Nov 2022 04:15:58 +0000 (13:15 +0900)]
Rollup merge of #104112 - yancyribbens:add-copy-to-repeat-description, r=JohnTitor

rustdoc: Add copy to the description of repeat

Small nit, but it's more clear to say `copy` here instead of defining `repeat` in terms of itself.

18 months agoRollup merge of #103901 - H4x5:fmt-arguments-as-str-tracking-issue, r=the8472
Yuki Okushi [Sun, 20 Nov 2022 04:15:58 +0000 (13:15 +0900)]
Rollup merge of #103901 - H4x5:fmt-arguments-as-str-tracking-issue, r=the8472

Add tracking issue for `const_arguments_as_str`

Tracking issue: #103900

The original PR didn't create a tracking issue.

18 months agoRevert "Update CI to use Android NDK r25b"
Alex Pinkus [Sun, 20 Nov 2022 01:50:48 +0000 (17:50 -0800)]
Revert "Update CI to use Android NDK r25b"

This reverts commit bf7f1ca316a249cf99d722d79a0db12fef687142.

18 months agoFix doctest errors related to rustc_middle
reez12g [Sun, 20 Nov 2022 02:10:45 +0000 (11:10 +0900)]
Fix doctest errors related to rustc_middle

18 months agorustdoc: fix test case
Michael Howell [Sun, 20 Nov 2022 01:21:46 +0000 (18:21 -0700)]
rustdoc: fix test case

18 months agoAuto merge of #104522 - RalfJung:try_normalize_after_erasing_regions, r=oli-obk
bors [Sun, 20 Nov 2022 01:16:52 +0000 (01:16 +0000)]
Auto merge of #104522 - RalfJung:try_normalize_after_erasing_regions, r=oli-obk

try_normalize_after_erasing_regions: promote an assertion to always run

In https://github.com/rust-lang/miri/issues/2433 this assertion has been seen to trigger, so it might be worth actually checking this? Regressing debug assertions are very easy to miss until much later, and then they become quite hard to debug.

18 months agorustdoc: add test case for scraped example expand GUI
Michael Howell [Sun, 20 Nov 2022 00:42:07 +0000 (17:42 -0700)]
rustdoc: add test case for scraped example expand GUI

18 months agoAuto merge of #2679 - RalfJung:clock_gettime, r=RalfJung
bors [Sat, 19 Nov 2022 22:48:10 +0000 (22:48 +0000)]
Auto merge of #2679 - RalfJung:clock_gettime, r=RalfJung

implement clock_gettime on macos

and pull in rustc changes so we can test this against https://github.com/rust-lang/rust/pull/103594.

Fixes https://github.com/rust-lang/miri/issues/2664

18 months agoimplement clock_gettime on macos
Ralf Jung [Sat, 19 Nov 2022 19:21:48 +0000 (20:21 +0100)]
implement clock_gettime on macos

18 months agoAuto merge of #104470 - ehuss:cdb-dupe-last-command, r=jyn514
bors [Sat, 19 Nov 2022 22:25:18 +0000 (22:25 +0000)]
Auto merge of #104470 - ehuss:cdb-dupe-last-command, r=jyn514

Don't duplicate last cdb debuginfo test command

cdb scripts interpret a blank line to mean "repeat the last command", similar to what happens when running the debugger from a console. The code for compiletest that constructs the debugger script was inserting a blank line between the last command and the "quit" command. This caused the last command to be executed twice. This can cause some confusion since the `-check` lines are expecting the output in a certain order. But printing the last command twice causes that order-assumption to fail, and that can cause confusion.

This fixes it by removing the blank line.

AFAICT, gdb and lldb scripts don't have the same behavior with blank lines (and the gdb code doesn't add any blank lines anyways).

18 months agorustdoc: fix scrape-examples JS path
Michael Howell [Sat, 19 Nov 2022 19:28:17 +0000 (12:28 -0700)]
rustdoc: fix scrape-examples JS path

18 months agorustdoc: use real buttons for scrape examples controls
Michael Howell [Sat, 19 Nov 2022 19:27:40 +0000 (12:27 -0700)]
rustdoc: use real buttons for scrape examples controls

18 months agoAuto merge of #102795 - lukas-code:constify-is-aligned-via-align-offset, r=oli-obk
bors [Sat, 19 Nov 2022 18:57:39 +0000 (18:57 +0000)]
Auto merge of #102795 - lukas-code:constify-is-aligned-via-align-offset, r=oli-obk

Constify `is_aligned` via `align_offset`

Alternative to https://github.com/rust-lang/rust/pull/102753

Make `align_offset` work in const eval (and not always return `usize::MAX`) and then use that to constify `is_aligned{_to}`.

Tracking Issue: https://github.com/rust-lang/rust/issues/104203

18 months agoAdd a UI test to ensure rustc doesn't do arithmetic overflows
Mahmoud Mazouz [Sat, 19 Nov 2022 17:54:19 +0000 (18:54 +0100)]
Add a UI test to ensure rustc doesn't do arithmetic overflows

This relies on the CI testing a rustc that's compiled with overflow-checks = true

18 months agoFix substraction with overflow in `wrong_number_of_generic_args.rs`
Mahmoud Mazouz [Sat, 19 Nov 2022 17:53:36 +0000 (18:53 +0100)]
Fix substraction with overflow in `wrong_number_of_generic_args.rs`

Rarranging the substration and equality check into an addition and an equality
check is sufficient.

Algebra is cool, isn't it?

Co-authored-by: Michael Goulet <michael@errs.io>
18 months agoCleanup macro matching recovery
Nilstrieb [Sat, 19 Nov 2022 16:46:04 +0000 (17:46 +0100)]
Cleanup macro matching recovery

The retry has been implemented already.

18 months agoupdate provenance test
Lukas Markeffsky [Fri, 18 Nov 2022 12:59:21 +0000 (13:59 +0100)]
update provenance test

* fix allocation alignment for 16bit platforms
* add edge case where `stride % align != 0` on pointers with provenance

18 months agofix assembly test on apple
Lukas Markeffsky [Wed, 16 Nov 2022 20:07:51 +0000 (21:07 +0100)]
fix assembly test on apple

18 months agoUpdate comment on pointer-to-usize transmute
Lukas [Wed, 16 Nov 2022 14:08:35 +0000 (15:08 +0100)]
Update comment on pointer-to-usize transmute

Co-authored-by: Ralf Jung <post@ralfj.de>
18 months agoRevert "don't call `align_offset` during const eval, ever"
Lukas Markeffsky [Wed, 16 Nov 2022 10:41:18 +0000 (11:41 +0100)]
Revert "don't call `align_offset` during const eval, ever"

This reverts commit f3a577bfae376c0222e934911865ed14cddd1539.

18 months agofix const `align_offset` implementation
Lukas Markeffsky [Tue, 15 Nov 2022 14:55:37 +0000 (15:55 +0100)]
fix const `align_offset` implementation

18 months agofix assembly test on windows
Lukas Markeffsky [Fri, 11 Nov 2022 14:52:49 +0000 (15:52 +0100)]
fix assembly test on windows

18 months agoreplace potential ICE with graceful error (`no_core` only)
Lukas Markeffsky [Fri, 11 Nov 2022 09:01:06 +0000 (10:01 +0100)]
replace potential ICE with graceful error (`no_core` only)

18 months agodocs cleanup
Lukas Markeffsky [Wed, 9 Nov 2022 19:18:00 +0000 (20:18 +0100)]
docs cleanup

* Fix doc examples for Platforms with underaligned integer primitives.
* Mutable pointer doc examples use mutable pointers.
* Fill out tracking issue.
* Minor formatting changes.

18 months agoalways use `align_offset` in `is_aligned_to` + add assembly test
Lukas Markeffsky [Sun, 23 Oct 2022 10:30:46 +0000 (12:30 +0200)]
always use `align_offset` in `is_aligned_to` + add assembly test

18 months agoSchrödinger's pointer
Lukas Markeffsky [Sat, 22 Oct 2022 22:47:21 +0000 (00:47 +0200)]
Schrödinger's pointer

It's aligned *and* not aligned!

18 months agoaddress more review comments
Lukas Markeffsky [Sat, 22 Oct 2022 19:20:04 +0000 (21:20 +0200)]
address more review comments

* `cfg` only the body of `align_offset`
* put explicit panics back
* explain why `ptr.align_offset(align) == 0` is slow

18 months agodocument `is_aligned{,_to}`
Lukas Markeffsky [Sat, 22 Oct 2022 17:15:03 +0000 (19:15 +0200)]
document `is_aligned{,_to}`

18 months agodon't call `align_offset` during const eval, ever
Lukas Markeffsky [Sat, 22 Oct 2022 15:31:07 +0000 (17:31 +0200)]
don't call `align_offset` during const eval, ever

18 months agomark `align_offset` as `#[must_use]`
Lukas Markeffsky [Thu, 20 Oct 2022 17:46:31 +0000 (19:46 +0200)]
mark `align_offset` as `#[must_use]`