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

17 months agoFix some Fluent typos
clubby789 [Thu, 19 Jan 2023 23:53:26 +0000 (23:53 +0000)]
Fix some Fluent typos

17 months agoDetect references to non-existant messages in Fluent resources
clubby789 [Thu, 19 Jan 2023 23:48:08 +0000 (23:48 +0000)]
Detect references to non-existant messages in Fluent resources

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

17 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

17 months agoAdd regression test for #60755
Yuki Okushi [Fri, 27 Jan 2023 10:46:56 +0000 (19:46 +0900)]
Add regression test for #60755

Signed-off-by: Yuki Okushi <jtitor@2k36.org>
17 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.

17 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>
17 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

17 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

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

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

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

17 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

17 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

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

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

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

17 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

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

17 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

17 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.)

17 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>
17 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

17 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

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

17 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

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

17 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

17 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

17 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

17 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

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

17 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

17 months agoFix def-use dominance check
Tomasz Miąsko [Sun, 22 Jan 2023 00:00:00 +0000 (00:00 +0000)]
Fix def-use dominance check

A definition does not dominate a use in the same statement. For example
in MIR generated for compound assignment x += a (when overflow checks
are disabled).

17 months agoprevious thir unpretty output through thir-flat
b-naber [Thu, 26 Jan 2023 22:35:24 +0000 (23:35 +0100)]
previous thir unpretty output through thir-flat

17 months agoMake make_identity take CanonicalVarInfos
Michael Goulet [Thu, 26 Jan 2023 20:33:34 +0000 (20:33 +0000)]
Make make_identity take CanonicalVarInfos

17 months agoIntern CanonicalVarValues
Michael Goulet [Wed, 25 Jan 2023 18:04:57 +0000 (18:04 +0000)]
Intern CanonicalVarValues

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

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

17 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

17 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

17 months agoadd test
b-naber [Tue, 17 Jan 2023 21:11:18 +0000 (22:11 +0100)]
add test

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

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

17 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

17 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

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

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

17 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

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

17 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

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

17 months agoRollup merge of #106971 - oli-obk:tait_error, r=davidtwco
Matthias Krüger [Thu, 26 Jan 2023 14:02:19 +0000 (15:02 +0100)]
Rollup merge of #106971 - oli-obk:tait_error, r=davidtwco

Handle diagnostics customization on the fluent side (for one specific diagnostic)

r? ```@davidtwco```

17 months agoRollup merge of #106904 - khuey:preserve_debuginfo_for_rlibs, r=davidtwco
Matthias Krüger [Thu, 26 Jan 2023 14:02:19 +0000 (15:02 +0100)]
Rollup merge of #106904 - khuey:preserve_debuginfo_for_rlibs, r=davidtwco

Preserve split DWARF files when building archives.

r? ```@davidtwco```

17 months agoalso document hidden items
Pietro Albini [Thu, 26 Jan 2023 13:13:35 +0000 (14:13 +0100)]
also document hidden items

17 months agorustdoc: Stop using `HirId`s
Vadim Petrochenkov [Thu, 26 Jan 2023 10:30:28 +0000 (14:30 +0400)]
rustdoc: Stop using `HirId`s

Use `LocalDefId`s instead

17 months agoAuto merge of #106745 - m-ou-se:format-args-ast, r=oli-obk
bors [Thu, 26 Jan 2023 12:44:47 +0000 (12:44 +0000)]
Auto merge of #106745 - m-ou-se:format-args-ast, r=oli-obk

Move format_args!() into AST (and expand it during AST lowering)

Implements https://github.com/rust-lang/compiler-team/issues/541

This moves FormatArgs from rustc_builtin_macros to rustc_ast_lowering. For now, the end result is the same. But this allows for future changes to do smarter things with format_args!(). It also allows Clippy to directly access the ast::FormatArgs, making things a lot easier.

This change turns the format args types into lang items. The builtin macro used to refer to them by their path. After this change, the path is no longer relevant, making it easier to make changes in `core`.

This updates clippy to use the new language items, but this doesn't yet make clippy use the ast::FormatArgs structure that's now available. That should be done after this is merged.

17 months agoAuto merge of #106745 - m-ou-se:format-args-ast, r=oli-obk
bors [Thu, 26 Jan 2023 12:44:47 +0000 (12:44 +0000)]
Auto merge of #106745 - m-ou-se:format-args-ast, r=oli-obk

Move format_args!() into AST (and expand it during AST lowering)

Implements https://github.com/rust-lang/compiler-team/issues/541

This moves FormatArgs from rustc_builtin_macros to rustc_ast_lowering. For now, the end result is the same. But this allows for future changes to do smarter things with format_args!(). It also allows Clippy to directly access the ast::FormatArgs, making things a lot easier.

This change turns the format args types into lang items. The builtin macro used to refer to them by their path. After this change, the path is no longer relevant, making it easier to make changes in `core`.

This updates clippy to use the new language items, but this doesn't yet make clippy use the ast::FormatArgs structure that's now available. That should be done after this is merged.

17 months agoDisable ConstGoto opt in cleanup blocks
Jakob Degen [Thu, 26 Jan 2023 11:50:37 +0000 (03:50 -0800)]
Disable ConstGoto opt in cleanup blocks

17 months agoCustom mir: Add support for some remaining, easy to support constructs
Jakob Degen [Thu, 26 Jan 2023 11:29:28 +0000 (03:29 -0800)]
Custom mir: Add support for some remaining, easy to support constructs

17 months agooutput tree representation for thir-tree
b-naber [Tue, 17 Jan 2023 20:13:33 +0000 (21:13 +0100)]
output tree representation for thir-tree

17 months agofix alphabetical sort
Yann Simon [Thu, 26 Jan 2023 10:09:32 +0000 (11:09 +0100)]
fix alphabetical sort

17 months agosolver comments + remove `TyCtxt::evaluate_goal`
lcnr [Thu, 26 Jan 2023 09:57:11 +0000 (10:57 +0100)]
solver comments + remove `TyCtxt::evaluate_goal`

17 months agoremove avx512 prefix for gfni, vaes and vpclmulqdq
Yann Simon [Thu, 26 Jan 2023 10:01:36 +0000 (11:01 +0100)]
remove avx512 prefix for gfni, vaes and vpclmulqdq

17 months agoAuto merge of #107318 - matthiaskrgr:rollup-776kd81, r=matthiaskrgr
bors [Thu, 26 Jan 2023 09:14:05 +0000 (09:14 +0000)]
Auto merge of #107318 - matthiaskrgr:rollup-776kd81, r=matthiaskrgr

Rollup of 9 pull requests

Successful merges:

 - #97373 (impl DispatchFromDyn for Cell and UnsafeCell)
 - #106625 (Remove backwards compat for LLVM 12 coverage format)
 - #106779 (Avoid __cxa_thread_atexit_impl on Emscripten)
 - #106811 (Append .dwp to the binary filename instead of replacing the existing extension.)
 - #106836 (Remove optimistic spinning from `mpsc::SyncSender`)
 - #106946 (implement Hash for proc_macro::LineColumn)
 - #107074 (remove unnecessary check for opaque types)
 - #107287 (Improve fn pointer notes)
 - #107304 (Use `can_eq` to compare types for default assoc type error)

Failed merges:

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

17 months agoRollup merge of #107304 - Nilstrieb:ᐸTy as PartialEqᐳ::eq because what else are we...
Matthias Krüger [Thu, 26 Jan 2023 06:53:26 +0000 (07:53 +0100)]
Rollup merge of #107304 - Nilstrieb:ᐸTy as PartialEqᐳ::eq because what else are we gonna use in rustc_middle, r=compiler-errors

Use `can_eq` to compare types for default assoc type error

This correctly handles inference variables like `{integer}`. I had to move all of this `note_and_explain` code to `rustc_infer`, it made no sense for it to be in `rustc_middle` anyways.

The commits are reviewed separately.

Fixes #106968

17 months agoRollup merge of #107287 - mattjperez:improve-fn-pointer-notes, r=compiler-errors
Matthias Krüger [Thu, 26 Jan 2023 06:53:25 +0000 (07:53 +0100)]
Rollup merge of #107287 - mattjperez:improve-fn-pointer-notes, r=compiler-errors

Improve fn pointer notes

continuation of #105552

r? `@compiler-errors`

17 months agoRollup merge of #107074 - lcnr:validate-dont-skip-opaque, r=compiler-errors
Matthias Krüger [Thu, 26 Jan 2023 06:53:25 +0000 (07:53 +0100)]
Rollup merge of #107074 - lcnr:validate-dont-skip-opaque, r=compiler-errors

remove unnecessary check for opaque types

this isn't needed and may hide some errors.

after analysis there are no opaque types so it's a noop anyways

before analysis there are opaque types but due to `Reveal::UserFacing` we don't reveal them. `is_subtype` simply discards the opaque type constraints as these will get checked again during mir borrowck.

r? types

want to land this after the beta-cutoff as mir validator changes are apparently pretty scary

17 months agoRollup merge of #106946 - dtolnay:hashlinecolumn, r=m-ou-se
Matthias Krüger [Thu, 26 Jan 2023 06:53:24 +0000 (07:53 +0100)]
Rollup merge of #106946 - dtolnay:hashlinecolumn, r=m-ou-se

implement Hash for proc_macro::LineColumn

For use in `HashMap<LineColumn, TokenTree>` or `HashMap<LineColumn, Comment>`, for example.

[Here is an example of one case complicated by the absence of this impl.](https://github.com/andrewbaxter/genemichaels/blob/71bc45e417c3f9dae09f890f1ec4630e758e5c70/src/comments.rs#L25-L34)

Tracking issue: https://github.com/rust-lang/rust/issues/54725

17 months agoRollup merge of #106836 - ibraheemdev:sync-sender-spin, r=Amanieu
Matthias Krüger [Thu, 26 Jan 2023 06:53:23 +0000 (07:53 +0100)]
Rollup merge of #106836 - ibraheemdev:sync-sender-spin, r=Amanieu

Remove optimistic spinning from `mpsc::SyncSender`

Per https://github.com/rust-lang/rust/pull/106701#issuecomment-1381649679.
Closes #106804

r? `@Amanieu`

17 months agoRollup merge of #106811 - khuey:dwp_extension, r=davidtwco
Matthias Krüger [Thu, 26 Jan 2023 06:53:23 +0000 (07:53 +0100)]
Rollup merge of #106811 - khuey:dwp_extension, r=davidtwco

Append .dwp to the binary filename instead of replacing the existing extension.

gdb et al. expect to find the dwp file at `<binary>`.dwp, even if <binary> already has an extension (e.g. libfoo.so's dwp is expected to be at libfoo.so.dwp).

17 months agoRollup merge of #106779 - RReverser:patch-2, r=Mark-Simulacrum
Matthias Krüger [Thu, 26 Jan 2023 06:53:22 +0000 (07:53 +0100)]
Rollup merge of #106779 - RReverser:patch-2, r=Mark-Simulacrum

Avoid __cxa_thread_atexit_impl on Emscripten

 - Fixes https://github.com/rust-lang/rust/issues/91628.
 - Fixes https://github.com/emscripten-core/emscripten/issues/15722.

See discussion in both issues.

The TL;DR is that weak linkage causes LLVM to produce broken Wasm, presumably due to pointer mismatch. The code is casting a void pointer to a function pointer with specific signature, but Wasm is very strict about function pointer compatibility, so the resulting code is invalid.

Ideally LLVM should catch this earlier in the process rather than emit invalid Wasm, but it currently doesn't and this is an easy and valid fix, given that Emcripten doesn't have `__cxa_thread_atexit_impl` these days anyway.

Unfortunately, I can't add a regression test as even after looking into this issue for a long time, I couldn't reproduce it with any minimal Rust example, only with extracted LLVM IR or on a large project involving Rust + C++.

17 months agoRollup merge of #106625 - Swatinem:ref/cov6, r=nagisa
Matthias Krüger [Thu, 26 Jan 2023 06:53:22 +0000 (07:53 +0100)]
Rollup merge of #106625 - Swatinem:ref/cov6, r=nagisa

Remove backwards compat for LLVM 12 coverage format

The minimum external LLVM was updated to 13 recently in https://github.com/rust-lang/rust/pull/100611, so this PR removes backwards compat with older coverage formats.

I kept the version check and error message there, in accordance with this comment: https://github.com/rust-lang/rust/pull/91207#issuecomment-981121867

17 months agoRollup merge of #97373 - dimpolo:cell_dispatch_from_dyn, r=dtolnay
Matthias Krüger [Thu, 26 Jan 2023 06:53:21 +0000 (07:53 +0100)]
Rollup merge of #97373 - dimpolo:cell_dispatch_from_dyn, r=dtolnay

impl DispatchFromDyn for Cell and UnsafeCell

After some fruitful discussion on [Internals](https://internals.rust-lang.org/t/impl-dispatchfromdyn-for-cell-2/16520) here's my first PR to rust-lang/rust 🎉

Please let me know if there's something I missed.

This adds `DispatchFromDyn` impls for `Cell`, `UnsafeCell` and `SyncUnsafeCell`.
An existing test is also expanded to test the `Cell` impl (which requires the `UnsafeCell` impl)

The different `RefCell` types can not implement `DispatchFromDyn` since they have more than one (non ZST) field.

&nbsp;

**Edit:**
### What:
These changes allow one to make types like `MyRc`(code below), to be object safe method receivers after implementing `DispatchFromDyn` and `Deref` for them.

This allows for code like this:
```rust
struct MyRc<T: ?Sized>(Cell<NonNull<RcBox<T>>>);

/* impls for DispatchFromDyn, CoerceUnsized and Deref for MyRc*/

trait Trait {
    fn foo(self: MyRc<Self>);
}

let impls_trait = ...;
let rc = MyRc::new(impls_trait) as MyRc<dyn Trait>;
rc.foo();
```

Note: `Cell` and `UnsafeCell` won't directly become valid method receivers since they don't implement `Deref`. Making use of these changes requires a wrapper type and nightly features.

### Why:
A custom pointer type with interior mutability allows one to store extra information in the pointer itself.
These changes allow for such a type to be a method receiver.

### Examples:
My use case is a cycle aware custom `Rc` implementation that when dropping a cycle marks some references dangling.

On the [forum](https://internals.rust-lang.org/t/impl-dispatchfromdyn-for-cell/14762/8) andersk mentioned that they track if a `Gc` reference is rooted with an extra bit in the reference itself.

17 months agoAuto merge of #107314 - matthiaskrgr:rollup-j40lnlj, r=matthiaskrgr
bors [Thu, 26 Jan 2023 06:23:14 +0000 (06:23 +0000)]
Auto merge of #107314 - matthiaskrgr:rollup-j40lnlj, r=matthiaskrgr

Rollup of 11 pull requests

Successful merges:

 - #106407 (Improve proc macro attribute diagnostics)
 - #106960 (Teach parser to understand fake anonymous enum syntax)
 - #107085 (Custom MIR: Support binary and unary operations)
 - #107086 (Print PID holding bootstrap build lock on Linux)
 - #107175 (Fix escaping inference var ICE in `point_at_expr_source_of_inferred_type`)
 - #107204 (suggest qualifying bare associated constants)
 - #107248 (abi: add AddressSpace field to Primitive::Pointer )
 - #107272 (Implement ObjectSafe and WF in the new solver)
 - #107285 (Implement `Generator` and `Future` in the new solver)
 - #107286 (ICE in new solver if we see an inference variable)
 - #107313 (Add Style Team Triagebot config)

Failed merges:

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

17 months agoUpdate snap from `1.0.1` to `1.1.0`
Chris Denton [Thu, 26 Jan 2023 05:49:37 +0000 (05:49 +0000)]
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

17 months agoRollup merge of #107313 - calebcartwright:style-guide-triagebot, r=joshtriplett
Matthias Krüger [Thu, 26 Jan 2023 05:15:29 +0000 (06:15 +0100)]
Rollup merge of #107313 - calebcartwright:style-guide-triagebot, r=joshtriplett

Add Style Team Triagebot config

17 months agoRollup merge of #107286 - compiler-errors:new-solver-deny-infers, r=lcnr
Matthias Krüger [Thu, 26 Jan 2023 05:15:29 +0000 (06:15 +0100)]
Rollup merge of #107286 - compiler-errors:new-solver-deny-infers, r=lcnr

ICE in new solver if we see an inference variable

By construction, we do not expect to see any `ty::Infer(ty::TyVar(_))` inference types in the solver (we treat this as ambiguous, since we need to be able to structurally resolve the self type at least one layer to assemble candidates for it). Additionally, since we're doing no freshening, we also don't expect to see any fresh vars of any kind in the solver.

Let's make that an ICE so we can catch any mistakes.

When #107282 lands, we should also ICE there too if we see a non-int/float infer.

r? `@lcnr`

17 months agoRollup merge of #107285 - compiler-errors:new-solver-future-and-generator, r=lcnr
Matthias Krüger [Thu, 26 Jan 2023 05:15:28 +0000 (06:15 +0100)]
Rollup merge of #107285 - compiler-errors:new-solver-future-and-generator, r=lcnr

Implement `Generator` and `Future` in the new solver

r? `@lcnr`

17 months agoRollup merge of #107272 - compiler-errors:new-solver-more-predicates, r=lcnr
Matthias Krüger [Thu, 26 Jan 2023 05:15:27 +0000 (06:15 +0100)]
Rollup merge of #107272 - compiler-errors:new-solver-more-predicates, r=lcnr

Implement ObjectSafe and WF in the new solver

r? ``@lcnr``

17 months agoRollup merge of #107248 - erikdesjardins:addrspace, r=oli-obk
Matthias Krüger [Thu, 26 Jan 2023 05:15:27 +0000 (06:15 +0100)]
Rollup merge of #107248 - erikdesjardins:addrspace, r=oli-obk

abi: add AddressSpace field to Primitive::Pointer

...and remove it from `PointeeInfo`, which isn't meant for this.

There are still various places (marked with FIXMEs) that assume all pointers
have the same size and alignment. Fixing this requires parsing non-default
address spaces in the data layout string (and various other changes),
which will be done in a followup.
(That is, if it's actually worth it to support multiple different pointer sizes.
There is a lot of code that would be affected by that.)

Fixes #106367

r? ``@oli-obk``
cc ``@Patryk27``

17 months agoRollup merge of #107204 - euclio:assoc-const-suggestion, r=petrochenkov
Matthias Krüger [Thu, 26 Jan 2023 05:15:26 +0000 (06:15 +0100)]
Rollup merge of #107204 - euclio:assoc-const-suggestion, r=petrochenkov

suggest qualifying bare associated constants

Fixes #107199.

17 months agoRollup merge of #107175 - compiler-errors:bad-types-in-vec-push, r=estebank
Matthias Krüger [Thu, 26 Jan 2023 05:15:26 +0000 (06:15 +0100)]
Rollup merge of #107175 - compiler-errors:bad-types-in-vec-push, r=estebank

Fix escaping inference var ICE in `point_at_expr_source_of_inferred_type`

Fixes #107158

`point_at_expr_source_of_inferred_type` uses `lookup_probe` to adjust the self type of a method receiver -- but that method returns inference variables from inside a probe. That means that the ty vars are no longer valid, so we can't use any infcx methods on them.

Also, pass some extra span info to hack a quick solution to bad labels, resulting in this diagnostic improvement:

```rust
fn example2() {
    let mut x = vec![1];
    x.push("");
}
```

```diff
  error[E0308]: mismatched types
   --> src/main.rs:5:12
    |
  5 |     x.push("");
    |       ---- ^^
    |       |    |
    |       |    expected integer, found `&str`
-   |       |    this is of type `&'static str`, which causes `x` to be inferred as `Vec<{integer}>`
    |       arguments to this method are incorrect
```
(since that "which causes `x` to be inferred as `Vec<{integer}>` part is wrong)

r? `@estebank`

(we really should make this code better in general, cc #106590, but that's a bit bigger issue that needs some more thinking about)

17 months agoRollup merge of #107086 - clubby789:bootstrap-lock-pid-linux, r=albertlarsan68
Matthias Krüger [Thu, 26 Jan 2023 05:15:25 +0000 (06:15 +0100)]
Rollup merge of #107086 - clubby789:bootstrap-lock-pid-linux, r=albertlarsan68

Print PID holding bootstrap build lock on Linux

Partially address #107077

Parse `/proc/locks` to find the PID of the process which created the build directory lock

17 months agoRollup merge of #107085 - tmiasko:custom-mir-operators, r=oli-obk
Matthias Krüger [Thu, 26 Jan 2023 05:15:24 +0000 (06:15 +0100)]
Rollup merge of #107085 - tmiasko:custom-mir-operators, r=oli-obk

Custom MIR: Support binary and unary operations

Lower binary and unary operations directly to corresponding unchecked MIR
operations. Ultimately this might not be syntax we want, but it allows for
experimentation in the meantime.

r? ````@oli-obk```` ````@JakobDegen````

17 months agoRollup merge of #106960 - estebank:parse-anon-enums, r=cjgillot
Matthias Krüger [Thu, 26 Jan 2023 05:15:24 +0000 (06:15 +0100)]
Rollup merge of #106960 - estebank:parse-anon-enums, r=cjgillot

Teach parser to understand fake anonymous enum syntax

Parse `Ty | OtherTy` in function argument and return types.
Parse type ascription in top level patterns.

Minimally address #100741.

17 months agoRollup merge of #106407 - mejrs:attr_check, r=compiler-errors
Matthias Krüger [Thu, 26 Jan 2023 05:15:23 +0000 (06:15 +0100)]
Rollup merge of #106407 - mejrs:attr_check, r=compiler-errors

Improve proc macro attribute diagnostics

Closes https://github.com/rust-lang/rust/issues/102923

17 months agoimprove fn pointer notes
Matthew J Perez [Wed, 25 Jan 2023 17:10:26 +0000 (17:10 +0000)]
improve fn pointer notes

- add note and suggestion for casting both expected and found fn items
  to fn pointers
- add note for casting expected fn item to fn pointer

17 months agoICE in new solver if we see an inference variable
Michael Goulet [Wed, 25 Jan 2023 00:38:34 +0000 (00:38 +0000)]
ICE in new solver if we see an inference variable

17 months agoImplement Generator and Future
Michael Goulet [Tue, 24 Jan 2023 23:38:20 +0000 (23:38 +0000)]
Implement Generator and Future

17 months agoReport the right fulfillment errors
Michael Goulet [Tue, 24 Jan 2023 23:57:26 +0000 (23:57 +0000)]
Report the right fulfillment errors

17 months agoAuto merge of #105582 - saethlin:instcombine-assert-inhabited, r=cjgillot
bors [Thu, 26 Jan 2023 03:10:52 +0000 (03:10 +0000)]
Auto merge of #105582 - saethlin:instcombine-assert-inhabited, r=cjgillot

InstCombine away intrinsic validity assertions

This optimization (currently) fires 246 times on the standard library. It seems to fire hardly at all on the big crates in the benchmark suite. Interesting.

17 months agoadd testcase for #104012
yukang [Thu, 26 Jan 2023 02:52:57 +0000 (10:52 +0800)]
add testcase for #104012

17 months agoadd style team triagebot config
Caleb Cartwright [Thu, 26 Jan 2023 01:58:22 +0000 (19:58 -0600)]
add style team triagebot config

17 months agoAuto merge of #10226 - not-my-profile:module_name_repetitions-span, r=giraffate
bors [Thu, 26 Jan 2023 00:17:52 +0000 (00:17 +0000)]
Auto merge of #10226 - not-my-profile:module_name_repetitions-span, r=giraffate

Improve span for module_name_repetitions

changelog: [`module_name_repetitions`]: Narrowed span to the identifier

17 months agoAuto merge of #107309 - matthiaskrgr:rollup-0wgq6be, r=matthiaskrgr
bors [Wed, 25 Jan 2023 23:39:51 +0000 (23:39 +0000)]
Auto merge of #107309 - matthiaskrgr:rollup-0wgq6be, r=matthiaskrgr

Rollup of 9 pull requests

Successful merges:

 - #105345 (Add hint for missing lifetime bound on trait object when type alias is used)
 - #106897 (Tweak E0597)
 - #106944 (Suggest using a lock for `*Cell: Sync` bounds)
 - #107239 (Bring tests back into rustc source tarball)
 - #107244 (rustdoc: rearrange HTML in primitive reference links)
 - #107255 (add test where we ignore hr implied bounds)
 - #107256 (Delete `SimplifyArmIdentity` and `SimplifyBranchSame` mir opts)
 - #107266 (rustdoc: prohibit scroll bar on source viewer in Safari)
 - #107282 (erica solver: implement builtin `Pointee` trait impl candidates)

Failed merges:

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

17 months agoDon't normalize obligations in WF goal for the new solver
Michael Goulet [Tue, 24 Jan 2023 19:10:56 +0000 (19:10 +0000)]
Don't normalize obligations in WF goal for the new solver

17 months agoImplement ObjectSafe and WF in the new solver
Michael Goulet [Tue, 24 Jan 2023 18:48:15 +0000 (18:48 +0000)]
Implement ObjectSafe and WF in the new solver

17 months agoStabilize the const_socketaddr feature
Linus Färnstrand [Thu, 10 Nov 2022 18:19:39 +0000 (19:19 +0100)]
Stabilize the const_socketaddr feature