Commit Graph

234359 Commits

Author SHA1 Message Date
yukang
42a033affa Cleanup unused messages in ftl files 2023-09-20 19:09:01 +08:00
bors
62d9034a0d Auto merge of #115995 - matthiaskrgr:rollup-jukbrvq, r=matthiaskrgr
Rollup of 3 pull requests

Successful merges:

 - #115965 (Add more if let guard tests)
 - #115978 (Copy 1.72.1 release notes to master)
 - #115983 (fix confusing let chain indentation in rustc_resolve)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-09-20 08:03:12 +00:00
Matthias Krüger
af36ab1a8e
Rollup merge of #115983 - eopb:confusing-if-chain-indent, r=compiler-errors
fix confusing let chain indentation in rustc_resolve

Sorry for opening a PR for such a minor style fix.
This just felt sufficiently misleading to warrant fixing.
2023-09-20 09:24:31 +02:00
Matthias Krüger
24fc098413
Rollup merge of #115978 - sksat:copy-1.72.1-release-note-to-master, r=Mark-Simulacrum
Copy 1.72.1 release notes to master

- #115976
- this cherry-pick 1.72.1 release note from #115787(0414f85177)
2023-09-20 09:24:30 +02:00
Matthias Krüger
3304ea4218
Rollup merge of #115965 - matthewjasper:extra-if-let-guard-tests, r=compiler-errors
Add more if let guard tests

cc #51114
2023-09-20 09:24:30 +02:00
bors
0e11725809 Auto merge of #115734 - tmiasko:kcfi-no-core, r=compiler-errors
Use no_core for KCFI tests to exercise them in CI
2023-09-20 05:24:34 +00:00
bors
4b91288484 Auto merge of #115486 - compiler-errors:dont-capture-late-pls, r=cjgillot
Correctly deny late-bound lifetimes from parent in anon consts and TAITs

Reuse the `AnonConstBoundary` scope (introduced in #108553, renamed in this PR to `LateBoundary`) to deny late-bound vars of *all* kinds (ty/const/lifetime) in anon consts and TAITs.

Side-note, but I would like to consolidate this with the error reporting for RPITs (E0657):
c4f25777a0/compiler/rustc_hir_analysis/src/collect/resolve_bound_vars.rs (L733-L754) but the semantics about what we're allowed to capture there are slightly different, so I'm leaving that untouched.

Fixes #115474
2023-09-20 03:34:51 +00:00
bors
793d5eafc3 Auto merge of #115959 - nikic:update-llvm-13, r=cuviper
Update to LLVM 17.0.0

This rebases our LLVM fork to 17.0.0.

Fixes #115681.
2023-09-20 01:44:55 +00:00
bors
3b9e0feff4 Auto merge of #114443 - tgross35:cstr-len, r=dtolnay
Implement `cstr_count_bytes`

This has not yet been approved via ACP, but it's simple enough to get started on.

- ACP: https://github.com/rust-lang/libs-team/issues/256
- Tracking issue: https://github.com/rust-lang/rust/issues/114441

`@rustbot` label +T-libs-api
2023-09-20 00:02:45 +00:00
Mark Rousskov
ed3c63cbec
copy 1.72.1 release notes to master
update release date to actual released date
2023-09-20 08:38:56 +09:00
bors
bdb0fa3ee5 Auto merge of #113955 - cjgillot:name-apit, r=WaffleLapkin
Pretty-print argument-position impl trait to name it.

This removes a corner case.

RPIT and TAIT keep having no name, and it would be wrong to use the one in HIR (Ident::empty), so I make this case ICE.
2023-09-19 21:23:39 +00:00
Ethan Brierley
2243872c26 fix confusing let chain indentation in rustc_resolve 2023-09-19 21:21:01 +01:00
bors
ac5ac4754a Auto merge of #115979 - GuillaumeGomez:rollup-06ujzgh, r=GuillaumeGomez
Rollup of 6 pull requests

Successful merges:

 - #113383 (style-guide: Add section on bugs, and resolving bugs)
 - #115499 (rustc_target/riscv: Fix passing of transparent unions with only one non-ZST member)
 - #115801 (Detect cycle errors hidden by opaques during monomorphization)
 - #115947 (Custom code classes in docs warning)
 - #115957 (fix mismatched symbols)
 - #115958 (explain mysterious addition in float minimum/maximum)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-09-19 18:52:10 +00:00
Guillaume Gomez
1b862186a7
Rollup merge of #115958 - RalfJung:mystery-plus, r=Mark-Simulacrum,notriddle
explain mysterious addition in float minimum/maximum

Thanks to `@programmerjake` for mentioning this.
2023-09-19 20:23:21 +02:00
Guillaume Gomez
c5f215af33
Rollup merge of #115957 - cuishuang:master, r=GuillaumeGomez
fix mismatched symbols
2023-09-19 20:23:20 +02:00
Guillaume Gomez
52a0d136f5
Rollup merge of #115947 - GuillaumeGomez:custom_code_classes_in_docs-warning, r=notriddle
Custom code classes in docs warning

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

This PR does two things:
 1. Unless the `custom_code_classes_in_docs` feature is enabled, it will use the old codeblock tag parser.
 2. If there is a codeblock tag that starts with a `.`, it will emit a behaviour change warning.

Hopefully this is the last missing part for this feature until stabilization.

Follow-up of https://github.com/rust-lang/rust/pull/110800.

r? `@notriddle`
2023-09-19 20:23:20 +02:00
Guillaume Gomez
0060db74f9
Rollup merge of #115801 - compiler-errors:async-cycle-mono, r=oli-obk
Detect cycle errors hidden by opaques during monomorphization

Opaque types may reveal to projections, which themselves normalize to opaques. We don't currently normalize when checking that opaques are cyclical, and we may also not know that the opaque is cyclical until monomorphization (see `tests/ui/type-alias-impl-trait/mututally-recursive-overflow.rs`).

Detect cycle errors in `normalize_projection_ty` and report a fatal overflow (in the old solver). Luckily, this is already detected as a fatal overflow in the new solver.

Fixes #112047
2023-09-19 20:23:19 +02:00
Guillaume Gomez
edd7be59da
Rollup merge of #115499 - msizanoen1:riscv-fix-transparent-union-abi, r=bjorn3
rustc_target/riscv: Fix passing of transparent unions with only one non-ZST member

This ensures that `MaybeUninit<T>` has the same ABI as `T` when passed through an `extern "C"` function.

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

r? `@RalfJung`
2023-09-19 20:23:19 +02:00
Guillaume Gomez
7a27acfdbb
Rollup merge of #113383 - joshtriplett:style-bugs, r=compiler-errors
style-guide: Add section on bugs, and resolving bugs
2023-09-19 20:23:18 +02:00
Ralf Jung
028c78c6c7 explain mysterious addition in float minimum/maximum 2023-09-19 20:13:04 +02:00
bors
42f5828b01 Auto merge of #115627 - compiler-errors:icedump-no-std, r=m-ou-se
Don't modify libstd to dump rustc ICEs

Do a much simpler thing and just dump a `std::backtrace::Backtrace` to file.

r? `@estebank` `@oli-obk`

Fixes #115610
2023-09-19 16:56:25 +00:00
Guillaume Gomez
295ec09b63 Update tests for custom classes 2023-09-19 17:29:39 +02:00
Guillaume Gomez
6bed1c6061 Allow more characters in custom classes 2023-09-19 17:29:30 +02:00
bors
0692db1a90 Auto merge of #115865 - RalfJung:mir-mod, r=oli-obk
move things out of mir/mod.rs

This moves a bunch of things out of `mir/mod.rs`:
- all const-related stuff to a new file consts.rs
- all statement/place/operand-related stuff to a new file statement.rs
- all pretty-printing related stuff to pretty.rs

`mod.rs` started out with 3100 lines and ends up with 1600. :)

Also there was some pretty-printing stuff in terminator.rs, that also got moved to pretty.rs, and I reordered things in pretty.rs so that it can be grouped by functionality.

Only the commit "use pretty_print_const_value from MIR constant 'extra' printing" has any behavior changes; it resolves the issue of having a fancy and a very crude pretty-printer for `ConstValue`.

r? `@oli-obk`
2023-09-19 13:22:48 +00:00
Matthew Jasper
b49140295c Add more if let guard tests 2023-09-19 12:48:40 +00:00
Guillaume Gomez
88b070aa92 Return early in check_custom_code_classes check if the feature is enabled 2023-09-19 13:20:18 +02:00
Guillaume Gomez
494fdcd8ec Add new rustdoc-ui test for custom_code_classes_in_docs feature 2023-09-19 13:19:15 +02:00
bors
8769c26989 Auto merge of #115960 - GuillaumeGomez:rollup-8tky3qu, r=GuillaumeGomez
Rollup of 6 pull requests

Successful merges:

 - #112725 (rustdoc-search: add support for type parameters)
 - #114941 (Don't resolve generic impls that may be shadowed by dyn built-in impls)
 - #115625 (Explain HRTB + infer limitations of old solver)
 - #115839 (Bump libc to 0.2.148)
 - #115924 (Don't complain on a single non-exhaustive 1-ZST)
 - #115946 (panic when encountering an illegal cpumask in thread::available_parallelism)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-09-19 11:18:06 +00:00
msizanoen
4d4c13bbd6 tests/ui/abi: Enable repr(transparent) union ABI tests on RISC-V 2023-09-19 12:22:45 +02:00
msizanoen
751ecde064 rustc_target/riscv: Fix passing of transparent unions with only one non-ZST member
This ensures that `MaybeUninit<T>` has the same ABI as `T` when passed
through an `extern "C"` function.

Fixes https://github.com/rust-lang/rust/issues/115481.
2023-09-19 12:06:33 +02:00
cui fliter
0944860f35 fix mismatched symbols
Signed-off-by: cui fliter <imcusg@gmail.com>
2023-09-19 18:01:32 +08:00
Guillaume Gomez
57f1f91a9c
Rollup merge of #115946 - the8472:panic-on-sched_getaffinity-bug, r=Mark-Simulacrum
panic when encountering an illegal cpumask in thread::available_parallelism

Fixes #115868 by panicking instead of returning an invalid `NonZeroUsize`
2023-09-19 11:35:52 +02:00
Guillaume Gomez
f1edecfaab
Rollup merge of #115924 - compiler-errors:non-exhaustive-1-zst, r=RalfJung
Don't complain on a single non-exhaustive 1-ZST

r? RalfJung, though you mentioned being busy, so feel free to reassign.

This doesn't actually attempt to make the diagnostic better, so when we have two non-exhaustive 1-ZSTs in a struct, we still just point to one. 🤷

Fixes #115922
2023-09-19 11:35:51 +02:00
Guillaume Gomez
6cfc6a8705
Rollup merge of #115839 - Dirreke:bump-libc, r=dtolnay
Bump libc to 0.2.148
2023-09-19 11:35:51 +02:00
Guillaume Gomez
c452090597
Rollup merge of #115625 - compiler-errors:hrtb-infer-err, r=b-naber
Explain HRTB + infer limitations of old solver

Add a helpful message when we hit the limitation of the old trait solver where we don't properly normalize GATs with infer vars + bound vars, leading to too-eagerly reporting trait errors that would be later satisfied due to inference.
2023-09-19 11:35:50 +02:00
Guillaume Gomez
66b7bdf279
Rollup merge of #114941 - compiler-errors:inline-shadowed-by-dyn, r=lcnr
Don't resolve generic impls that may be shadowed by dyn built-in impls

**NOTE:** This is a hack. This is not trying to be a general fix for the issue that we've allowed overlapping built-in trait object impls and user-written impls for quite a long time, and traits like `Any` rely on this (#57893) -- this PR specifically aims to mitigate a new unsoundness that is uncovered by the MIR inliner (#114928) that interacts with this pre-existing issue.

Builtin `dyn Trait` impls may overlap with user-provided blanket impls (`impl<T: ?Sized> Trait for T`) in generic contexts. This leads to bugs when instances are resolved in polymorphic contexts, since we typically prefer object candidates over impl candidates.

This PR implements a (hacky) heuristic to `resolve_associated_item` to account for that unfortunate hole in the type system -- we now bail with ambiguity if we try to resolve a non-rigid instance whose self type is not known to be sized. This makes sure we can still inline instances like `impl<T: Sized> Trait for T`, which can never overlap with `dyn Trait`'s built-in impl, but we avoid inlining an impl that may be shadowed by a `dyn Trait`.

Fixes #114928
2023-09-19 11:35:50 +02:00
Guillaume Gomez
3f68468bc6
Rollup merge of #112725 - notriddle:notriddle/advanced-search, r=GuillaumeGomez
rustdoc-search: add support for type parameters

r? `@GuillaumeGomez`

## Preview

* https://notriddle.com/rustdoc-html-demo-4/advanced-search/rustdoc/read-documentation/search.html
* https://notriddle.com/rustdoc-html-demo-4/advanced-search/std/index.html?search=option%3Coption%3CT%3E%3E%20-%3E%20option%3CT%3E
* https://notriddle.com/rustdoc-html-demo-4/advanced-search/std/index.html?search=option%3CT%3E,%20E%20-%3E%20result%3CT,%20E%3E
* https://notriddle.com/rustdoc-html-demo-4/advanced-search/std/index.html?search=-%3E%20option%3CT%3E

## Description

When writing a type-driven search query in rustdoc, specifically one with more than one query element, non-existent types become generic parameters instead of auto-correcting (which is currently only done for single-element queries) or giving no result. You can also force a generic type parameter by writing `generic:T` (and can force it to not use a generic type parameter with something like `struct:T` or whatever, though if this happens it means the thing you're looking for doesn't exist and will give you no results).

There is no syntax provided for specifying type constraints for generic type parameters.

When you have a generic type parameter in a search query, it will only match up with generic type parameters in the actual function, not concrete types that match, not concrete types that implement a trait. It also strictly matches based on when they're the same or different, so `option<T>, option<U> -> option<U>` matches `Option::and`, but not `Option::or`. Similarly, `option<T>, option<T> -> option<T>` matches `Option::or`, but not `Option::and`.

## Motivation

This feature is motivated by the many "combinitor"-type functions found in generic libraries, such as Option, Future, Iterator, and Entry. These highly-generic functions have names that are almost completely arbitrary, and a type signature that tells you what it actually does.

This PR is a major step towards[^closure] being able to easily search for generic functions by their type signature instead of by name. Some examples of combinators that can be found using this PR (try them out in the preview):

* `option<option<T>> -> option<T>` returns Option::flatten
* `option<T> -> result<T>` returns Option::ok_or
* `option<result<T>> -> result<option<T>>` returns Option::transpose
* `entry<K, V>, FnOnce -> V` returns `Entry::or_insert_with` (and `or_insert_with_key`, since there's no way to specify the generics on FnOnce)

[^closure]:

    For this feature to be as useful as it ought to be, you should be able to search for *trait-associated types* and *closures*. This PR does not implement either of these: they are **Future possibilities**.

    Trait-associated types would allow queries like `option<T> -> iterator<item=T>` to return `Option::iter`. We should also allow `option<T> -> iterator<T>` to match the associated type version.

    Closures would make a good way to query for things like `Option::map`. Closure support needs associated types to be represented in the search index, since `FnOnce() -> i32` desugars to `FnOnce<Output=i32, ()>`, so associated trait types should be implemented first. Also, we'd want to expose an easy way to query closures without specifying which of the three traits you want.
2023-09-19 11:35:49 +02:00
Nikita Popov
531830cecd Update to LLVM 17.0.0
This rebases our LLVM fork to 17.0.0.

Fixes #115681.
2023-09-19 11:14:35 +02:00
Ralf Jung
d14e601661 comment on the difference between mir::ConstantKind::Unevaluated and mir::ConstantKind::Ty(ty::ConstKind::Unevaluated) 2023-09-19 11:11:03 +02:00
Ralf Jung
5a0a1ff0cd move ConstValue into mir
this way we have mir::ConstValue and ty::ValTree as reasonably parallel
2023-09-19 11:11:02 +02:00
Ralf Jung
be8f5f6e7f organize mir pretty.rs and move more things into it; move statement-related things out of mir/mod.rs 2023-09-19 11:06:32 +02:00
Ralf Jung
57444cf9f3 use pretty_print_const_value from MIR constant 'extra' printing 2023-09-19 11:06:32 +02:00
Ralf Jung
10a822be38 move some MIR const pretty-printing into pretty.rs 2023-09-19 11:06:32 +02:00
Ralf Jung
49f5b17cdb more MIR const types to separate file 2023-09-19 11:06:27 +02:00
bors
ae9c330629 Auto merge of #104101 - betrusted-io:xous-libstd-initial, r=bjorn3
Add initial libstd support for Xous

This patchset adds some minimal support to the tier-3 target `riscv32imac-unknown-xous-elf`. The following features are supported:

* alloc
* thread creation and joining
* thread sleeping
* thread_local
* panic_abort
* mutex
* condvar
* stdout

Additionally, internal support for the various Xous primitives surrounding IPC have been added as part of the Xous FFI. These may be exposed as part of `std::os::xous::ffi` in the future, however for now they are not public.

This represents the minimum viable product. A future patchset will add support for networking and filesystem support.
2023-09-19 07:38:20 +00:00
Michael Goulet
fd36553aa7 Don't complain on a single non-exhaustive 1-zst 2023-09-19 06:01:24 +00:00
Michael Goulet
a30ad3a5a6 Don't resolve generic instances if they may be shadowed by dyn 2023-09-19 05:42:23 +00:00
Michael Goulet
976d377f7f Explain HRTB + infer limitations of old solver 2023-09-19 05:14:14 +00:00
Michael Goulet
55ce976e06 Failing test 2023-09-19 04:55:51 +00:00
bors
af78bae565 Auto merge of #115289 - compiler-errors:adjust-comments, r=estebank
Add some needed comments in `adjust_fulfillment_errors.rs`

r? `@estebank`
2023-09-19 03:52:48 +00:00