]> git.lizzy.rs Git - rust.git/log
rust.git
21 months agotrivial fix for comments feedback
yukang [Mon, 17 Oct 2022 00:32:08 +0000 (08:32 +0800)]
trivial fix for comments feedback

21 months agofind the correct lang item for ranges
yukang [Sun, 2 Oct 2022 20:22:59 +0000 (04:22 +0800)]
find the correct lang item for ranges

21 months agofix #102396, suggest parentheses for possible range methods
yukang [Thu, 29 Sep 2022 05:16:47 +0000 (13:16 +0800)]
fix #102396, suggest parentheses for possible range methods

21 months agoAuto merge of #102395 - davidtwco:translation-rename-typeck, r=compiler-errors
bors [Tue, 4 Oct 2022 03:57:50 +0000 (03:57 +0000)]
Auto merge of #102395 - davidtwco:translation-rename-typeck, r=compiler-errors

errors: rename `typeck.ftl` to `hir_analysis.ftl`

In #102306, `rustc_typeck` was renamed to `rustc_hir_analysis` but the diagnostic resources were not renamed - which is what this pull request changes.

21 months agoAuto merge of #99099 - Stargateur:phantomdata_debug, r=joshtriplett
bors [Tue, 4 Oct 2022 00:56:14 +0000 (00:56 +0000)]
Auto merge of #99099 - Stargateur:phantomdata_debug, r=joshtriplett

Add T to PhantomData impl Debug

This add debug information for `PhantomData`, I believe it's make sense to add this to debug impl of `PhantomData` since `T` is what define what is the `PhantomData` just write `"PhantomData"` is not very useful for debugging.

Alternative:

* `PhantomData::<{}>`
* `PhantomData { t: "str_type" }`

`@rustbot` label +T-libs-api -T-libs

21 months agoAuto merge of #102632 - matthiaskrgr:rollup-h8s3zmo, r=matthiaskrgr
bors [Mon, 3 Oct 2022 20:22:18 +0000 (20:22 +0000)]
Auto merge of #102632 - matthiaskrgr:rollup-h8s3zmo, r=matthiaskrgr

Rollup of 7 pull requests

Successful merges:

 - #98218 (Document the conditional existence of `alloc::sync` and `alloc::task`.)
 - #99216 (docs: be less harsh in wording for Vec::from_raw_parts)
 - #99460 (docs: Improve AsRef / AsMut docs on blanket impls)
 - #100470 (Tweak `FpCategory` example order.)
 - #101040 (Fix `#[derive(Default)]` on a generic `#[default]` enum adding unnecessary `Default` bounds)
 - #101308 (introduce `{char, u8}::is_ascii_octdigit`)
 - #102486 (Add diagnostic struct for const eval error in `rustc_middle`)

Failed merges:

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

21 months agoRollup merge of #102486 - pierwill:middle-const-eval-err, r=compiler-errors
Matthias Krüger [Mon, 3 Oct 2022 18:58:56 +0000 (20:58 +0200)]
Rollup merge of #102486 - pierwill:middle-const-eval-err, r=compiler-errors

Add diagnostic struct for const eval error in `rustc_middle`

Part of #100717.

r? `@ghost`

21 months agoRollup merge of #101308 - nerdypepper:feature/is-ascii-octdigit, r=joshtriplett
Matthias Krüger [Mon, 3 Oct 2022 18:58:56 +0000 (20:58 +0200)]
Rollup merge of #101308 - nerdypepper:feature/is-ascii-octdigit, r=joshtriplett

introduce `{char, u8}::is_ascii_octdigit`

This feature adds two new APIs: `char::is_ascii_octdigit` and `u8::is_ascii_octdigit`, under the feature gate `is_ascii_octdigit`. These methods are shorthands for `char::is_digit(self, 8)` and `u8::is_digit(self, 8)`:

```rust
// core::char

impl char {
    pub fn is_ascii_octdigit(self) -> bool;
}

// core::num

impl u8 {
    pub fn is_ascii_octdigit(self) -> bool;
}
```

---

Couple of things I need help understanding:

- `const`ness: have I used the right attribute in this case?
- is there a way to run the tests for `core::char` alone, instead of `./x.py test library/core`?

21 months agoRollup merge of #101040 - danielhenrymantilla:no-bounds-for-default-annotated-derive...
Matthias Krüger [Mon, 3 Oct 2022 18:58:55 +0000 (20:58 +0200)]
Rollup merge of #101040 - danielhenrymantilla:no-bounds-for-default-annotated-derive, r=joshtriplett

Fix `#[derive(Default)]` on a generic `#[default]` enum adding unnecessary `Default` bounds

That is, given something like:

```rs
// #[default] on a generic enum does not add `Default` bounds to the type params.
#[derive(Default)]
enum MyOption<T> {
    #[default]
    None,
    Some(T),
}
```

then `MyOption<T> : Default`_as currently implemented_ only holds when `T : Default`, as reported by ```@5225225``` [over Zulip](https://rust-lang.zulipchat.com/#narrow/stream/122651-general/topic/.23.5Bderive.28Default.29.5D.20for.20enums.20with.20fields).

This is contrary to [what the accepted RFC proposes](https://rust-lang.github.io/rfcs/3107-derive-default-enum.html#generated-bounds) (_i.e._, that `T` be allowed not to be itself `Default`), and indeed seems to be a rather unnecessary limitation.

21 months agoRollup merge of #100470 - reitermarkus:patch-1, r=joshtriplett
Matthias Krüger [Mon, 3 Oct 2022 18:58:55 +0000 (20:58 +0200)]
Rollup merge of #100470 - reitermarkus:patch-1, r=joshtriplett

Tweak `FpCategory` example order.

Follow same order for variable declarations and assertions.

21 months agoRollup merge of #99460 - JanBeh:PR_asref_asmut_docs, r=joshtriplett
Matthias Krüger [Mon, 3 Oct 2022 18:58:54 +0000 (20:58 +0200)]
Rollup merge of #99460 - JanBeh:PR_asref_asmut_docs, r=joshtriplett

docs: Improve AsRef / AsMut docs on blanket impls

There are several issues with the current state of `AsRef` and `AsMut` as [discussed here on IRLO](https://internals.rust-lang.org/t/semantics-of-asref/17016). See also #39397, #45742, #73390, #98905, and the FIXMEs [here](https://github.com/rust-lang/rust/blob/1.62.0/library/core/src/convert/mod.rs#L509-L515) and [here](https://github.com/rust-lang/rust/blob/1.62.0/library/core/src/convert/mod.rs#L530-L536). These issues are difficult to fix. This PR aims to update the documentation to better reflect the status-quo and to give advice on how `AsRef` and `AsMut` should be used.

In particular:

- Explicitly mention that `AsRef` and `AsMut` do not auto-dereference generally for all dereferencable types (but only if inner type is a shared and/or mutable reference)
- Give advice to not use `AsRef` or `AsMut` for the sole purpose of dereferencing
- Suggest providing a transitive `AsRef` or `AsMut` implementation for types which implement `Deref`
- Add new section "Reflexivity" in documentation comments for `AsRef` and `AsMut`
- Provide better example for `AsMut`
- Added heading "Relation to `Borrow`" in `AsRef`'s docs to improve structure

21 months agoRollup merge of #99216 - duarten:master, r=joshtriplett
Matthias Krüger [Mon, 3 Oct 2022 18:58:53 +0000 (20:58 +0200)]
Rollup merge of #99216 - duarten:master, r=joshtriplett

docs: be less harsh in wording for Vec::from_raw_parts

In particular, be clear that it is sound to specify memory not
originating from a previous `Vec` allocation. That is already suggested
in other parts of the documentation about zero-alloc conversions to Box<[T]>.

Incorporate a constraint from `slice::from_raw_parts` that was missing
but needs to be fulfilled, since a `Vec` can be converted into a slice.

Fixes https://github.com/rust-lang/rust/issues/98780.

21 months agoRollup merge of #98218 - kpreid:nostdarc, r=joshtriplett
Matthias Krüger [Mon, 3 Oct 2022 18:58:53 +0000 (20:58 +0200)]
Rollup merge of #98218 - kpreid:nostdarc, r=joshtriplett

Document the conditional existence of `alloc::sync` and `alloc::task`.

`alloc` declares

```rust
#[cfg(target_has_atomic = "ptr")]
pub mod sync;
```

but there is no public documentation of this condition. This PR fixes that, so that users of `alloc` can understand how to make their code compile everywhere `alloc` does, if they are writing a library with impls for `Arc`.

The wording is copied from `std::sync::atomic::AtomicPtr`, with additional advice on how to `#[cfg]` for it.

I feel quite uncertain about whether the paragraph I added to `Arc`'s documentation should actually be there, as it is a distraction for anyone using `std`. On the other hand, maybe more reminders that no_std exists would benefit the ecosystem.

Note: `target_has_atomic` is [stabilized](https://github.com/rust-lang/rust/issues/32976) but [not yet documented in the reference](https://github.com/rust-lang/reference/pull/1171).

21 months agoAuto merge of #102627 - matthiaskrgr:rollup-2xtrqkw, r=matthiaskrgr
bors [Mon, 3 Oct 2022 17:31:45 +0000 (17:31 +0000)]
Auto merge of #102627 - matthiaskrgr:rollup-2xtrqkw, r=matthiaskrgr

Rollup of 8 pull requests

Successful merges:

 - #102439 (rustdoc: re-sugar more cross-crate trait bounds)
 - #102569 (Improve `FromStr` example)
 - #102597 (Avoid ICE in printing RPITIT type)
 - #102607 (Improve documentation of `slice::{from_ptr_range, from_ptr_range_mut}`)
 - #102613 (Fix ICE #101739)
 - #102615 (Cleanup some error code explanations)
 - #102617 (`HirId` for `deferred_transmute_checks`)
 - #102620 (Migrate `.stab` elements style to CSS variables)

Failed merges:

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

21 months agoAdd diagnostic struct for const eval error in `rustc_middle`
pierwill [Sun, 2 Oct 2022 21:02:57 +0000 (16:02 -0500)]
Add diagnostic struct for const eval error in `rustc_middle`

Co-authored-by: Michael Goulet <michael@errs.io>
21 months agoRollup merge of #102620 - GuillaumeGomez:css-stab-migration, r=notriddle
Matthias Krüger [Mon, 3 Oct 2022 17:12:20 +0000 (19:12 +0200)]
Rollup merge of #102620 - GuillaumeGomez:css-stab-migration, r=notriddle

Migrate `.stab` elements style to CSS variables

Part of https://github.com/rust-lang/rust/pull/98460.

There should be no UI changes.

r? `@notriddle`

21 months agoRollup merge of #102617 - lcnr:deferred_transmute_checks, r=compiler-errors
Matthias Krüger [Mon, 3 Oct 2022 17:12:19 +0000 (19:12 +0200)]
Rollup merge of #102617 - lcnr:deferred_transmute_checks, r=compiler-errors

`HirId` for `deferred_transmute_checks`

directly interacting with spans is annoying :sparkles:

21 months agoRollup merge of #102615 - Nilstrieb:there-are-many-error-codes, r=compiler-errors
Matthias Krüger [Mon, 3 Oct 2022 17:12:19 +0000 (19:12 +0200)]
Rollup merge of #102615 - Nilstrieb:there-are-many-error-codes, r=compiler-errors

Cleanup some error code explanations

E0045: Use a stable non-C ABI instead
E0092: Use an atomic intrinsic that actually exists
E0161: Don't use box_syntax
E0579: Format ranges in the rustfmt style
E0622: Use the rustfmt style
E0743: Remove feature gate as it's not needed

21 months agoRollup merge of #102613 - TaKO8Ki:fix-part-of-101739, r=compiler-errors
Matthias Krüger [Mon, 3 Oct 2022 17:12:19 +0000 (19:12 +0200)]
Rollup merge of #102613 - TaKO8Ki:fix-part-of-101739, r=compiler-errors

Fix ICE #101739

Fixes a part of #101739

This cannot cover the following case. It causes `too many args provided` error and obligation does not have references error. I want your advice to solve the following cases as well in this pull request or a follow-up.

```rust
#![crate_type = "lib"]
#![feature(transmutability)]
#![allow(dead_code, incomplete_features, non_camel_case_types)]

mod assert {
    use std::mem::BikeshedIntrinsicFrom;

    pub fn is_transmutable<
        Src,
        Dst,
        Context,
        const ASSUME_ALIGNMENT: bool,
        const ASSUME_LIFETIMES: bool,
        const ASSUME_VALIDITY: bool,
        const ASSUME_VISIBILITY: bool,
    >()
    where
        Dst: BikeshedIntrinsicFrom<
            Src,
            Context,
            ASSUME_ALIGNMENT,
            ASSUME_LIFETIMES,
            ASSUME_VALIDITY,
            ASSUME_VISIBILITY,
        >,
    {}
}

fn via_const() {
    struct Context;
    #[repr(C)] struct Src;
    #[repr(C)] struct Dst;

    const FALSE: bool = false;

    assert::is_transmutable::<Src, Dst, Context, FALSE, FALSE, FALSE, FALSE>();
}
```

21 months agoRollup merge of #102607 - WaffleLapkin:docky_docky_slice_from_ptr_range, r=joshtriplett
Matthias Krüger [Mon, 3 Oct 2022 17:12:18 +0000 (19:12 +0200)]
Rollup merge of #102607 - WaffleLapkin:docky_docky_slice_from_ptr_range, r=joshtriplett

Improve documentation of `slice::{from_ptr_range, from_ptr_range_mut}`

Document panic conditions (`T` is a ZST) and sync docs of shared/unique version.

cc `@wx-csy`

21 months agoRollup merge of #102597 - compiler-errors:issue-102571, r=davidtwco
Matthias Krüger [Mon, 3 Oct 2022 17:12:18 +0000 (19:12 +0200)]
Rollup merge of #102597 - compiler-errors:issue-102571, r=davidtwco

Avoid ICE in printing RPITIT type

Fixes #102571

21 months agoRollup merge of #102569 - eduardosm:from_str-example, r=joshtriplett
Matthias Krüger [Mon, 3 Oct 2022 17:12:17 +0000 (19:12 +0200)]
Rollup merge of #102569 - eduardosm:from_str-example, r=joshtriplett

Improve `FromStr` example

The `from_str` implementation from the example had an `unwrap` that would make it panic on invalid input strings. Instead of panicking, it nows returns an error to better reflect the intented behavior of the `FromStr` trait.

21 months agoRollup merge of #102439 - fmease:rustdoc-simplify-cross-crate-trait-bounds, r=Guillau...
Matthias Krüger [Mon, 3 Oct 2022 17:12:17 +0000 (19:12 +0200)]
Rollup merge of #102439 - fmease:rustdoc-simplify-cross-crate-trait-bounds, r=GuillaumeGomez

rustdoc: re-sugar more cross-crate trait bounds

Previously, we would only ever re-sugar cross-crate predicates like `Type: Trait, <Type as Trait>::Name == Rhs` to `Type: Trait<Name = Rhs>` if the `Type` was a generic parameter like `Self` or `T`. With this PR, `Type` can be any type.

Most notably, this means that we now re-sugar predicates involving associated types (where `Type` is of the form `Self::Name`) which are then picked up by the pre-existing logic that re-sugars them into bounds. As a result of that, the associated type `IntoIter` of `std`'s `IntoIterator` trait (re-exported from `core`) is no longer rendered as:

```rust
type IntoIter: Iterator
where
    <Self::IntoIter as Iterator>::Item == Self::Item;
```

but as one would expect: `type IntoIter: Iterator<Item = Self::Item>;`.

Cross-crate closure bounds like `F: Fn(i32) -> bool` are now also rendered properly (previously, the return type (`Self::Output`) would not be rendered and we would show the underlying equality predicate).

Fixes #77763.
Fixes #84579.
Fixes #102142.

`@rustbot` label T-rustdoc A-cross-crate-reexports
r? rustdoc

21 months agoAuto merge of #102610 - dawnofmidnight:git-commit-hash, r=Mark-Simulacrum
bors [Mon, 3 Oct 2022 14:20:32 +0000 (14:20 +0000)]
Auto merge of #102610 - dawnofmidnight:git-commit-hash, r=Mark-Simulacrum

re-add git-commit-hash file to tarballs

rust-lang/rust#100557 removed the `git-commit-hash` file and replaced it with `git-commit-info`. However, build-manifest relies on the `git-commit-hash` file being present, so this adds it back.

r? `@Mark-Simulacrum`

21 months agoMigrate stab elements style to CSS variables
Guillaume Gomez [Mon, 3 Oct 2022 13:31:59 +0000 (15:31 +0200)]
Migrate stab elements style to CSS variables

21 months agoerrors: rename `typeck.ftl` to `hir_analysis.ftl`
David Wood [Wed, 28 Sep 2022 09:21:33 +0000 (10:21 +0100)]
errors: rename `typeck.ftl` to `hir_analysis.ftl`

In #102306, `rustc_typeck` was renamed to `rustc_hir_analysis` but the
diagnostic resources were not renamed - which is what this commit
changes.

Signed-off-by: David Wood <david.wood@huawei.com>
21 months ago`HirId` for `deferred_transmute_checks`
lcnr [Mon, 3 Oct 2022 11:49:31 +0000 (13:49 +0200)]
`HirId` for `deferred_transmute_checks`

21 months agoAuto merge of #102551 - bjorn3:cg_ssa_cleanup, r=davidtwco
bors [Mon, 3 Oct 2022 11:02:58 +0000 (11:02 +0000)]
Auto merge of #102551 - bjorn3:cg_ssa_cleanup, r=davidtwco

Some more cleanup for rustc_codegen_ssa

With the aim to make non-LLVM like backends, like Cranelift, easier to support using cg_ssa.

21 months agocheck if const is ADT or not
Takayuki Maeda [Mon, 3 Oct 2022 08:51:18 +0000 (17:51 +0900)]
check if const is ADT or not

21 months agoAuto merge of #102614 - matthiaskrgr:rollup-fjyu7oo, r=matthiaskrgr
bors [Mon, 3 Oct 2022 07:30:34 +0000 (07:30 +0000)]
Auto merge of #102614 - matthiaskrgr:rollup-fjyu7oo, r=matthiaskrgr

Rollup of 3 pull requests

Successful merges:

 - #102550 (rustdoc: remove no-op CSS on `.impl, .method` etc)
 - #102591 (Fix duplicate usage of `a` article.)
 - #102592 (Remove a couple lifetimes that can be infered)

Failed merges:

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

21 months agoCleanup some error code explanations
nils [Mon, 3 Oct 2022 06:06:07 +0000 (08:06 +0200)]
Cleanup some error code explanations

E0045: Use a stable non-C ABI instead
E0092: Use an atomic intrinsic that actually exists
E0161: Don't use box_syntax
E0579: Format ranges in the rustfmt style
E0622: Use the rustfmt style
E0743: Remove feature gate as it's not needed

21 months agoadd a ui test for #101739
Takayuki Maeda [Mon, 3 Oct 2022 06:02:38 +0000 (15:02 +0900)]
add a ui test for #101739

21 months agoRollup merge of #102592 - WaffleLapkin:less_lifetimes, r=cjgillot
Matthias Krüger [Mon, 3 Oct 2022 06:00:48 +0000 (08:00 +0200)]
Rollup merge of #102592 - WaffleLapkin:less_lifetimes, r=cjgillot

Remove a couple lifetimes that can be infered

From the review: https://github.com/rust-lang/rust/pull/101986#discussion_r974497497

r? `@cjgillot`

21 months agoRollup merge of #102591 - JarvisCraft:fix-double-a-article, r=compiler-errors
Matthias Krüger [Mon, 3 Oct 2022 06:00:47 +0000 (08:00 +0200)]
Rollup merge of #102591 - JarvisCraft:fix-double-a-article, r=compiler-errors

Fix duplicate usage of `a` article.

This fixes a typo first appearing in #94624 in which test-macro diagnostic uses "a" article twice.

Since I searched the sources for " a a " sequences, I also fixed the same issue in a few files where I found it.

21 months agoRollup merge of #102550 - notriddle:notriddle/impl, r=GuillaumeGomez
Matthias Krüger [Mon, 3 Oct 2022 06:00:47 +0000 (08:00 +0200)]
Rollup merge of #102550 - notriddle:notriddle/impl, r=GuillaumeGomez

rustdoc: remove no-op CSS on `.impl, .method` etc

Preview: http://notriddle.com/notriddle-rustdoc-demos/impl/index.html

# `flex-basis: 100%`

When `.impl-items { flex-basis: 100% }` and `h3.impl, h3.method, h4.method, h3.type, h4.type, h4.associatedconstant` were added in https://github.com/rust-lang/rust/commit/34bd2b845b3acd84c5a9bddae3ff8081c19ec5e9, it seems like it was a mistake even then. According to MDN, [flex-basis] does nothing unless the box it's applied to is a flex *item*, a child of a flex container. However, when this was added, these elements were flex containers themselves.

[flex-basis]: https://developer.mozilla.org/en-US/docs/Web/CSS/flex-basis

# `position: relative`

This property was added to help with positioning the `[+]/[-]` toggle. It is no longer necessary, because `details.rustdoc-toggle` already has `position:relative` set on it.

21 months agoreturn when obligation has references_error
Takayuki Maeda [Mon, 3 Oct 2022 05:17:42 +0000 (14:17 +0900)]
return when obligation has references_error

21 months agoAuto merge of #102508 - nnethercote:even-more-lexer-improvements, r=matklad
bors [Mon, 3 Oct 2022 04:49:46 +0000 (04:49 +0000)]
Auto merge of #102508 - nnethercote:even-more-lexer-improvements, r=matklad

Even more lexer improvements

These are just about code clarity, rather than performance.

r? `@matklad`

21 months agore-add git-commit-hash file to tarballs
dawnofmidnight [Mon, 3 Oct 2022 03:21:26 +0000 (23:21 -0400)]
re-add git-commit-hash file to tarballs

rust-lang/rust#100557 removed the `git-commit-hash` file and replaced it
with `git-commit-info`. However, build-manifest relies on the
`git-commit-hash` file being present, so this adds it back.

21 months agorustdoc: re-sugar more cross-crate trait bounds
León Orell Valerian Liehr [Wed, 28 Sep 2022 20:54:39 +0000 (22:54 +0200)]
rustdoc: re-sugar more cross-crate trait bounds

21 months agoAuto merge of #102503 - cuviper:x86-stack-probes, r=nagisa
bors [Mon, 3 Oct 2022 02:09:05 +0000 (02:09 +0000)]
Auto merge of #102503 - cuviper:x86-stack-probes, r=nagisa

Enable inline stack probes on X86 with LLVM 16

The known problems with x86 inline-asm stack probes have been solved on LLVM main (16), so this flips the switch. Anyone using bleeding-edge LLVM with rustc can start testing this, as I have done locally. We'll get more direct rust-ci when LLVM 16 branches and we start our upgrade, and we can always patch or disable it then if we find new problems.

The previous attempt was #77885, reverted in #84708.

21 months agoSync docs of `slice::{from_ptr_range, from_ptr_range_mut}`
Maybe Waffle [Mon, 3 Oct 2022 00:44:50 +0000 (00:44 +0000)]
Sync docs of `slice::{from_ptr_range, from_ptr_range_mut}`

21 months agoInvert `is_top_level` to avoid negation.
Nicholas Nethercote [Fri, 30 Sep 2022 21:57:22 +0000 (07:57 +1000)]
Invert `is_top_level` to avoid negation.

21 months agoRemove `TokenStreamBuilder`.
Nicholas Nethercote [Fri, 30 Sep 2022 06:51:35 +0000 (16:51 +1000)]
Remove `TokenStreamBuilder`.

It's now only used in one function. Also, the "should we glue the
tokens?" check is only necessary when pushing a `TokenTree::Token`, not
when pushing a `TokenTree::Delimited`.

As part of this, we now do the "should we glue the tokens?" check
immediately, which avoids having look back at the previous token. It
also puts all the logic dealing with token gluing in a single place.

21 months agoInline and remove `parse_token_tree_non_delim_non_eof`.
Nicholas Nethercote [Fri, 30 Sep 2022 06:50:02 +0000 (16:50 +1000)]
Inline and remove `parse_token_tree_non_delim_non_eof`.

It has a single call site.

21 months agoMerge `parse_token_trees_until_close_delim` and `parse_all_token_trees`.
Nicholas Nethercote [Fri, 30 Sep 2022 06:43:11 +0000 (16:43 +1000)]
Merge `parse_token_trees_until_close_delim` and `parse_all_token_trees`.

Because they're very similar, and this will allow some follow-up
changes.

21 months agoAdd comments to `TokenCursor::desugar`.
Nicholas Nethercote [Thu, 29 Sep 2022 21:39:54 +0000 (07:39 +1000)]
Add comments to `TokenCursor::desugar`.

It took me some time to work out what this code was doing.

21 months agoRewrite `Token::is_op`.
Nicholas Nethercote [Wed, 28 Sep 2022 01:29:47 +0000 (11:29 +1000)]
Rewrite `Token::is_op`.

An exhaustive match is more readable and more future-proof.

21 months agoAdd comments to `Spacing`.
Nicholas Nethercote [Wed, 28 Sep 2022 01:20:42 +0000 (11:20 +1000)]
Add comments to `Spacing`.

21 months agoDocument when `slice::from_ptr_range[_mut]` panic
Maybe Waffle [Mon, 3 Oct 2022 00:41:54 +0000 (00:41 +0000)]
Document when `slice::from_ptr_range[_mut]` panic

21 months agoClarify operator splitting.
Nicholas Nethercote [Wed, 28 Sep 2022 00:07:01 +0000 (10:07 +1000)]
Clarify operator splitting.

I found this code hard to read.

21 months agoAuto merge of #102305 - flba-eb:remove_exclude_list, r=Mark-Simulacrum
bors [Sun, 2 Oct 2022 23:47:48 +0000 (23:47 +0000)]
Auto merge of #102305 - flba-eb:remove_exclude_list, r=Mark-Simulacrum

Get rid of exclude-list for Windows-only tests

Main purpose of this change is to get rid of a quite long (and growing) list of excluded targets, while this test should only be useful on Windows (as far as I understand it). The `// only-windows` header seams to implement exactly what we need here.

I don't know why there are some whitespace changes, but `x.py fmt` and `.git/hooks/pre-push` are happy.

21 months agoAuto merge of #100557 - dawnofmidnight:tarball-commit-info, r=Mark-Simulacrum
bors [Sun, 2 Oct 2022 20:55:17 +0000 (20:55 +0000)]
Auto merge of #100557 - dawnofmidnight:tarball-commit-info, r=Mark-Simulacrum

fix: use git-commit-info for version information

Fixes #33286.
Fixes #86587.

This PR changes the current `git-commit-hash` file that `./x.py` dist puts in the `rustc-{version}-src.tar.{x,g}z` to contain the hash, the short hash, and the commit date from which the tarball was created, assuming git was available when it was. It uses this for reading the version so that rustc has all the appropriate metadata.

# Testing

Testing this is kind of a pain. I did it with something like
```sh
./x.py dist # ensure that `ignore-git` is `false` in config.toml
cp ./build/dist/rustc-1.65.0-dev-src.tar.gz ../rustc-1.65.0-dev-src.tar.gz
cd .. && tar -xzf rustc-1.65.0-dev-src && cd rustc-1.65.0-dev-src
./x.py build
```

Then, the output of  `rustc -vV` with the stage1 compiler should have the `commit-hash` and `commit-date` fields filled, rather than be `unknown`. To be completely sure, you can use `rustc --sysroot` with the stdlib that the original `./x.py dist` made, which will require that the metadata matches.

21 months agoAvoid ICE in printing RPITIT type
Michael Goulet [Sun, 2 Oct 2022 20:25:48 +0000 (20:25 +0000)]
Avoid ICE in printing RPITIT type

21 months agoFix duplicate usage of `a` article.
Petr Portnov [Sun, 2 Oct 2022 18:40:39 +0000 (21:40 +0300)]
Fix duplicate usage of `a` article.

This fixes a typo first appearing in #94624
in which test-macro diagnostic uses "a" article twice.

Since I searched sources for " a a " sequences,
I also fixed the same issue in a few source files where I found it.

Signed-off-by: Petr Portnov <gh@progrm-jarvis.ru>
21 months agoAuto merge of #102530 - cuviper:upgrade-i586-gnu, r=pietroalbini
bors [Sun, 2 Oct 2022 18:14:32 +0000 (18:14 +0000)]
Auto merge of #102530 - cuviper:upgrade-i586-gnu, r=pietroalbini

Upgrade dist-i586-gnu-i586-i686-musl to ubuntu:22.04

The system GCC 5 in ubuntu:16.04 will be too old to compile LLVM 16, so
we need an upgrade. To avoid raising the minimum glibc requirements for
`i586-unknown-linux-gnu`, this target is converted to a crosstool-ng
toolchain, *relaxing* it to the same Linux 3.2 / glibc 2.17 minimum we
use elsewhere. The musl targets still use Ubuntu's system toolchain, but
this doesn't have the same compatibility concerns.

21 months agoRemove a couple lifetimes that could be infered
Maybe Waffle [Sun, 2 Oct 2022 15:40:20 +0000 (15:40 +0000)]
Remove a couple lifetimes that could be infered

21 months agoAuto merge of #102586 - Dylan-DPC:rollup-g107h6z, r=Dylan-DPC
bors [Sun, 2 Oct 2022 15:31:06 +0000 (15:31 +0000)]
Auto merge of #102586 - Dylan-DPC:rollup-g107h6z, r=Dylan-DPC

Rollup of 5 pull requests

Successful merges:

 - #100451 (Do not panic when a test function returns Result::Err.)
 - #102098 (Use fetch_update in sync::Weak::upgrade)
 - #102538 (Give `def_span` the same SyntaxContext as `span_with_body`.)
 - #102556 (Make `feature(const_btree_len)` implied by `feature(const_btree_new)`)
 - #102566 (Add a known-bug test for #102498)

Failed merges:

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

21 months agoRollup merge of #102566 - compiler-errors:test-102498, r=Mark-Simulacrum
Dylan DPC [Sun, 2 Oct 2022 15:12:22 +0000 (20:42 +0530)]
Rollup merge of #102566 - compiler-errors:test-102498, r=Mark-Simulacrum

Add a known-bug test for #102498

Self-explanatory

21 months agoRollup merge of #102556 - WaffleLapkin:implied_by_btree_new, r=Mark-Simulacrum
Dylan DPC [Sun, 2 Oct 2022 15:12:22 +0000 (20:42 +0530)]
Rollup merge of #102556 - WaffleLapkin:implied_by_btree_new, r=Mark-Simulacrum

Make `feature(const_btree_len)` implied by `feature(const_btree_new)`

...this should fix code that used the old feature that was changed in #102197

cc ```@davidtwco``` it seems like tidy doesn't check `implied_by`, should it?

21 months agoRollup merge of #102538 - cjgillot:def-span-ctxt, r=fee1-dead
Dylan DPC [Sun, 2 Oct 2022 15:12:21 +0000 (20:42 +0530)]
Rollup merge of #102538 - cjgillot:def-span-ctxt, r=fee1-dead

Give `def_span` the same SyntaxContext as `span_with_body`.

https://github.com/rust-lang/rust/issues/102217

I'm not sure how to add a test, since the erroneous span was crafted using a proc macro.
The debug assertion in `def_span` will ensure we have the correct behaviour.

21 months agoRollup merge of #102098 - xfix:weak-upgrade-fetch-update, r=Mark-Simulacrum
Dylan DPC [Sun, 2 Oct 2022 15:12:21 +0000 (20:42 +0530)]
Rollup merge of #102098 - xfix:weak-upgrade-fetch-update, r=Mark-Simulacrum

Use fetch_update in sync::Weak::upgrade

Using `fetch_update` makes it more clear that it's CAS loop then manually implementing one.

21 months agoRollup merge of #100451 - hovinen:no-panic-on-result-err-in-test, r=Mark-Simulacrum
Dylan DPC [Sun, 2 Oct 2022 15:12:20 +0000 (20:42 +0530)]
Rollup merge of #100451 - hovinen:no-panic-on-result-err-in-test, r=Mark-Simulacrum

Do not panic when a test function returns Result::Err.

Rust's test library allows test functions to return a `Result`, so that the test is deemed to have failed if the function returns a `Result::Err` variant. Currently, this works by having `Result` implement the `Termination` trait and asserting in assert_test_result that `Termination::report()` indicates successful completion. This turns a `Result::Err` into a panic, which is caught and unwound in the test library.

This approach is problematic in certain environments where one wishes to save on both binary size and compute resources when running tests by:

 * Compiling all code with `--panic=abort` to avoid having to generate unwinding tables, and
 * Running most tests in-process to avoid the overhead of spawning new processes.

This change removes the intermediate panic step and passes a `Result::Err` directly through to the test runner.

To do this, it modifies `assert_test_result` to return a `Result<(), String>` where the `Err` variant holds what was previously the panic message. It changes the types in the `TestFn` enum to return `Result<(), String>`.

This tries to minimise the changes to benchmark tests, so it calls `unwrap()` on the `Result` returned by `assert_test_result`, effectively keeping the same behaviour as before.

Some questions for reviewers:

 * Does the change to the return types in the enum `TestFn` constitute a breaking change for the library API? Namely, the enum definition is public but the test library indicates that "Currently, not much of this is meant for users" and most of the library API appears to be marked unstable.
 * Is there a way to test this change, i.e., to test that no panic occurs if a test returns `Result::Err`?
 * Is there a shorter, more idiomatic way to fold `Result<Result<T,E>,E>` into a `Result<T,E>` than the `fold_err` function I added?

21 months agoRemove type argument of array_alloca and rename to byte_array_alloca
bjorn3 [Sat, 1 Oct 2022 18:22:46 +0000 (18:22 +0000)]
Remove type argument of array_alloca and rename to byte_array_alloca

21 months agoRemove dynamic_alloca from BuilderMethods
bjorn3 [Sat, 1 Oct 2022 17:34:21 +0000 (17:34 +0000)]
Remove dynamic_alloca from BuilderMethods

21 months agoAuto merge of #98354 - camsteffen:is-some-and-by-value, r=m-ou-se
bors [Sun, 2 Oct 2022 12:48:15 +0000 (12:48 +0000)]
Auto merge of #98354 - camsteffen:is-some-and-by-value, r=m-ou-se

Change `is_some_and` to take by value

Consistent with other function-accepting `Option` methods.

Tracking issue: #93050

r? `@m-ou-se`

21 months agoAuto merge of #102548 - nikic:inline-cell-replace, r=scottmcm
bors [Sun, 2 Oct 2022 09:53:07 +0000 (09:53 +0000)]
Auto merge of #102548 - nikic:inline-cell-replace, r=scottmcm

Mark Cell::replace() as #[inline]

Giving this a try based on https://github.com/rust-lang/rust/issues/102539#issuecomment-1264398807.

21 months agoImprove `FromStr` example
Eduardo Sánchez Muñoz [Sun, 2 Oct 2022 09:32:56 +0000 (11:32 +0200)]
Improve `FromStr` example

The `from_str` implementation from the example had an `unwrap` that would make it panic on invalid input strings. Instead of panicking, it nows returns an error to better reflect the intented behavior of the `FromStr` trait.

21 months agoAuto merge of #102535 - scottmcm:optimize-split-at-partition-point, r=thomcc
bors [Sun, 2 Oct 2022 07:11:15 +0000 (07:11 +0000)]
Auto merge of #102535 - scottmcm:optimize-split-at-partition-point, r=thomcc

Tell LLVM that `partition_point` returns a valid fencepost

This was already done for a successful `binary_search`, but this way `partition_point` can get similar optimizations.

Demonstration that nightly can't do this optimization today, and leaves in the panicking path: <https://play.rust-lang.org/?version=nightly&mode=release&edition=2021&gist=e1074cd2faf5f68e49cffd728ded243a>

r? `@thomcc`

21 months agoAdd a known-bug test for #102498
Michael Goulet [Sun, 2 Oct 2022 06:05:45 +0000 (06:05 +0000)]
Add a known-bug test for #102498

21 months agoAuto merge of #102424 - sunfishcode:sunfishcode/hidden-main, r=nagisa
bors [Sun, 2 Oct 2022 04:12:09 +0000 (04:12 +0000)]
Auto merge of #102424 - sunfishcode:sunfishcode/hidden-main, r=nagisa

Declare `main` as visibility hidden on targets that default to hidden.

On targets with `default_hidden_visibility` set, which is currrently just WebAssembly, declare the generated `main` function with visibility hidden. This makes it consistent with clang's WebAssembly target, where `main` is just a user function that gets the same visibility as any other user function, which is hidden on WebAssembly unless explicitly overridden.

This will help simplify use cases which in the future may want to automatically wasm-export all visibility-"default" symbols. `main` isn't intended to be wasm-exported, and marking it hidden prevents it from being wasm-exported in that scenario.

21 months agoAuto merge of #102558 - matthiaskrgr:rollup-0odec1c, r=matthiaskrgr
bors [Sun, 2 Oct 2022 01:29:36 +0000 (01:29 +0000)]
Auto merge of #102558 - matthiaskrgr:rollup-0odec1c, r=matthiaskrgr

Rollup of 6 pull requests

Successful merges:

 - #102195 (Improve the COPYRIGHT file)
 - #102313 (Update docs so that deprecated method points to relevant method)
 - #102353 (Allow passing rustix_use_libc cfg using RUSTFLAGS)
 - #102405 (Remove a FIXME whose code got moved away in #62883.)
 - #102525 (rustdoc: remove orphaned link on array bracket)
 - #102557 (fix issue with x.py setup running into explicit panic)

Failed merges:

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

21 months agoRollup merge of #102557 - Joshument:master, r=jyn514
Matthias Krüger [Sun, 2 Oct 2022 01:16:40 +0000 (03:16 +0200)]
Rollup merge of #102557 - Joshument:master, r=jyn514

fix issue with x.py setup running into explicit panic

Fixes problem with [Issue #102555](https://github.com/rust-lang/rust/issues/102555) causing `x.py` setup to fail. Simply requires `rustfmt` be downloaded a little later.

21 months agoRollup merge of #102525 - notriddle:notriddle/array-link, r=GuillaumeGomez,jsha
Matthias Krüger [Sun, 2 Oct 2022 01:16:39 +0000 (03:16 +0200)]
Rollup merge of #102525 - notriddle:notriddle/array-link, r=GuillaumeGomez,jsha

rustdoc: remove orphaned link on array bracket

This is #98069, but for arrays instead.

For non-generics, this retains links to the array page, but instead of trying to link it all, it only links the length part, which distinguishes arrays from slices.

For generics, the entire thing becomes a link, just like slices.

| Type | Before | After |
|--|--|--|
| u32 | <code>pub fn alpha() -&gt; &amp;'static <a class="primitive" href="http://doc.rust-lang.org/nightly/core/primitive.array.html">[</a><a class="primitive" href="http://doc.rust-lang.org/nightly/core/primitive.u32.html">u32</a><a class="primitive" href="http://doc.rust-lang.org/nightly/core/primitive.array.html">; 1]</a></code> | <code>pub fn alpha() -&gt; &amp;'static [<a class="primitive" href="http://doc.rust-lang.org/nightly/core/primitive.u32.html">u32</a>; <a class="primitive" href="http://doc.rust-lang.org/nightly/core/primitive.array.html">1</a>]</code>
| generic | <code>pub fn beta&lt;T&gt;() -&gt; &amp;'static <a class="primitive" href="http://doc.rust-lang.org/nightly/core/primitive.array.html">[</a>T<a class="primitive" href="http://doc.rust-lang.org/nightly/core/primitive.array.html">; 1]</a></code> | <code>pub fn beta&lt;T&gt;() -&gt; &amp;'static <a class="primitive" href="http://doc.rust-lang.org/nightly/core/primitive.array.html">[T; 1]</a></code>

21 months agoRollup merge of #102405 - hkBst:patch-3, r=Mark-Simulacrum
Matthias Krüger [Sun, 2 Oct 2022 01:16:39 +0000 (03:16 +0200)]
Rollup merge of #102405 - hkBst:patch-3, r=Mark-Simulacrum

Remove a FIXME whose code got moved away in #62883.

Remove a FIXME whose code got moved away in https://github.com/rust-lang/rust/pull/62883.

21 months agoRollup merge of #102353 - bjorn3:allow_rustix_use_libc, r=Mark-Simulacrum
Matthias Krüger [Sun, 2 Oct 2022 01:16:38 +0000 (03:16 +0200)]
Rollup merge of #102353 - bjorn3:allow_rustix_use_libc, r=Mark-Simulacrum

Allow passing rustix_use_libc cfg using RUSTFLAGS

Before this would error with

```
error: unexpected `rustix_use_libc` as condition name
  |
  = note: `-D unexpected-cfgs` implied by `-D warnings`
  = help: was set with `--cfg` but isn't in the `--check-cfg` expected names
```

I'm setting rustix_use_libc when testing bootstrapping rustc with cg_clif as I'm disabling inline asm here.

21 months agoRollup merge of #102313 - anirudh24seven:update_sleep_ms_doc, r=Mark-Simulacrum
Matthias Krüger [Sun, 2 Oct 2022 01:16:38 +0000 (03:16 +0200)]
Rollup merge of #102313 - anirudh24seven:update_sleep_ms_doc, r=Mark-Simulacrum

Update docs so that deprecated method points to relevant method

The docs for the deprecated 'park_timeout_ms' method suggests that the user 'use park_timeout' method instead (at https://doc.rust-lang.org/std/thread/index.html).

Making a similar change so that the docs for the deprecated `sleep_ms` method suggest that the user `use sleep` method instead.

21 months agoRollup merge of #102195 - wesleywiser:copyright2, r=Mark-Simulacrum,joshtriplett
Matthias Krüger [Sun, 2 Oct 2022 01:16:37 +0000 (03:16 +0200)]
Rollup merge of #102195 - wesleywiser:copyright2, r=Mark-Simulacrum,joshtriplett

Improve the COPYRIGHT file

This is a cutdown version of #96784 which doesn't include the apfloat changes. At this point, the other 3 commits in this PR don't seem to be controversial and I'd like to go ahead and get those merged which will leave #96784 with only the more complex apfloat related change.

r? `@Mark-Simulacrum` since you are the reviewer on that PR

cc `@joshtriplett` since you also had feedback in that PR

21 months agofix issue with x.py setup running into explicit panic
Joshument [Sat, 1 Oct 2022 22:51:10 +0000 (18:51 -0400)]
fix issue with x.py setup running into explicit panic

21 months agoMake `feature(const_btree_len)` implied by `feature(const_btree_new)`
Maybe Waffle [Sat, 1 Oct 2022 22:40:04 +0000 (22:40 +0000)]
Make `feature(const_btree_len)` implied by `feature(const_btree_new)`

21 months agoAuto merge of #102193 - ferrocene:pa-remote-test-server-improvements, r=Mark-Simulacrum
bors [Sat, 1 Oct 2022 22:39:59 +0000 (22:39 +0000)]
Auto merge of #102193 - ferrocene:pa-remote-test-server-improvements, r=Mark-Simulacrum

Change argument handling in `remote-test-server` and add new flags

This PR updates `remote-test-server` to add two new flags:

* `--sequential` disables parallel test execution, accepting one connection at the time instead. We need this for Ferrocene as one of our emulators occasionally deadlocks when running multiple tests in parallel.
* `--bind <ip:port>` allows customizing the IP and port `remote-test-server` binds to, rather than using the default value.

While I was changing the flags, and [after chatting on what to do on Zulip](https://rust-lang.zulipchat.com/#narrow/stream/326414-t-infra.2Fbootstrap/topic/remote-test-server.20flags),  I took this opportunity to cleanup argument handling in `remote-test-server`, which is a breaking change:

* The `verbose` argument has been renamed to the `--verbose` flag.
* The `remote` argument has been removed in favor of the `--bind 0.0.0.0:12345` flag. The only thing the argument did was to change the bound IP to 0.0.0.0, which can easily be replicated with `--bind` and also is not secure as our "remote" default.

I'm also open to keep the old arguments with deprecation warnings.

r? `@Mark-Simulacrum`

21 months agomake tidy accept multi-line `rustc_const_unstable` attributes
Maybe Waffle [Sat, 1 Oct 2022 22:26:48 +0000 (22:26 +0000)]
make tidy accept multi-line `rustc_const_unstable` attributes

21 months agofix: use git-commit-info for version information
dawnofmidnight [Wed, 24 Aug 2022 16:36:08 +0000 (12:36 -0400)]
fix: use git-commit-info for version information

This PR adds support for fetching version information from the
`git-commit-info` file when building the compiler from a source tarball.

21 months agoAuto merge of #102236 - cjgillot:compute_lint_levels_by_def, r=oli-obk
bors [Sat, 1 Oct 2022 19:54:55 +0000 (19:54 +0000)]
Auto merge of #102236 - cjgillot:compute_lint_levels_by_def, r=oli-obk

Compute lint levels by definition

Second attempt to https://github.com/rust-lang/rust/pull/101620.

I think that I have removed the perf regression.

21 months agorustdoc: remove no-op CSS `.impl { position: relative }` etc
Michael Howell [Sat, 1 Oct 2022 17:42:13 +0000 (10:42 -0700)]
rustdoc: remove no-op CSS `.impl { position: relative }` etc

This property was added to help with positioning the `[+]/[-]` toggle.
It is no longer necessary, because `details.rustdoc-toggle` already has
`position:relative` set on it.

21 months agorustdoc: remove no-op CSS `.impl { flex-basis: 100% }` etc
Michael Howell [Sat, 1 Oct 2022 17:40:16 +0000 (10:40 -0700)]
rustdoc: remove no-op CSS `.impl { flex-basis: 100% }` etc

When `.impl-items { flex-basis: 100% }` and `h3.impl, h3.method, h4.method,
h3.type, h4.type, h4.associatedconstant` were added in
34bd2b845b3acd84c5a9bddae3ff8081c19ec5e9, it seems like it was a mistake even
then. According to MDN, [flex-basis] does nothing unless the box it's applied
to is a flex *item*, a child of a flex container. However, when this was
added, these elements were flex containers themselves.

[flex-basis]: https://developer.mozilla.org/en-US/docs/Web/CSS/flex-basis

21 months agoAuto merge of #102545 - matthiaskrgr:rollup-13i3tc3, r=matthiaskrgr
bors [Sat, 1 Oct 2022 17:11:19 +0000 (17:11 +0000)]
Auto merge of #102545 - matthiaskrgr:rollup-13i3tc3, r=matthiaskrgr

Rollup of 3 pull requests

Successful merges:

 - #101675 (Improve `File::set_times` error handling)
 - #102500 (Remove `expr_parentheses_needed` from `ParseSess`)
 - #102533 (rustdoc: remove unused CSS selector `a.source`)

Failed merges:

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

21 months agoMerge apply_attrs_callsite into call and invoke
bjorn3 [Sat, 1 Oct 2022 17:01:31 +0000 (17:01 +0000)]
Merge apply_attrs_callsite into call and invoke

Some codegen backends are not able to apply callsite attrs after the fact.

21 months agoChange feature name to is_some_and
Cameron Steffen [Thu, 23 Jun 2022 18:17:42 +0000 (13:17 -0500)]
Change feature name to is_some_and

21 months agoChange is_some_and to take by value
Cameron Steffen [Tue, 21 Jun 2022 19:27:53 +0000 (14:27 -0500)]
Change is_some_and to take by value

21 months agoRemove unused target_cpu and tune_cpu methods from ExtraBackendMethods
bjorn3 [Sat, 1 Oct 2022 16:45:33 +0000 (16:45 +0000)]
Remove unused target_cpu and tune_cpu methods from ExtraBackendMethods

21 months agoRemove several unused methods from MiscMethods
bjorn3 [Sat, 1 Oct 2022 16:45:07 +0000 (16:45 +0000)]
Remove several unused methods from MiscMethods

21 months agoRemove unused Context assoc type from WriteBackendMethods
bjorn3 [Sat, 1 Oct 2022 16:34:45 +0000 (16:34 +0000)]
Remove unused Context assoc type from WriteBackendMethods

21 months agoMark Cell::replace() as #[inline]
Nikita Popov [Sat, 1 Oct 2022 15:30:54 +0000 (17:30 +0200)]
Mark Cell::replace() as #[inline]

21 months agoRollup merge of #102533 - notriddle:notriddle/a-source, r=Dylan-DPC
Matthias Krüger [Sat, 1 Oct 2022 14:45:05 +0000 (16:45 +0200)]
Rollup merge of #102533 - notriddle:notriddle/a-source, r=Dylan-DPC

rustdoc: remove unused CSS selector `a.source`

The link with this class attribute was removed in https://github.com/rust-lang/rust/commit/4d16de01d0beb84dc4a351022ea5cb587b4ab557#diff-3fe025bd3bd6b48044d0bd8d8c3122de5ecdb1dcd72a9dbe3c24430883595012L1281-R1324

21 months agoRollup merge of #102500 - compiler-errors:parse-sess-cleanup, r=cjgillot
Matthias Krüger [Sat, 1 Oct 2022 14:45:05 +0000 (16:45 +0200)]
Rollup merge of #102500 - compiler-errors:parse-sess-cleanup, r=cjgillot

Remove `expr_parentheses_needed` from `ParseSess`

Not sure why this method needed to exist on `ParseSess`, but we can achieve the same behavior by just inlining it everywhere.

21 months agoRollup merge of #101675 - beetrees:set-times-no-panic, r=joshtriplett
Matthias Krüger [Sat, 1 Oct 2022 14:45:04 +0000 (16:45 +0200)]
Rollup merge of #101675 - beetrees:set-times-no-panic, r=joshtriplett

Improve `File::set_times` error handling

Makes `File::set_times` return an error if the `SystemTime` cannot fit into the required type instead of panicking in `FileTimes::set_{accessed,modified}`. Also makes `File::set_times` return an error on Windows if either of the passed times are `0xFFFF_FFFF_FFFF_FFFF`, as [the documentation for `SetFileTime`](https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-setfiletime) states that this will prevent operations on the file handle from updating the corresponding file time instead of setting the corresponding file time to that value.

Tracking issue: #98245

21 months agoAdd sanity Drop impl.
Camille GILLOT [Sat, 1 Oct 2022 07:49:52 +0000 (09:49 +0200)]
Add sanity Drop impl.

21 months agoAdd FIXME.
Camille GILLOT [Sat, 1 Oct 2022 07:46:39 +0000 (09:46 +0200)]
Add FIXME.

21 months agoUse a SortedMap instead of a VecMap.
Camille GILLOT [Fri, 30 Sep 2022 17:48:55 +0000 (19:48 +0200)]
Use a SortedMap instead of a VecMap.

21 months agoReplace retain with assertion.
Camille GILLOT [Fri, 30 Sep 2022 17:15:57 +0000 (19:15 +0200)]
Replace retain with assertion.