Commit Graph

225150 Commits

Author SHA1 Message Date
bors
9af3865dec Auto merge of #110807 - petrochenkov:strictflavor, r=lqd,wesleywiser
linker: Report linker flavors incompatible with the current target

The linker flavor is checked for target compatibility even if linker is never used (e.g. we are producing a rlib).
If it causes trouble, we can move the check to `link.rs` so it will run if the linker (flavor) is actually used.

And also feature gate explicitly specifying linker flavors for tier 3 targets.

The next step is supporting all the internal linker flavors in user-visible interfaces (command line and json).
2023-05-31 22:40:25 +00:00
bors
871b595202 Auto merge of #111913 - oli-obk:valtrees2, r=lcnr
Only rewrite valtree-constants to patterns and keep other constants opaque

Now that we can reliably fall back to comparing constants with `PartialEq::eq` to the match scrutinee, we can

1. eagerly try to convert constants to valtrees
2. then deeply convert the valtree to a pattern
3. if the to-valtree conversion failed, create an "opaque constant" pattern.

This PR specifically avoids any behavioral changes or major cleanups. What we can now do as follow ups is

* move the two remaining call sites to `destructure_mir_constant` off that query
* make valtree to pattern conversion infallible
    * this needs to be done after careful analysis of the effects. There may be user visible changes from that.

based on https://github.com/rust-lang/rust/pull/111768
2023-05-31 16:36:51 +00:00
Oli Scherer
3c02cfc3e7 Explain the reason for why a test exists 2023-05-31 14:07:16 +00:00
Oli Scherer
81b07edde8 Inline from_inline_const into its sole call site 2023-05-31 14:07:16 +00:00
Oli Scherer
c4d5dded57 Explain and simplify valtree -> mir-const fallback 2023-05-31 14:07:16 +00:00
Oli Scherer
9cf7810078 bug! message nit 2023-05-31 14:07:15 +00:00
Oli Scherer
bd4197cbf9 Simplify an if let Some to a ? 2023-05-31 14:07:15 +00:00
Oli Scherer
1722aa79ea Remove some dead code 2023-05-31 14:07:15 +00:00
Oli Scherer
4ca87073f6 Remove lit_to_mir_constant query 2023-05-31 14:07:15 +00:00
Oli Scherer
aa3a1862ba Remove deref_mir_constant 2023-05-31 14:07:15 +00:00
Oli Scherer
d030ece6f7 Only rewrite valtree-constants to patterns and keep other constants opaque 2023-05-31 14:02:57 +00:00
bors
ad8304a0d5 Auto merge of #111076 - notriddle:notriddle/silence-private-dep-trait-impl-suggestions, r=cjgillot
diagnostics: exclude indirect private deps from trait impl suggest

Fixes #88696
2023-05-31 13:47:36 +00:00
bors
e4f7ad8e68 Auto merge of #112132 - matthiaskrgr:rollup-x2l75gf, r=matthiaskrgr
Rollup of 5 pull requests

Successful merges:

 - #111772 (Fix linkage for large binaries on mips64 platforms)
 - #111975 (Stop normalizing so many different prefixes)
 - #111979 (Respect CARGOFLAGS in bootstrap.py)
 - #112089 (Add `--warnings warn` flag to `x.py`)
 - #112103 (Bootstrap update to 1.71 beta)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-05-31 11:03:00 +00:00
Matthias Krüger
2054acb0a4
Rollup merge of #112103 - Mark-Simulacrum:bootstrap-update, r=clubby789
Bootstrap update to 1.71 beta

Best reviewed by-commit.
2023-05-31 11:19:09 +02:00
Matthias Krüger
9e108f8922
Rollup merge of #112089 - Kobzol:bootstrap-warnings, r=jyn514
Add `--warnings warn` flag to `x.py`

So that bootstrap itself can be built with warnings not being treated as errors.

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

r? ```@jyn514```
2023-05-31 11:19:08 +02:00
Matthias Krüger
aee05c74e1
Rollup merge of #111979 - jyn514:cargoflags, r=albertlarsan68
Respect CARGOFLAGS in bootstrap.py

This makes it possible to pass flags to bootstrap itself, for consistency with std/rustc: 04265621f9/src/bootstrap/builder.rs (L1446-L1447)
Like RUSTFLAGS, this doesn't support CARGOFLAGS_BOOTSTRAP: 6674dcda7a/src/bootstrap/bootstrap.py (L883-L884)

I found this useful recently when I wanted to pass `-Zsparse-registry` to an old checkout of the compiler from before it was stabilized in cargo.
2023-05-31 11:19:08 +02:00
Matthias Krüger
ef82bd4b55
Rollup merge of #111975 - jyn514:normalization, r=cjgillot
Stop normalizing so many different prefixes

Previously, we would normalize *all* of
- the absolute path to the repository checkout
- the /rustc/$sha for stage1 (if `remap-debuginfo` was enabled)
- the /rustc/$sha for download-rustc
- the sysroot for download-rustc

Now, we consistently only normalize /rustc/FAKE_PREFIX. Not only is this much simpler, but it also avoids ongoing maintenance for download-rustc and makes it much less likely that tests break by accident.

- Change `tests/ui/track-diagnostics/track6.rs` to use a relative path instead of an absolute one. I am not actually sure why `track_caller` works here, but it does seem to work 🤷

- Pass `-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX` to all suites, not just UI. In particular, mir-opt tests emit /rustc/ paths in their output.

r? ```@cjgillot``` since you reviewed https://github.com/rust-lang/rust/pull/110699 - this is the test that it doesn't regress :)
2023-05-31 11:19:07 +02:00
Matthias Krüger
fd1c0d8585
Rollup merge of #111772 - liushuyu:ubuntu/mips64-linkage, r=jackh726
Fix linkage for large binaries on mips64 platforms

This pull request fixes the linkage for large binaries on mips64 platforms by enabling the `xgot` feature in LLVM.

It is well understood that the generated binary will gain a hefty performance penalty where the external symbol jumps now cost at least three instructions each.

Also, this pull request does not address the same issue on the mips32 counterparts (due to being unable to test the changes thoroughly).

Should fix #52108
2023-05-31 11:19:07 +02:00
bors
e29821ff85 Auto merge of #111623 - BoxyUwU:move_eval_hack, r=compiler-errors
move `super_relate_consts` hack to `normalize_param_env_or_error`

`super_relate_consts` has as hack in it to work around the fact that `normalize_param_env_or_error` is broken. When relating two constants we attempt to evaluate them (aka normalize them). This is not an issue in any way specific to const generics, type aliases also have the same issue as demonstrated in [this code](https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=84b6d3956a2c852a04b60782476b56c9).

Since the hack in `super_relate_consts` only exists to make `normalize_param_env_or_error` emit less errors move it to `normalize_param_env_or_error`. This makes `super_relate_consts` act more like the normal plain structural equality its supposed to and should help ensure that the hack doesnt accidentally affect other situations.

r? `@compiler-errors`
2023-05-31 08:25:28 +00:00
bors
617d3d6d72 Auto merge of #112127 - matthiaskrgr:rollup-77pt893, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #112031 (Migrate  `item_proc_macro` to Askama)
 - #112053 (Remove `-Zcgu-partitioning-strategy`.)
 - #112069 (offset_of: don't require type to be `Sized`)
 - #112084 (enhancements on  build_helper utilization and rustdoc-gui-test)
 - #112096 (Remove array_zip)
 - #112108 (Fix re-export of doc hidden item inside private item not displayed)
 - #112113 (rustdoc: simplify `clean` by removing `FnRetTy`)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-05-31 05:42:26 +00:00
Matthias Krüger
77bbfbcdec
Rollup merge of #112113 - notriddle:notriddle/rm-fnretty, r=GuillaumeGomez
rustdoc: simplify `clean` by removing `FnRetTy`

The default fn ret ty is always unit. Just use that.

Looking back at the time when `FnRetTy` (then called `FunctionRetTy`) was first added to rustdoc, it seems to originally be there because `-> !` was a special form: the never type didn't exist back then.

eb01b17b06 (diff-384affc1b4190940f114f3fcebbf969e7e18657a71ef9001da6b223a036687d9L921-L924)

`DefaultReturn` was later added to rustdoc to mirror a change in HIR, which added a variant for DefaultReturn because it makes `Span` management easier. This isn't needed in rustdoc, since it doesn't carry spans.

3f0cc8011a (diff-384affc1b4190940f114f3fcebbf969e7e18657a71ef9001da6b223a036687d9R1144)
2023-05-31 07:07:03 +02:00
Matthias Krüger
1d643e16c2
Rollup merge of #112108 - GuillaumeGomez:reexport-doc-hidden-private, r=notriddle
Fix re-export of doc hidden item inside private item not displayed

This PR fixes this bug:

```rust
mod private_module {
    #[doc(hidden)]
    pub struct Public;
}

pub use crate::private_module::Public as Foo;
```

`pub use crate::private_module::Public as Foo;` should be visible in the generated doc (and not inlined!) but currently isn't. This PR fixes it.

r? `@notriddle`
2023-05-31 07:07:02 +02:00
Matthias Krüger
88160ab94c
Rollup merge of #112096 - workingjubilee:array-unzip, r=scottmcm
Remove array_zip

`[T; N]::zip` is "eager" but most zips are mapped. This causes poor optimization in generated code. This is a fundamental design issue and "zip" is "prime real estate" in terms of function names, so let's free it up again.

- FCP concluded in https://github.com/rust-lang/rust/issues/80094#issuecomment-1468300057
- Closes https://github.com/rust-lang/rust/issues/80094
- Closes https://github.com/rust-lang/rust/issues/103555

Could use review to make sure we aren't losing any essential codegen tests.
r? `@scottmcm`
2023-05-31 07:07:02 +02:00
Matthias Krüger
183a31be85
Rollup merge of #112084 - ozkanonur:improvements, r=clubby789
enhancements on  build_helper utilization and rustdoc-gui-test

This change provides codebase improvements, resolves `FIXME` in `rustdoc-gui-test` and makes `rustdoc-gui` test able to find local `node_modules` directory outside of the source root.
2023-05-31 07:07:01 +02:00
Matthias Krüger
f5894517ec
Rollup merge of #112069 - clubby789:offset-of-sized-fields, r=WaffleLapkin
offset_of: don't require type to be `Sized`

Fixes #112051

~~The RFC [explicitly forbids](https://rust-lang.github.io/rfcs/3308-offset_of.html#limitations) non-`Sized` types, but it looks like only the fields being recursed into were checked. The sized check also seemed to have been completely missing for tuples~~
2023-05-31 07:07:01 +02:00
Matthias Krüger
7ca941f18e
Rollup merge of #112053 - nnethercote:rm-Zcpu-partitioning-strategy, r=wesleywiser
Remove `-Zcgu-partitioning-strategy`.

This option was introduced three years ago, but it's never been meaningfully used, and `default` is the only acceptable value.

Also, I think the `Partition` trait presents an interface that is too closely tied to the existing strategy and would probably be wrong for other strategies. (My rule of thumb is to not make something generic until there are at least two instances of it, to avoid this kind of problem.)

Also, I don't think providing multiple partitioning strategies to the user is a good idea, because the compiler already has enough obscure knobs.

This commit removes the option, along with the `Partition` trait, and the `Partitioner` and `DefaultPartitioning` types. I left the existing code in `compiler/rustc_monomorphize/src/partitioning/default.rs`, though I could be persuaded that moving it into
`compiler/rustc_monomorphize/src/partitioning/mod.rs` is better.

r? ``@wesleywiser``
2023-05-31 07:07:00 +02:00
Matthias Krüger
fdd62cfe7d
Rollup merge of #112031 - sladyn98:migrate-proc-macro, r=GuillaumeGomez
Migrate  `item_proc_macro` to Askama

This PR migrates `item_proc_macro` to Askama

Refers https://github.com/rust-lang/rust/issues/108868
2023-05-31 07:07:00 +02:00
ScottMcMurray
374f5a8091 Test from_fn autovectorizes 2023-05-30 20:45:40 -07:00
bors
f51fca3af3 Auto merge of #112120 - weihanglo:update-cargo, r=ehuss
Update cargo

17 commits in 64fb38c97ac4d3a327fc9032c862dd28c8833b17..f7b95e31642e09c2b6eabb18ed75007dda6677a0
2023-05-23 18:53:23 +0000 to 2023-05-30 19:25:02 +0000
- chore: detect the channel a PR wants to merge into (rust-lang/cargo#12181)
- refactor: de-depulicate `make_dep_prefix` implementation (rust-lang/cargo#12203)
- Re-enable code_generation test on Windows (rust-lang/cargo#12199)
- docs: add doc comments for git source and friends (rust-lang/cargo#12192)
- test: set retry sleep to 1ms for all tests (rust-lang/cargo#12194)
- fix(add): Reduce the chance we re-format the user's `[features]` table (rust-lang/cargo#12191)
- test(add): Remove expensive test (rust-lang/cargo#12188)
- Add a description of `Cargo.lock` conflicts in the Cargo FAQ (rust-lang/cargo#12185)
- refactor(tests): Reduce cargo-add setup load (rust-lang/cargo#12189)
- Warn when an edition 2021 crate is in a virtual workspace with default resolver (rust-lang/cargo#10910)
- refactor(tests): Reduce cargo-remove setup load (rust-lang/cargo#12184)
- chore: Lexicographically order `-Z` flags (rust-lang/cargo#12182)
- chore(ci): remove temporary fix for rustup 1.24.1 (rust-lang/cargo#12180)
- fix: AIX searches dynamic libraries in `LIBPATH`. (rust-lang/cargo#11968)
- deps: remove unused features from windows-sys (rust-lang/cargo#12176)
- Automatically inherit workspace lints when running cargo new/init (rust-lang/cargo#12174)
- Test that the new `debuginfo` options match between cargo and rustc (rust-lang/cargo#12022)

r? `@ghost`
2023-05-31 03:03:10 +00:00
Boxy
21cf9ea7ed update test to not rely on super_relate_consts hack 2023-05-31 02:14:15 +01:00
Boxy
1e9b69bf3f move hack to normalize_param_env_or_error 2023-05-31 02:14:15 +01:00
bors
e6e4f7ed15 Auto merge of #112070 - lcnr:disjoint-closure-capture-ub, r=oli-obk
change `BorrowKind::Unique` to be a mutating `PlaceContext`

fixes #112056

I believe that `BorrowKind::Unique` is a footgun in general, so I added a FIXME and opened https://github.com/rust-lang/rust/issues/112072. This is a bit too involved for this PR though.
2023-05-31 00:24:39 +00:00
Weihang Lo
6f07116e8a
Update cargo 2023-05-31 00:08:30 +01:00
Weihang Lo
5abff3753a
Explicit set workspace.resolver = "1"
rust-lang/cargo#10910 starts emitting warning if resolver is not set
for 2021 edition package. We want to surpress the warning for now.
2023-05-31 00:08:11 +01:00
Jakub Beránek
023e6c4be3 Add --warnings warn flag to x.py
So that bootstrap itself can be built with warnings not being treated as errors.
2023-05-30 23:38:17 +02:00
bors
9610dfe5a9 Auto merge of #109698 - epage:wtf, r=Amanieu
Allow limited access to `OsStr` bytes

`OsStr` has historically kept its implementation details private out of
concern for locking us into a specific encoding on Windows.

This is an alternative to rust-lang#95290 which proposed specifying the encoding on Windows.  Instead, this
only specifies that for cross-platform code, `OsStr`'s encoding is a superset of UTF-8 and defines
rules for safely interacting with it

At minimum, this can greatly simplify the `os_str_bytes` crate and every
arg parser that interacts with `OsStr` directly (which is most of those
that support invalid UTF-8).

Tracking issue: #111544
2023-05-30 21:26:22 +00:00
Michael Howell
1862fcb1df rustdoc: simplify clean by removing FnRetTy
The default fn ret ty is always unit. Just use that.

Looking back at the time when `FnRetTy` (then called
`FunctionRetTy`) was first added to rustdoc, it seems to originally
be there because `-> !` was a special form: the never type didn't
exist back then.

eb01b17b06 (diff-384affc1b4190940f114f3fcebbf969e7e18657a71ef9001da6b223a036687d9L921-L924)
2023-05-30 12:22:14 -07:00
bors
f0411ffceb Auto merge of #111881 - lcnr:leak-check, r=nikomatsakis,jackh726
refactor and cleanup the leak check, add it to new solver

ended up being a bit more involved than I wanted but is hopefully still easy enough to review as a single PR, can split it into separate ones otherwise.

this can be reviewed commit by commit:
a473d55cdb9284aa2b01282d1b529a2a4d26547b 31a686646534ca006d906ec757ece4e771d6f973 949039c107852a5e36361c08b62821a0613656f5 242917bf5170d9a723c6c8e23e9d9d0c2fa8dc9d ed2b25a7aa28be3184be9e3022c2796a30eaad87 are all pretty straightforward.

03dd83b4c3f4ff27558f5c8ab859bd9f83db1d04 makes it easier to refactor coherence in a later commit, see the commit description, cc `@oli-obk`

4fe311d807a77b6270f384e41689bf5d58f46aec I don't quite remember what we wanted to test here, this definitely doesn't test that the occurs check doesn't cause incorrect errors in coherence, also cc `@oli-obk` here. I may end up writing a new test for this myself later.

5c200d88a91b75bd0875b973150655bd581ef97a is the main refactor of the leak check, changing it to take the `outer_universe` instead of getting it from a snapshot. Using a snapshot requires us to be in a probe which we aren't in the new solver, it also just feels dirty as snapshots don't really have anything to do with universes.

with all of this cfc230d54188d9c7ed867a9a0d1f51be77b485f9 is now kind of trivial.

r? `@nikomatsakis`
2023-05-30 18:48:12 +00:00
Guillaume Gomez
9906504c64 Add regression test for re-export of doc hidden item inside private item not displayed 2023-05-30 20:27:53 +02:00
Guillaume Gomez
5528757ffe Fix re-export of doc hidden item inside private item not displayed 2023-05-30 20:27:53 +02:00
Oli Scherer
7a2f47c271 Remove a hack that has become obsolete after https://github.com/rust-lang/rust/pull/108080 2023-05-30 16:03:24 +00:00
Oli Scherer
e40b51da63 Get lit_to_const in sync with const_to_valtree_inner
Without this, we'd have a discrepancy where float literals are not lowered to valtrees, but float constants are.
2023-05-30 16:03:24 +00:00
Oli Scherer
f8b5e0064b Lower the tracing level of some very verbose messages 2023-05-30 16:03:24 +00:00
bors
a9251b6ce1 Auto merge of #112102 - Nilstrieb:rollup-ivu1hmc, r=Nilstrieb
Rollup of 7 pull requests

Successful merges:

 - #107916 (fix comment on Allocator trait)
 - #111543 (Uplift `clippy::invalid_utf8_in_unchecked` lint)
 - #111872 (fix: dedup `static_candidates` before report)
 - #111955 (bootstrap: Various Step refactors)
 - #112060 (`EarlyBinder::new` -> `EarlyBinder::bind`)
 - #112064 (Migrate GUI colors test to original CSS color format)
 - #112100 (Don't typecheck recovered method call from suggestion)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-05-30 13:25:42 +00:00
Mark Rousskov
42e757192d Bump to latest beta compiler 2023-05-30 08:00:10 -04:00
Mark Rousskov
4f9b394c8a Swap out CURRENT_RUSTC_VERSION to 1.71.0 2023-05-30 07:54:29 -04:00
lcnr
0b81f992e9 update universe used by the leak check 2023-05-30 13:04:27 +02:00
lcnr
dccc8db17d coinductive cycle leak check test 2023-05-30 13:04:27 +02:00
lcnr
5119f7da18 directory size limit :< 2023-05-30 13:04:25 +02:00
lcnr
6f9041bd15 add the leak check to the new solver 2023-05-30 13:03:40 +02:00