]> git.lizzy.rs Git - rust.git/log
rust.git
16 months agoRollup merge of #104012 - chenyukang:yukang/fix-103882-deli-indentation, r=petrochenkov
Matthias Krüger [Sat, 28 Jan 2023 10:11:05 +0000 (11:11 +0100)]
Rollup merge of #104012 - chenyukang:yukang/fix-103882-deli-indentation, r=petrochenkov

Improve unexpected close and mismatch delimiter hint in TokenTreesReader

Fixes #103882
Fixes #68987
Fixes #69259

The inner indentation mismatching will be covered by outer block, the new added function `report_error_prone_delim_block` will find out the error prone candidates for reporting.

16 months agoAuto merge of #107400 - matthiaskrgr:rollup-l6bycds, r=matthiaskrgr
bors [Sat, 28 Jan 2023 06:46:42 +0000 (06:46 +0000)]
Auto merge of #107400 - matthiaskrgr:rollup-l6bycds, r=matthiaskrgr

Rollup of 8 pull requests

Successful merges:

 - #107022 (Implement `SpecOptionPartialEq` for `cmp::Ordering`)
 - #107100 (Use proper `InferCtxt` when probing for associated types in astconv)
 - #107103 (Use new solver in `evaluate_obligation` query (when new solver is enabled))
 - #107190 (Recover from more const arguments that are not wrapped in curly braces)
 - #107306 (Correct suggestions for closure arguments that need a borrow)
 - #107339 (internally change regions to be covariant)
 - #107344 (Minor tweaks in the new solver)
 - #107373 (Don't merge vtables when full debuginfo is enabled.)

Failed merges:

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

16 months agoRollup merge of #107373 - michaelwoerister:dont-merge-vtables-when-debuginfo, r=Waffl...
Matthias Krüger [Sat, 28 Jan 2023 04:20:19 +0000 (05:20 +0100)]
Rollup merge of #107373 - michaelwoerister:dont-merge-vtables-when-debuginfo, r=WaffleLapkin

Don't merge vtables when full debuginfo is enabled.

This PR makes the compiler not emit the `unnamed_addr` attribute for vtables when full debuginfo is enabled, so that they don't get merged even if they have the same contents. This allows debuggers to more reliably map from a dyn pointer to the self-type of a trait object by looking at the vtable's debuginfo.

The PR only changes the behavior of the LLVM backend as other backends don't emit vtable debuginfo (as far as I can tell).

The performance impact of this change should be small as [measured](https://github.com/rust-lang/rust/pull/103514#issuecomment-1290833854) in a previous PR.

16 months agoRollup merge of #107344 - compiler-errors:new-solver-tweaks, r=lcnr
Matthias Krüger [Sat, 28 Jan 2023 04:20:19 +0000 (05:20 +0100)]
Rollup merge of #107344 - compiler-errors:new-solver-tweaks, r=lcnr

Minor tweaks in the new solver

1. `InferCtxt::probe` is not needed in `compute_subtype_goal` and `compute_well_formed_goal`.
2. Add a handful of comments.
3. Add a micro-optimization in `consider_assumption` where we check the def-ids of the assumption and goal match before instantiating any binders.

r? ``@lcnr``

16 months agoRollup merge of #107339 - aliemjay:covariant, r=lcnr
Matthias Krüger [Sat, 28 Jan 2023 04:20:18 +0000 (05:20 +0100)]
Rollup merge of #107339 - aliemjay:covariant, r=lcnr

internally change regions to be covariant

Surprisingly, we consider the reference type `&'a T` to be contravaraint in its lifetime parameter. This is confusing and conflicts with the documentation we have in the reference, rustnomicon, and rustc-dev-guide. This also arguably not the correct use of terminology since we can use `&'static u8` in a place where `&' a u8` is expected, this implies that `&'static u8 <: &' a u8` and consequently `'static <: ' a`, hence covariance.

Because of this, when relating two types, we used to switch the argument positions in a confusing way:
`Subtype(&'a u8 <: &'b u8) => Subtype('b <: 'a) => Outlives('a: 'b) => RegionSubRegion('b <= 'a)`

The reason for the current behavior is probably that we wanted `Subtype('b <: 'a)` and `RegionSubRegion('b <= 'a)` to be equivalent, but I don' t think this is a good reason since these relations are sufficiently different in that the first is a relation in the subtyping lattice and is intrinsic to the type-systems, while the the second relation is an implementation detail of regionck.

This PR changes this behavior to use covariance, so..
`Subtype(&'a u8 <: &'b u8) => Subtype('a <: 'b) => Outlives('a: 'b) => RegionSubRegion('b <= 'a) `

Resolves #103676

r? `@lcnr`

16 months agoRollup merge of #107306 - compiler-errors:correct-sugg-for-closure-arg-needs-borrow...
Matthias Krüger [Sat, 28 Jan 2023 04:20:18 +0000 (05:20 +0100)]
Rollup merge of #107306 - compiler-errors:correct-sugg-for-closure-arg-needs-borrow, r=oli-obk

Correct suggestions for closure arguments that need a borrow

Fixes #107301 by dealing with binders correctly
Fixes another issue where we were suggesting adding just `&` when we expected `&mut _` in a closure arg

16 months agoRollup merge of #107190 - fmease:fix-81698, r=compiler-errors
Matthias Krüger [Sat, 28 Jan 2023 04:20:17 +0000 (05:20 +0100)]
Rollup merge of #107190 - fmease:fix-81698, r=compiler-errors

Recover from more const arguments that are not wrapped in curly braces

Recover from some array, borrow, tuple & arithmetic expressions in const argument positions that lack curly braces and provide a suggestion to fix the issue continuing where #92884 left off. Examples of such expressions: `[]`, `[0]`, `[1, 2]`, `[0; 0xff]`, `&9`, `("", 0)` and `(1 + 2) * 3` (we previously did not recover from them).

I am not entirely happy with my current solution because the code that recovers from `[0]` (coinciding with a malformed slice type) and `[0; 0]` (coinciding with a malformed array type) is quite fragile as the aforementioned snippets are actually successfully parsed as types by `parse_ty` since it itself already recovers from them (returning `[⟨error⟩]` and `[⟨error⟩; 0]` respectively) meaning I have to manually look for `TyKind::Err`s and construct a separate diagnostic for the suggestion to attach to (thereby emitting two diagnostics in total).

Fixes #81698.
`@rustbot` label A-diagnostics
r? diagnostics

16 months agoRollup merge of #107103 - compiler-errors:new-solver-evaluate_obligation, r=lcnr
Matthias Krüger [Sat, 28 Jan 2023 04:20:16 +0000 (05:20 +0100)]
Rollup merge of #107103 - compiler-errors:new-solver-evaluate_obligation, r=lcnr

Use new solver in `evaluate_obligation` query (when new solver is enabled)

(only when `-Ztrait-solver=next`, of course)

... Does this make sense? It seems to me like it should be reasonable, but maybe there's some reason why this is a bad idea.

r? ``@lcnr``

Needs a perf run because I guess this `solver == TraitSolver::Next` check is on a hot path.

16 months agoRollup merge of #107100 - compiler-errors:issue-107087, r=lcnr
Matthias Krüger [Sat, 28 Jan 2023 04:20:16 +0000 (05:20 +0100)]
Rollup merge of #107100 - compiler-errors:issue-107087, r=lcnr

Use proper `InferCtxt` when probing for associated types in astconv

Fixes #107087

16 months agoRollup merge of #107022 - scottmcm:ordering-option-eq, r=m-ou-se
Matthias Krüger [Sat, 28 Jan 2023 04:20:15 +0000 (05:20 +0100)]
Rollup merge of #107022 - scottmcm:ordering-option-eq, r=m-ou-se

Implement `SpecOptionPartialEq` for `cmp::Ordering`

Noticed as I continue to explore options for having code using `partial_cmp` optimize better.

Before:
```llvm
; Function Attrs: mustprogress nofree nosync nounwind willreturn uwtable
define noundef zeroext i1 `@ordering_eq(i8` noundef %0, i8 noundef %1) unnamed_addr #0 {
start:
  %2 = icmp eq i8 %0, 2
  br i1 %2, label %bb1.i, label %bb3.i

bb1.i:                                            ; preds = %start
  %3 = icmp eq i8 %1, 2
  br label %"_ZN55_$LT$T$u20$as$u20$core..option..SpecOptionPartialEq$GT$2eq17hb7e7beacecde585fE.exit"

bb3.i:                                            ; preds = %start
  %.not.i = icmp ne i8 %1, 2
  %4 = icmp eq i8 %0, %1
  %spec.select.i = and i1 %.not.i, %4
  br label %"_ZN55_$LT$T$u20$as$u20$core..option..SpecOptionPartialEq$GT$2eq17hb7e7beacecde585fE.exit"

"_ZN55_$LT$T$u20$as$u20$core..option..SpecOptionPartialEq$GT$2eq17hb7e7beacecde585fE.exit": ; preds = %bb1.i, %bb3.i
  %.0.i = phi i1 [ %3, %bb1.i ], [ %spec.select.i, %bb3.i ]
  ret i1 %.0.i
}
```

After:
```llvm
; Function Attrs: mustprogress nofree norecurse nosync nounwind readnone willreturn uwtable
define noundef zeroext i1 `@ordering_eq(i8` noundef %0, i8 noundef %1) unnamed_addr #1 {
start:
  %2 = icmp eq i8 %0, %1
  ret i1 %2
}
```

(Which <https://alive2.llvm.org/ce/z/-rop5r> says LLVM *could* just do itself, but there's probably an issue already open for that problem from when this was originally looked at for `Option<NonZeroU8>` and friends.)

16 months agoAuto merge of #107360 - bjorn3:fix_thin_archive_reading, r=wesleywiser
bors [Sat, 28 Jan 2023 04:02:25 +0000 (04:02 +0000)]
Auto merge of #107360 - bjorn3:fix_thin_archive_reading, r=wesleywiser

Fix thin archive reading

This includes a revert of https://github.com/rust-lang/rust/pull/105221 to restore fat archive reading with LlvmArchiveBuilder.

Should fix #107162, #107334 and https://github.com/google/shaderc-rs/issues/133

16 months agoLink to the LLVM issue from a comment on `SpecOptionPartialEq`
Scott McMurray [Sat, 28 Jan 2023 03:09:52 +0000 (19:09 -0800)]
Link to the LLVM issue from a comment on `SpecOptionPartialEq`

16 months agoAuto merge of #101692 - cjgillot:generator-lazy-witness, r=oli-obk
bors [Sat, 28 Jan 2023 01:05:29 +0000 (01:05 +0000)]
Auto merge of #101692 - cjgillot:generator-lazy-witness, r=oli-obk

Compute generator saved locals on MIR

Generators are currently type-checked by introducing a `witness` type variable, which is unified with a `GeneratorWitness(captured types)` whose purpose is to ensure that the auto traits correctly migrate from the captured types to the `witness` type.  This requires computing the captured types on HIR during type-checking, only to re-do it on MIR later.

This PR proposes to drop the HIR-based computation, and only keep the MIR one.  This is done in 3 steps.
1. During type-checking, the `witness` type variable is never unified.  This allows to stall all the obligations that depend on it until the end of type-checking.  Then, the stalled obligations are marked as successful, and saved into the typeck results for later verification.
2. At type-checking writeback, `witness` is replaced by `GeneratorWitnessMIR(def_id, substs)`.  From this point on, all trait selection involving `GeneratorWitnessMIR` will fetch the MIR-computed locals, similar to what opaque types do.  There is no lifetime to be preserved here: we consider all the lifetimes appearing in this witness type to be higher-ranked.
3. After borrowck, the stashed obligations are verified against the actually computed types, in the `check_generator_obligations` query.  If any obligation was wrongly marked as fulfilled in step 1, it should be reported here.

There are still many issues:
- ~I am not too happy having to filter out some locals from the checked bounds, I think this is MIR building that introduces raw pointers polluting the analysis;~ solved by a check specific to static variables.
- the diagnostics for captured types don't show where they are used/dropped;
- I do not attempt to support chalk.

cc `@eholk` `@jyn514` for the drop-tracking work
r? `@oli-obk` as you warned me of potential unsoundness

16 months agoBless mir-opt tests.
Camille GILLOT [Sat, 21 Jan 2023 14:26:44 +0000 (14:26 +0000)]
Bless mir-opt tests.

16 months agoPacify tidy.
Camille GILLOT [Sat, 21 Jan 2023 10:12:11 +0000 (10:12 +0000)]
Pacify tidy.

16 months agoRestrict amount of ignored locals.
Camille GILLOT [Sat, 21 Jan 2023 10:03:12 +0000 (10:03 +0000)]
Restrict amount of ignored locals.

16 months agoAuto merge of #107386 - flip1995:clippyup, r=Manishearth
bors [Fri, 27 Jan 2023 21:20:39 +0000 (21:20 +0000)]
Auto merge of #107386 - flip1995:clippyup, r=Manishearth

Update Clippy

r? `@Manishearth`

16 months agoBless ui-fulldeps.
Camille GILLOT [Sat, 1 Oct 2022 17:57:39 +0000 (19:57 +0200)]
Bless ui-fulldeps.

16 months agoBless tests.
Camille GILLOT [Thu, 26 Jan 2023 03:51:26 +0000 (03:51 +0000)]
Bless tests.

16 months agoCompute generator saved locals on MIR.
Camille GILLOT [Sat, 1 Oct 2022 13:57:22 +0000 (15:57 +0200)]
Compute generator saved locals on MIR.

16 months agoUpdate Cargo.lock
Philipp Krones [Fri, 27 Jan 2023 20:09:23 +0000 (21:09 +0100)]
Update Cargo.lock

16 months agoMerge commit '1480cea393d0cee195e59949eabdfbcf1230f7f9' into clippyup
Philipp Krones [Fri, 27 Jan 2023 20:09:08 +0000 (21:09 +0100)]
Merge commit '1480cea393d0cee195e59949eabdfbcf1230f7f9' into clippyup

16 months agoMicro-optimization in consider_assumption
Michael Goulet [Fri, 27 Jan 2023 04:32:12 +0000 (04:32 +0000)]
Micro-optimization in consider_assumption

16 months agoAdd some comments
Michael Goulet [Fri, 27 Jan 2023 04:31:51 +0000 (04:31 +0000)]
Add some comments

16 months agoNo need to probe when computing goals
Michael Goulet [Fri, 27 Jan 2023 04:00:37 +0000 (04:00 +0000)]
No need to probe when computing goals

16 months agoAuto merge of #10242 - flip1995:rustup, r=flip1995
bors [Fri, 27 Jan 2023 19:31:37 +0000 (19:31 +0000)]
Auto merge of #10242 - flip1995:rustup, r=flip1995

Rustup

r? `@ghost`

changelog: none

16 months agoBump Clippy version -> 0.1.69
Philipp Krones [Fri, 27 Jan 2023 19:27:00 +0000 (20:27 +0100)]
Bump Clippy version -> 0.1.69

16 months agoBump nightly version -> 2023-01-27
Philipp Krones [Fri, 27 Jan 2023 19:26:48 +0000 (20:26 +0100)]
Bump nightly version -> 2023-01-27

16 months agoMerge remote-tracking branch 'upstream/master' into rustup
Philipp Krones [Fri, 27 Jan 2023 19:21:37 +0000 (20:21 +0100)]
Merge remote-tracking branch 'upstream/master' into rustup

16 months agoSeparate witness type computation from the generator transform.
Camille GILLOT [Tue, 26 Jul 2022 18:37:25 +0000 (20:37 +0200)]
Separate witness type computation from the generator transform.

16 months agoRemember where a type was kept in MIR.
Camille GILLOT [Sun, 11 Sep 2022 15:24:53 +0000 (17:24 +0200)]
Remember where a type was kept in MIR.

16 months agoIntroduce GeneratorWitnessMIR.
Camille GILLOT [Sat, 1 Oct 2022 12:56:24 +0000 (14:56 +0200)]
Introduce GeneratorWitnessMIR.

16 months agoAlways require Drop for generators.
Camille GILLOT [Sun, 11 Sep 2022 15:22:38 +0000 (17:22 +0200)]
Always require Drop for generators.

16 months agoTest the 3 generator handling versions for generator/async tests.
Camille GILLOT [Sat, 1 Oct 2022 10:19:31 +0000 (12:19 +0200)]
Test the 3 generator handling versions for generator/async tests.

16 months agoAdd `drop_tracking_mir` option.
Camille GILLOT [Sat, 1 Oct 2022 09:33:16 +0000 (11:33 +0200)]
Add `drop_tracking_mir` option.

16 months agoSeparate trait selection from ambiguity reporting.
Camille GILLOT [Wed, 28 Sep 2022 16:16:23 +0000 (18:16 +0200)]
Separate trait selection from ambiguity reporting.

16 months agoImpl HashStable/Encodable/Decodable for ObligationCause.
Camille GILLOT [Sun, 11 Sep 2022 12:42:43 +0000 (14:42 +0200)]
Impl HashStable/Encodable/Decodable for ObligationCause.

16 months agoDo not abort compilation when failing to normalize opaque types.
Camille GILLOT [Sun, 11 Sep 2022 09:22:47 +0000 (11:22 +0200)]
Do not abort compilation when failing to normalize opaque types.

16 months agorecover more unbraced const args
León Orell Valerian Liehr [Sun, 22 Jan 2023 11:05:36 +0000 (12:05 +0100)]
recover more unbraced const args

16 months agoUse now solver in evaluate_obligation
Michael Goulet [Fri, 27 Jan 2023 17:46:18 +0000 (17:46 +0000)]
Use now solver in evaluate_obligation

16 months agoAuto merge of #107372 - JohnTitor:rollup-zkl2ges, r=JohnTitor
bors [Fri, 27 Jan 2023 17:49:56 +0000 (17:49 +0000)]
Auto merge of #107372 - JohnTitor:rollup-zkl2ges, r=JohnTitor

Rollup of 9 pull requests

Successful merges:

 - #106806 (Replace format flags u32 by enums and bools.)
 - #107194 (Remove dependency on slice_internals feature in rustc_ast)
 - #107234 (Revisit fix_is_ci_llvm_available logic)
 - #107316 (Update snap from `1.0.1` to `1.1.0`)
 - #107321 (solver comments + remove `TyCtxt::evaluate_goal`)
 - #107332 (Fix wording from `rustbuild` to `bootstrap`)
 - #107347 (reduce rightward-drift)
 - #107352 (compiler: Fix E0587 explanation)
 - #107357 (Fix infinite loop in rustdoc get_all_import_attributes function)

Failed merges:

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

16 months agoDon't merge vtables when full debuginfo is enabled.
Michael Woerister [Fri, 27 Jan 2023 15:29:04 +0000 (15:29 +0000)]
Don't merge vtables when full debuginfo is enabled.

16 months agoRollup merge of #107357 - GuillaumeGomez:fix-infinite-loop-in-rustdoc-get_all_import_...
Yuki Okushi [Fri, 27 Jan 2023 15:23:16 +0000 (00:23 +0900)]
Rollup merge of #107357 - GuillaumeGomez:fix-infinite-loop-in-rustdoc-get_all_import_attributes, r=notriddle

Fix infinite loop in rustdoc get_all_import_attributes function

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

We'll also need to backport this fix to beta.

r? `@notriddle`

16 months agoRollup merge of #107352 - sameo:topic/E0587, r=JohnTitor
Yuki Okushi [Fri, 27 Jan 2023 15:23:15 +0000 (00:23 +0900)]
Rollup merge of #107352 - sameo:topic/E0587, r=JohnTitor

compiler: Fix E0587 explanation

We meant to use 8 as the packed argument.

Signed-off-by: Samuel Ortiz <sameo@rivosinc.com>
16 months agoRollup merge of #107347 - tshepang:rightward-drift, r=Nilstrieb
Yuki Okushi [Fri, 27 Jan 2023 15:23:15 +0000 (00:23 +0900)]
Rollup merge of #107347 - tshepang:rightward-drift, r=Nilstrieb

reduce rightward-drift

16 months agoRollup merge of #107332 - chansuke:issue-107230, r=albertlarsan68
Yuki Okushi [Fri, 27 Jan 2023 15:23:14 +0000 (00:23 +0900)]
Rollup merge of #107332 - chansuke:issue-107230, r=albertlarsan68

Fix wording from `rustbuild` to `bootstrap`

Fixes #107230

16 months agoRollup merge of #107321 - lcnr:comment, r=compiler-errors
Yuki Okushi [Fri, 27 Jan 2023 15:23:14 +0000 (00:23 +0900)]
Rollup merge of #107321 - lcnr:comment, r=compiler-errors

solver comments + remove `TyCtxt::evaluate_goal`

from the `RustcContributor::explore` session yesterday.

This also removes `TyCtxt::evaluate_goal` because to canonicalize you have to use an `InferCtxt` anyways at which point we should just always get people to use `evaluate_root_goal`.

r? ``@spastorino``

16 months agoRollup merge of #107316 - ChrisDenton:snap, r=oli-obk
Yuki Okushi [Fri, 27 Jan 2023 15:23:13 +0000 (00:23 +0900)]
Rollup merge of #107316 - ChrisDenton:snap, r=oli-obk

Update snap from `1.0.1` to `1.1.0`

As spotted by `@mejrs,` snap 1.0.1 emits a future compatibility warning. This was fixed in https://github.com/BurntSushi/rust-snappy/pull/39

16 months agoRollup merge of #107234 - Rattenkrieg:bootstrap-fix-is_ci_llvm_available, r=albertlar...
Yuki Okushi [Fri, 27 Jan 2023 15:23:13 +0000 (00:23 +0900)]
Rollup merge of #107234 - Rattenkrieg:bootstrap-fix-is_ci_llvm_available, r=albertlarsan68

Revisit fix_is_ci_llvm_available logic

Fixes #107225
Now `supported_platforms` has a knowledge whether llvm asserts artifacts are available for particular host triple.

``@jyn514`` ``@albertlarsan68`` PTAL

16 months agoRollup merge of #107194 - xfix:remove-slice-internals-dependency-in-rustc-ast, r...
Yuki Okushi [Fri, 27 Jan 2023 15:23:12 +0000 (00:23 +0900)]
Rollup merge of #107194 - xfix:remove-slice-internals-dependency-in-rustc-ast, r=Nilstrieb

Remove dependency on slice_internals feature in rustc_ast

This reduces dependency on unstable features by the compiler.

16 months agoRollup merge of #106806 - m-ou-se:format-args-flags, r=oli-obk
Yuki Okushi [Fri, 27 Jan 2023 15:23:11 +0000 (00:23 +0900)]
Rollup merge of #106806 - m-ou-se:format-args-flags, r=oli-obk

Replace format flags u32 by enums and bools.

This gets rid of the `flags: u32` field where each bit has a special meaning, and replaces it by simple enums and booleans.

Part of #99012

16 months agoAuto merge of #107055 - kylematsuda:eb-fn-sig, r=lcnr
bors [Fri, 27 Jan 2023 15:02:44 +0000 (15:02 +0000)]
Auto merge of #107055 - kylematsuda:eb-fn-sig, r=lcnr

Switch to `EarlyBinder` for `fn_sig` query

Part of the work to finish #105779 (also see https://github.com/rust-lang/types-team/issues/78).

Several queries `X` have a `bound_X` variant that wraps the output in [`EarlyBinder`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/subst/struct.EarlyBinder.html). This adds `EarlyBinder` to the return type of the `fn_sig` query and removes `bound_fn_sig`.

r? `@lcnr`

16 months agoAuto merge of #10237 - cstyles:fix-docs-for-suspicious_xor_used_as_pow, r=Jarcho
bors [Fri, 27 Jan 2023 14:02:23 +0000 (14:02 +0000)]
Auto merge of #10237 - cstyles:fix-docs-for-suspicious_xor_used_as_pow, r=Jarcho

Fix styling in documentation for `suspicious_xor_used_as_pow` lint

There was a tab after the three leading slashes which caused the contents of the "Why is this bad?" section to be rendered as a code block.

**Before:**

<img width="626" alt="master" src="https://user-images.githubusercontent.com/4869194/214985546-4433d211-9fd3-450c-8ff7-2c0a47fccdc0.png">

**After:**

<img width="520" alt="fixed" src="https://user-images.githubusercontent.com/4869194/214985561-87255196-008c-4a1c-8cc8-c54b337d22a2.png">

The file still contains a lot of tabs but they don't affect the documentation.

---

changelog: [`suspicious_xor_used_as_pow`]: Fix styling in documentation

16 months agoRevert back to LlvmArchiveBuilder on all platforms
bjorn3 [Fri, 27 Jan 2023 11:48:36 +0000 (11:48 +0000)]
Revert back to LlvmArchiveBuilder on all platforms

ArArchiveBuilder doesn't support reading thin archives, causing a
regression.

16 months agoRevert "Remove macOS fat archive support from LlvmArchiveBuilder"
bjorn3 [Fri, 27 Jan 2023 11:46:27 +0000 (11:46 +0000)]
Revert "Remove macOS fat archive support from LlvmArchiveBuilder"

This reverts commit 047c7cc60c05e2cf182c6f578581cf2a67b1d0ff.

16 months agoRevert "Avoid a temporary file when processing macOS fat archives"
bjorn3 [Fri, 27 Jan 2023 11:46:20 +0000 (11:46 +0000)]
Revert "Avoid a temporary file when processing macOS fat archives"

This reverts commit bd8e476d8bd85b6d60a0de7694d154b4a74f5133.

16 months agoAdd regression test for #107350
Guillaume Gomez [Fri, 27 Jan 2023 11:10:05 +0000 (12:10 +0100)]
Add regression test for #107350

16 months agoFix infinite loop in rustdoc get_all_import_attributes function
Guillaume Gomez [Fri, 27 Jan 2023 11:09:50 +0000 (12:09 +0100)]
Fix infinite loop in rustdoc get_all_import_attributes function

16 months agoDestructure format_options in make_format_spec.
Mara Bos [Fri, 27 Jan 2023 10:43:38 +0000 (11:43 +0100)]
Destructure format_options in make_format_spec.

16 months agocompiler: Fix E0587 explanation
Samuel Ortiz [Fri, 27 Jan 2023 09:58:58 +0000 (10:58 +0100)]
compiler: Fix E0587 explanation

We meant to use 8 as the packed argument.

Signed-off-by: Samuel Ortiz <sameo@rivosinc.com>
16 months agoImprove unexpected close and mismatch delimiter hint in TokenTreesReader
yukang [Thu, 26 Jan 2023 03:02:19 +0000 (11:02 +0800)]
Improve unexpected close and mismatch delimiter hint in TokenTreesReader

16 months agoupdate comment on trait objects
Ali MJ Al-Nasrawy [Fri, 27 Jan 2023 09:43:29 +0000 (12:43 +0300)]
update comment on trait objects

16 months agoAuto merge of #107054 - petrochenkov:effvisdoc3, r=GuillaumeGomez
bors [Fri, 27 Jan 2023 09:01:05 +0000 (09:01 +0000)]
Auto merge of #107054 - petrochenkov:effvisdoc3, r=GuillaumeGomez

rustdoc: Collect "rustdoc-reachable" items during early doc link resolution

This pass only needs to know about visibilities, attributes and reexports, so it can be run early, similarly to `compute_effective_visibilities` in rustc.
Results of this pass can be used to prune the list of extern impls early thus improving performance of https://github.com/rust-lang/rust/pull/94857.

16 months agoUpdate clippy for restructured format flags fields.
Mara Bos [Fri, 13 Jan 2023 12:56:51 +0000 (13:56 +0100)]
Update clippy for restructured format flags fields.

16 months agoReplace format flags u32 by enums and bools.
Mara Bos [Fri, 13 Jan 2023 12:32:49 +0000 (13:32 +0100)]
Replace format flags u32 by enums and bools.

16 months agoRevisit fix_is_ci_llvm_available logic; read build triple from toml
Sergey Prytkov [Mon, 23 Jan 2023 18:03:06 +0000 (21:03 +0300)]
Revisit fix_is_ci_llvm_available logic; read build triple from toml

16 months agoAuto merge of #107343 - JohnTitor:rollup-s6l94aj, r=JohnTitor
bors [Fri, 27 Jan 2023 06:10:19 +0000 (06:10 +0000)]
Auto merge of #107343 - JohnTitor:rollup-s6l94aj, r=JohnTitor

Rollup of 8 pull requests

Successful merges:

 - #105784 (update stdarch)
 - #106856 (core: Support variety of atomic widths in width-agnostic functions)
 - #107171 (rustc_metadata: Fix `encode_attrs`)
 - #107242 (rustdoc: make item links consistently use `title="{shortty} {path}"`)
 - #107279 (Use new solver during selection)
 - #107284 (rustdoc: use smarter encoding for playground URL)
 - #107325 (rustdoc: Stop using `HirId`s)
 - #107336 (rustdoc: remove mostly-unused CSS classes `import-item` and `module-item`)

Failed merges:

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

16 months agoreduce rightward-drift
Tshepang Mbambo [Fri, 27 Jan 2023 05:52:44 +0000 (07:52 +0200)]
reduce rightward-drift

16 months agoRollup merge of #107336 - notriddle:notriddle/import-item-module-item, r=GuillaumeGomez
Yuki Okushi [Fri, 27 Jan 2023 03:57:57 +0000 (12:57 +0900)]
Rollup merge of #107336 - notriddle:notriddle/import-item-module-item, r=GuillaumeGomez

rustdoc: remove mostly-unused CSS classes `import-item` and `module-item`

16 months agoRollup merge of #107325 - petrochenkov:hiddoc2, r=GuillaumeGomez
Yuki Okushi [Fri, 27 Jan 2023 03:57:56 +0000 (12:57 +0900)]
Rollup merge of #107325 - petrochenkov:hiddoc2, r=GuillaumeGomez

rustdoc: Stop using `HirId`s

Use `LocalDefId`s instead.
Rustdoc doesn't work with item bodies, so it almost never needs fine-grained HIR IDs.

16 months agoRollup merge of #107284 - notriddle:notriddle/plus, r=jsha
Yuki Okushi [Fri, 27 Jan 2023 03:57:56 +0000 (12:57 +0900)]
Rollup merge of #107284 - notriddle:notriddle/plus, r=jsha

rustdoc: use smarter encoding for playground URL

The old way would compress okay with DEFLATE, but this version makes uncompressed docs smaller, which matters for memory usage and stuff like `cargo doc`.

Try it out: <https://play.rust-lang.org/?code=fn+main()+{%0Alet+mut+v+=+Vec::new();%0Av.push(1+/+1);%0Aprintln!(%22{}%22,+v[0]);%0A}>

In local testing, this change shrinks sample pages by anywhere between 4.0% and 0.031%

    $ du -b after.dir/std/vec/struct.Vec.html before.dir/std/vec/struct.Vec.html
    759235  after.dir/std/vec/struct.Vec.html
    781842  before.dir/std/vec/struct.Vec.html

100*((759235-781842)/781842)=-2.8

    $ du -b after.dir/std/num/struct.Wrapping.html before.dir/std/num/struct.Wrapping.html
    3194173 after.dir/std/num/struct.Wrapping.html
    3204351 before.dir/std/num/struct.Wrapping.html

100*((3194173-3204351)/3204351)=-0.031

    $ du -b after.dir/std/keyword.match.html before.dir/std/keyword.match.html
    8151    after.dir/std/keyword.match.html
    8495    before.dir/std/keyword.match.html

100*((8151-8495)/8495)=-4.0

Gzipped tarball sizes seem shrunk, but not by much.

    du -s before.tar.gz after.tar.gz
    69600   before.tar.gz
    69480   after.tar.gz

100*((69480-69600)/69600)=-0.17

16 months agoRollup merge of #107279 - compiler-errors:new-solver-evaluate, r=lcnr
Yuki Okushi [Fri, 27 Jan 2023 03:57:55 +0000 (12:57 +0900)]
Rollup merge of #107279 - compiler-errors:new-solver-evaluate, r=lcnr

Use new solver during selection

r? ``@lcnr``

16 months agoRollup merge of #107242 - notriddle:notriddle/title-ordering, r=GuillaumeGomez
Yuki Okushi [Fri, 27 Jan 2023 03:57:55 +0000 (12:57 +0900)]
Rollup merge of #107242 - notriddle:notriddle/title-ordering, r=GuillaumeGomez

rustdoc: make item links consistently use `title="{shortty} {path}"`

The ordering in item tables was flipped in 3030cbea957adbd560bf2eaa34c1b8a56daee16a, making it inconsistent with the ordering in method signatures.

Compare these (before this PR is merged):

https://github.com/rust-lang/rust/blob/c8e6a9e8b6251bbc8276cb78cabe1998deecbed7/src/librustdoc/html/render/print_item.rs#L455-L459

https://github.com/rust-lang/rust/blob/c8e6a9e8b6251bbc8276cb78cabe1998deecbed7/src/librustdoc/html/format.rs#L903-L908

16 months agoRollup merge of #107171 - petrochenkov:encattrs, r=cjgillot
Yuki Okushi [Fri, 27 Jan 2023 03:57:54 +0000 (12:57 +0900)]
Rollup merge of #107171 - petrochenkov:encattrs, r=cjgillot

rustc_metadata: Fix `encode_attrs`

This function didn't do what the authors intended it to do.

- Due to `move` in the closure `is_public` wasn't captured by mutalbe reference and wasn't used as a cache.
- Due to iterator cloning all the `should_encode_attr` logic run for the second time to calculate `may_have_doc_links`

This PR fixes these issues, and calculates all the needed attribute flags in one go.

(Noticed while implementing https://github.com/rust-lang/rust/pull/107136.)

16 months agoRollup merge of #106856 - vadorovsky:fix-atomic-annotations, r=joshtriplett
Yuki Okushi [Fri, 27 Jan 2023 03:57:54 +0000 (12:57 +0900)]
Rollup merge of #106856 - vadorovsky:fix-atomic-annotations, r=joshtriplett

core: Support variety of atomic widths in width-agnostic functions

Before this change, the following functions and macros were annotated with `#[cfg(target_has_atomic = "8")]` or
`#[cfg(target_has_atomic_load_store = "8")]`:

* `atomic_int`
* `strongest_failure_ordering`
* `atomic_swap`
* `atomic_add`
* `atomic_sub`
* `atomic_compare_exchange`
* `atomic_compare_exchange_weak`
* `atomic_and`
* `atomic_nand`
* `atomic_or`
* `atomic_xor`
* `atomic_max`
* `atomic_min`
* `atomic_umax`
* `atomic_umin`

However, none of those functions and macros actually depend on 8-bit width and they are needed for all atomic widths (16-bit, 32-bit, 64-bit etc.). Some targets might not support 8-bit atomics (i.e. BPF, if we would enable atomic CAS for it).

This change fixes that by removing the `"8"` argument from annotations, which results in accepting the whole variety of widths.

Fixes #106845
Fixes #106795

Signed-off-by: Michal Rostecki <vadorovsky@gmail.com>
16 months agoRollup merge of #105784 - yanns:update_stdarch, r=Amanieu
Yuki Okushi [Fri, 27 Jan 2023 03:57:53 +0000 (12:57 +0900)]
Rollup merge of #105784 - yanns:update_stdarch, r=Amanieu

update stdarch

This will allow using miri on simd instructions
https://github.com/rust-lang/stdarch/issues/1347#issuecomment-1353664361

16 months agofixup new usages of fn_sig, bound_fn_sig after rebasing
Kyle Matsuda [Fri, 27 Jan 2023 03:33:27 +0000 (20:33 -0700)]
fixup new usages of fn_sig, bound_fn_sig after rebasing

16 months agoadd method_substs to CallKind
Kyle Matsuda [Fri, 20 Jan 2023 22:17:01 +0000 (15:17 -0700)]
add method_substs to CallKind

16 months agofix up subst_identity vs skip_binder; add some FIXMEs as identified in review
Kyle Matsuda [Thu, 19 Jan 2023 19:52:52 +0000 (12:52 -0700)]
fix up subst_identity vs skip_binder; add some FIXMEs as identified in review

16 months agoadd EarlyBinder::no_bound_vars
Kyle Matsuda [Thu, 19 Jan 2023 19:09:01 +0000 (12:09 -0700)]
add EarlyBinder::no_bound_vars

16 months agochange fn_sig query to use EarlyBinder; remove bound_fn_sig query; add EarlyBinder...
Kyle Matsuda [Wed, 18 Jan 2023 23:52:47 +0000 (16:52 -0700)]
change fn_sig query to use EarlyBinder; remove bound_fn_sig query; add EarlyBinder to fn_sig in metadata

16 months agoAuto merge of #106959 - tmiasko:opt-funclets, r=davidtwco
bors [Fri, 27 Jan 2023 03:25:16 +0000 (03:25 +0000)]
Auto merge of #106959 - tmiasko:opt-funclets, r=davidtwco

Omit needless funclet partitioning

16 months agoreplace usages of fn_sig query with bound_fn_sig
Kyle Matsuda [Wed, 18 Jan 2023 22:43:20 +0000 (15:43 -0700)]
replace usages of fn_sig query with bound_fn_sig

16 months agointernally change regions to be covariant
Ali MJ Al-Nasrawy [Thu, 26 Jan 2023 23:23:08 +0000 (02:23 +0300)]
internally change regions to be covariant

16 months agoFix docs for `suspicious_xor_used_as_pow` lint
Collin Styles [Fri, 27 Jan 2023 00:44:44 +0000 (16:44 -0800)]
Fix docs for `suspicious_xor_used_as_pow` lint

There was a tab after the three leading slashes which caused the
contents of the "Why is this bad?" section to be rendered as a code
block.

16 months agoAuto merge of #107269 - bjorn3:sync_cg_clif-2023-01-24, r=bjorn3
bors [Fri, 27 Jan 2023 00:03:09 +0000 (00:03 +0000)]
Auto merge of #107269 - bjorn3:sync_cg_clif-2023-01-24, r=bjorn3

Sync rustc_codegen_cranelift

For cg_clif itself there have been a couple of bug fixes since the last sync, a Cranelift update and implemented all remaining simd platform intrinsics used by `std::simd`. (`std::arch` still misses a lot though) Most of the diff is from reworking of the cg_clif build system though.

r? `@ghost`

`@rustbot` label +A-codegen +A-cranelift +T-compiler

16 months agoAuto merge of #106812 - oli-obk:output_filenames, r=petrochenkov
bors [Thu, 26 Jan 2023 20:32:28 +0000 (20:32 +0000)]
Auto merge of #106812 - oli-obk:output_filenames, r=petrochenkov

make `output_filenames` a real query

part of #105462

This may be a perf regression and is not obviously the right way forward. We may store this information in the resolver after freezing it for example.

16 months agoUse new solver during selection
Michael Goulet [Tue, 24 Jan 2023 21:43:21 +0000 (21:43 +0000)]
Use new solver during selection

16 months agorustdoc: remove mostly-unused CSS classes import/module-item
Michael Howell [Thu, 26 Jan 2023 19:50:14 +0000 (12:50 -0700)]
rustdoc: remove mostly-unused CSS classes import/module-item

16 months agorustdoc: use smarter encoding for playground URL
Michael Howell [Tue, 24 Jan 2023 22:39:59 +0000 (15:39 -0700)]
rustdoc: use smarter encoding for playground URL

The old way would compress okay with DEFLATE, but this version makes
uncompressed docs smaller, which matters for memory usage and stuff
like `cargo doc`.

Try it out: <https://play.rust-lang.org/?code=fn+main()+{%0Alet+mut+v+=+Vec::new();%0Av.push(1+/+1);%0Aprintln!(%22{}%22,+v[0]);%0A}>

In local testing, this change shrinks sample pages by anywhere between
4.0% and 0.031%

    $ du -b after.dir/std/vec/struct.Vec.html before.dir/std/vec/struct.Vec.html
    759235  after.dir/std/vec/struct.Vec.html
    781842  before.dir/std/vec/struct.Vec.html

100*((759235-781842)/781842)=-2.8

    $ du -b after.dir/std/num/struct.Wrapping.html before.dir/std/num/struct.Wrapping.html
    3194173 after.dir/std/num/struct.Wrapping.html
    3204351 before.dir/std/num/struct.Wrapping.html

100*((3194173-3204351)/3204351)=-0.031

    $ du -b after.dir/std/keyword.match.html before.dir/std/keyword.match.html
    8151    after.dir/std/keyword.match.html
    8495    before.dir/std/keyword.match.html

100*((8151-8495)/8495)=-4.0

Gzipped tarball sizes seem shrunk, but not by much.

    du -s before.tar.gz after.tar.gz
    69600   before.tar.gz
    69480   after.tar.gz

100*((69480-69600)/69600)=-0.17

16 months agoAuto merge of #10232 - xFrednet:changelog-1-67, r=Alexendoo
bors [Thu, 26 Jan 2023 16:32:31 +0000 (16:32 +0000)]
Auto merge of #10232 - xFrednet:changelog-1-67, r=Alexendoo

Mark Rust 1.67 as released in the changelog

Roses are red,
violets are blue,
not much to say,
not much to do

---

changelog: none.

16 months agoFix woriding from `rustbuild` to `bootstrap`
chansuke [Thu, 26 Jan 2023 16:21:21 +0000 (01:21 +0900)]
Fix woriding from `rustbuild` to `bootstrap`

16 months agoMark Rust 1.67 as released in the changelog
xFrednet [Fri, 20 Jan 2023 08:54:07 +0000 (09:54 +0100)]
Mark Rust 1.67 as released in the changelog

16 months agoAuto merge of #107328 - matthiaskrgr:rollup-lfqwo0o, r=matthiaskrgr
bors [Thu, 26 Jan 2023 15:58:08 +0000 (15:58 +0000)]
Auto merge of #107328 - matthiaskrgr:rollup-lfqwo0o, r=matthiaskrgr

Rollup of 8 pull requests

Successful merges:

 - #106904 (Preserve split DWARF files when building archives.)
 - #106971 (Handle diagnostics customization on the fluent side (for one specific diagnostic))
 - #106978 (Migrate mir_build's borrow conflicts)
 - #107150 (`ty::tls` cleanups)
 - #107168 (Use a type-alias-impl-trait in `ObligationForest`)
 - #107189 (Encode info for Adt in a single place.)
 - #107322 (Custom mir: Add support for some remaining, easy to support constructs)
 - #107323 (Disable ConstGoto opt in cleanup blocks)

Failed merges:

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

16 months agoRollup merge of #107323 - JakobDegen:const-goto, r=tmiasko
Matthias Krüger [Thu, 26 Jan 2023 14:02:22 +0000 (15:02 +0100)]
Rollup merge of #107323 - JakobDegen:const-goto, r=tmiasko

Disable ConstGoto opt in cleanup blocks

Fixes #107315 .

There is probably a smaller hammer that we could use here, but none that is super obviously correct. We can always revisit this in the future.

Could not add a test because custom mir does not support cleanup blocks. However, did check that the fallible_iterator crate no longer ICEs with the other PR cherry picked.

r? `@tmiasko`

16 months agoRollup merge of #107322 - JakobDegen:custom-mir, r=tmiasko
Matthias Krüger [Thu, 26 Jan 2023 14:02:22 +0000 (15:02 +0100)]
Rollup merge of #107322 - JakobDegen:custom-mir, r=tmiasko

Custom mir: Add support for some remaining, easy to support constructs

Some documentation for previous changes and support for `Deinit`, checked binops, len, and array repetition

r? ```@oli-obk``` or ```@tmiasko```

16 months agoRollup merge of #107189 - cjgillot:meta-adt, r=compiler-errors
Matthias Krüger [Thu, 26 Jan 2023 14:02:21 +0000 (15:02 +0100)]
Rollup merge of #107189 - cjgillot:meta-adt, r=compiler-errors

Encode info for Adt in a single place.

Split from https://github.com/rust-lang/rust/pull/98867

16 months agoRollup merge of #107168 - Nilstrieb:if-a-tait-falls-in-the-forest,can-we-know-it...
Matthias Krüger [Thu, 26 Jan 2023 14:02:21 +0000 (15:02 +0100)]
Rollup merge of #107168 - Nilstrieb:if-a-tait-falls-in-the-forest,can-we-know-it-wasnt-revealed, r=oli-obk

Use a type-alias-impl-trait in `ObligationForest`

16 months agoRollup merge of #107150 - Nilstrieb:thread-local-cleanups, r=cjgillot
Matthias Krüger [Thu, 26 Jan 2023 14:02:20 +0000 (15:02 +0100)]
Rollup merge of #107150 - Nilstrieb:thread-local-cleanups, r=cjgillot

`ty::tls` cleanups

Pull it out into a separate file, make the conditional compilation more obvious and give the internal functions better names.

Pulled out of #106311

r? cjgillot

16 months agoRollup merge of #106978 - mejrs:mir_build3, r=davidtwco
Matthias Krüger [Thu, 26 Jan 2023 14:02:20 +0000 (15:02 +0100)]
Rollup merge of #106978 - mejrs:mir_build3, r=davidtwco

Migrate mir_build's borrow conflicts

This also changes the error message slightly, for two reasons:

- I'm not a fan of saying "value borrowed, by `x`, here"
- it simplifies the error implementation significantly.