]> git.lizzy.rs Git - rust.git/log
rust.git
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 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 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 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 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]`

18 months agoadd coretests for `is_aligned`
Lukas Markeffsky [Fri, 7 Oct 2022 19:46:28 +0000 (21:46 +0200)]
add coretests for `is_aligned`

18 months agoconstify `pointer::is_aligned{,_to}`
Lukas Markeffsky [Fri, 7 Oct 2022 20:24:31 +0000 (22:24 +0200)]
constify `pointer::is_aligned{,_to}`

18 months agoadd coretests for const `align_offset`
Lukas Markeffsky [Fri, 7 Oct 2022 18:59:23 +0000 (20:59 +0200)]
add coretests for const `align_offset`

18 months agoAuto merge of #104607 - matthiaskrgr:rollup-9s589me, r=matthiaskrgr
bors [Sat, 19 Nov 2022 15:40:04 +0000 (15:40 +0000)]
Auto merge of #104607 - matthiaskrgr:rollup-9s589me, r=matthiaskrgr

Rollup of 10 pull requests

Successful merges:

 - #103117 (Use `IsTerminal` in place of `atty`)
 - #103969 (Partial support for running UI tests with `download-rustc`)
 - #103989 (Fix build of std for thumbv7a-pc-windows-msvc)
 - #104076 (fix sysroot issue which appears for ci downloaded rustc)
 - #104469 (Make "long type" printing type aware and trim types in E0275)
 - #104497 (detect () to avoid redundant <> suggestion for type)
 - #104577 (Don't focus on notable trait parent when hiding it)
 - #104587 (Update cargo)
 - #104593 (Improve spans for RPITIT object-safety errors)
 - #104604 (Migrate top buttons style to CSS variables)

Failed merges:

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

18 months agomake const `align_offset` useful
Lukas Markeffsky [Fri, 7 Oct 2022 20:23:34 +0000 (22:23 +0200)]
make const `align_offset` useful

18 months agounify inherent impls of `CompileTimeEvalContext`
Lukas Markeffsky [Thu, 20 Oct 2022 18:15:37 +0000 (20:15 +0200)]
unify inherent impls of `CompileTimeEvalContext`

18 months agoconstify `exact_div` intrinsic
Lukas Markeffsky [Fri, 7 Oct 2022 18:57:34 +0000 (20:57 +0200)]
constify `exact_div` intrinsic

18 months agoRollup merge of #104604 - GuillaumeGomez:migrate-top-button-to-css-var, r=notriddle
Matthias Krüger [Sat, 19 Nov 2022 14:35:23 +0000 (15:35 +0100)]
Rollup merge of #104604 - GuillaumeGomez:migrate-top-button-to-css-var, r=notriddle

Migrate top buttons style to CSS variables

No UI changes.

r? `@notriddle`

18 months agoRollup merge of #104593 - compiler-errors:rpitit-object-safety-spans, r=fee1-dead
Matthias Krüger [Sat, 19 Nov 2022 14:35:23 +0000 (15:35 +0100)]
Rollup merge of #104593 - compiler-errors:rpitit-object-safety-spans, r=fee1-dead

Improve spans for RPITIT object-safety errors

No reason why we can't point at the `impl Trait` that causes the object-safety violation.

Also [drive-by: Add is_async fn to hir::IsAsync](https://github.com/rust-lang/rust/pull/104593/commits/c4165f3a965e258531928180195637455299c6f3), which touches clippy too.

18 months agoRollup merge of #104587 - weihanglo:update-cargo, r=weihanglo
Matthias Krüger [Sat, 19 Nov 2022 14:35:22 +0000 (15:35 +0100)]
Rollup merge of #104587 - weihanglo:update-cargo, r=weihanglo

Update cargo

3 commits in 16b097879b6f117c8ae698aab054c87f26ff325e..eb5d35917b2395194593c9ca70c3778f60c1573b
2022-11-14 23:28:16 +0000 to 2022-11-17 22:08:43 +0000
- Fix several tests that are waiting 60 seconds for publishing to time out (rust-lang/cargo#11388)
- Implement RFC 3139: alternative registry authentication support (rust-lang/cargo#10592)
- Fix cargo install --index when used with registry.default (rust-lang/cargo#11302)

r? `@ghost`

18 months agoRollup merge of #104577 - GuillaumeGomez:remove-focus-on-blur, r=notriddle
Matthias Krüger [Sat, 19 Nov 2022 14:35:22 +0000 (15:35 +0100)]
Rollup merge of #104577 - GuillaumeGomez:remove-focus-on-blur, r=notriddle

Don't focus on notable trait parent when hiding it

I clicked on a notable trait icon so the popup remained and then clicked on the settings menu. When the settings menu was blurred, it scrolled back to when the notable trait was, which isn't great.

r? `@notriddle`

18 months agoRollup merge of #104497 - lyming2007:issue-104379-fix, r=fee1-dead
Matthias Krüger [Sat, 19 Nov 2022 14:35:21 +0000 (15:35 +0100)]
Rollup merge of #104497 - lyming2007:issue-104379-fix, r=fee1-dead

detect () to avoid redundant <> suggestion for type

fix #104379

18 months agoRollup merge of #104469 - estebank:long-types, r=oli-obk
Matthias Krüger [Sat, 19 Nov 2022 14:35:21 +0000 (15:35 +0100)]
Rollup merge of #104469 - estebank:long-types, r=oli-obk

Make "long type" printing type aware and trim types in E0275

Instead of simple string cutting, use a custom printer to hide parts of long printed types.

On E0275, check for type length before printing.

18 months agoRollup merge of #104076 - ozkanonur:fix-ci-rustc-sysroot, r=jyn514
Matthias Krüger [Sat, 19 Nov 2022 14:35:20 +0000 (15:35 +0100)]
Rollup merge of #104076 - ozkanonur:fix-ci-rustc-sysroot, r=jyn514

fix sysroot issue which appears for ci downloaded rustc

Currently when compiler is downloaded rather than compiled, sysroot is being `ci-rustc-sysroot` because of https://github.com/rust-lang/rust/blob/7eef946fc0e0eff40e588eab77b09b287accbec3/src/bootstrap/compile.rs#L1125-L1131 this.

And rustdoc is overriding the downloaded one at the end of the process.

With the condition I add, we simply check if the current compiler stage is target build stage, if so use the proper sysroot instead of `ci-rustc-sysroot`.

Resolves #103206

18 months agoRollup merge of #103989 - arlosi:arm32-panic, r=Amanieu
Matthias Krüger [Sat, 19 Nov 2022 14:35:20 +0000 (15:35 +0100)]
Rollup merge of #103989 - arlosi:arm32-panic, r=Amanieu

Fix build of std for thumbv7a-pc-windows-msvc

Attempting to build std for the tier-3 target `thumbv7a-pc-windows-msvc` fails with the following error:
```
Building stage1 std artifacts (x86_64-pc-windows-msvc -> thumbv7a-pc-windows-msvc)
..
LLVM ERROR: WinEH not implemented for this target
error: could not compile `panic_unwind`
```

EH (unwinding) is not supported by LLVM for 32 bit arm msvc targets. This changes panic unwind to use the dummy implementation for `thumbv7a-pc-windows-msvc`.

18 months agoRollup merge of #103969 - ferrocene:pa-download-rustc-ui-tests, r=jyn514
Matthias Krüger [Sat, 19 Nov 2022 14:35:19 +0000 (15:35 +0100)]
Rollup merge of #103969 - ferrocene:pa-download-rustc-ui-tests, r=jyn514

Partial support for running UI tests with `download-rustc`

Right now trying to run UI tests with `download-rustc` results in a bunch of test failures, requiring someone who wants to only work on tests to also build the full compiler. This PR **partially** addresses the problem by solving a lot of the errors (but not all).

* This installs the `rust-src` component on CI toolchains, since the test output depends on whether the standard library source code is installed; We can't just symlink the current source because the `rustc-dev` component already includes the compiler sources, but not the library sources, and mixing things is worse IMO.
* This ensures the `$SRC_DIR` normalization done by compiletest correctly handles the source code added above.
* This unconditionally sets `remap-prefix` to the prefix used in the downloaded toolchain, to ensure compiletest normalizes it.

18 months agoRollup merge of #103117 - joshtriplett:use-is-terminal, r=eholk
Matthias Krüger [Sat, 19 Nov 2022 14:35:18 +0000 (15:35 +0100)]
Rollup merge of #103117 - joshtriplett:use-is-terminal, r=eholk

Use `IsTerminal` in place of `atty`

In any crate that can use nightly features, use `IsTerminal` rather than
`atty`:

- Use `IsTerminal` in `rustc_errors`
- Use `IsTerminal` in `rustc_driver`
- Use `IsTerminal` in `rustc_log`
- Use `IsTerminal` in `librustdoc`

18 months agoAuto merge of #104571 - clubby789:remove-vec-rc-opt, r=the8472
bors [Sat, 19 Nov 2022 12:44:57 +0000 (12:44 +0000)]
Auto merge of #104571 - clubby789:remove-vec-rc-opt, r=the8472

Revert Vec/Rc storage reuse opt

Remove the optimization for using storage added by #104205.
The perf wins were pretty small, and it relies on non-guarenteed behaviour. On platforms that don't implement shrinking in place, the performance will be significantly worse.

While it could be gated to platforms that do this (such as GNU), I don't think it's worth the overhead of maintaining it for very small gains. (#104565, #104563)

cc `@RalfJung` `@matthiaskrgr`

Fixes #104565
Fixes #104563

18 months agoMerge from rustc
Ralf Jung [Sat, 19 Nov 2022 12:40:56 +0000 (13:40 +0100)]
Merge from rustc

18 months agoPreparing for merge from rustc
Ralf Jung [Sat, 19 Nov 2022 12:40:47 +0000 (13:40 +0100)]
Preparing for merge from rustc

18 months agoMigrate top buttons style to CSS variables
Guillaume Gomez [Sat, 19 Nov 2022 10:07:13 +0000 (11:07 +0100)]
Migrate top buttons style to CSS variables

18 months agoUpdate browser-ui-test version to 0.13.2
Guillaume Gomez [Fri, 18 Nov 2022 23:27:37 +0000 (00:27 +0100)]
Update browser-ui-test version to 0.13.2