Commit Graph

15849 Commits

Author SHA1 Message Date
est31
ca16a8d76c Change fluent_messages macro to expect _ slugs instead of - slugs
For the most part, the macro actually worked with _ slugs, but the prefix_something -> prefix::something
conversion was not implemented.

We don't want to accept - slugs for consistency reasons.
We thus error if a name is found with - inside.
This ensures a consistent style.
2022-08-12 22:26:08 +02:00
est31
6c4fc85f9c Update rustdoc to new slug style 2022-08-12 22:22:55 +02:00
est31
cc6cff564f Replace - with _ in ftl slugs for better grepability
Having to replace - with _ (and vice versa) makes the slugs less greppable
and thus constitutes a contributor roadblock.

Result of running this repeatedly up until reaching a fixpoint:

find compiler/rustc_error_messages/locales/en-US/ -type f -exec sed -i 's/\(.+\)-\(.*\)=/\1_\2=/' {} \;

Plus some fixes to update usages of slugs leading with -.
2022-08-12 22:22:55 +02:00
bors
f22819bcce Auto merge of #100456 - Dylan-DPC:rollup-fn17z9f, r=Dylan-DPC
Rollup of 9 pull requests

Successful merges:

 - #100022 (Optimize thread ID generation)
 - #100030 (cleanup code w/ pointers in std a little)
 - #100229 (add -Zextra-const-ub-checks to enable more UB checking in const-eval)
 - #100247 (Generalize trait object generic param check to aliases.)
 - #100255 (Adding more verbose documentation for `std::fmt::Write`)
 - #100366 (errors: don't fail on broken primary translations)
 - #100396 (Suggest const and static for global variable)
 - #100409 (rustdoc: don't generate DOM element for operator)
 - #100443 (Add two let else regression tests)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-08-12 16:32:24 +00:00
Dylan DPC
9914c96f06
Rollup merge of #100396 - chenyukang:fix-100394, r=petrochenkov
Suggest const and static for global variable

Fixing #100394
2022-08-12 20:39:16 +05:30
Dylan DPC
9e69dbce19
Rollup merge of #100366 - davidtwco:translation-never-fail, r=compiler-errors
errors: don't fail on broken primary translations

If a primary bundle doesn't contain a message then the fallback bundle is used. However, if the primary bundle's message is broken (e.g. it refers to a interpolated variable that the compiler isn't providing) then this would just result in a compiler panic. While there aren't any primary bundles right now, this is the type of issue that could come up once translation is further along.

r? ```@compiler-errors``` (since this comes out of a in-person discussion we had at RustConf)
2022-08-12 20:39:14 +05:30
Dylan DPC
caac670a16
Rollup merge of #100247 - cjgillot:verify-dyn-trait-alias-defaults, r=lcnr
Generalize trait object generic param check to aliases.

The current algorithm only checks that `Self` does not appear in defaults for traits.  This is not sufficient for trait aliases.
This PR moves the check to trait object elaboration, which sees through trait aliases.

Fixes https://github.com/rust-lang/rust/issues/82927.
Fixes https://github.com/rust-lang/rust/issues/84789.
2022-08-12 20:39:12 +05:30
Dylan DPC
392ba5f111
Rollup merge of #100229 - RalfJung:extra-const-ub-checks, r=lcnr
add -Zextra-const-ub-checks to enable more UB checking in const-eval

Cc https://github.com/rust-lang/rust/issues/99923
r? `@oli-obk`
2022-08-12 20:39:11 +05:30
bors
0068b8bf4b Auto merge of #100328 - davidtwco:perf-implications, r=nnethercote
passes: load `defined_lib_features` query less

Hopefully addresses the perf regressions from #99212 (see #99905).

Re-structure the stability checks for library features to avoid calling `defined_lib_features` for any more crates than necessary for each of the implications or local feature attributes that need validation.

r? `@ghost` (just checking perf at first)
2022-08-12 13:51:26 +00:00
bors
e2b52ff73e Auto merge of #99464 - nikic:llvm-15, r=cuviper
Update to LLVM 15

For preliminary testing. Some LLVM 15 compatibility fixes were applied separately in #99512.

Release timeline:
 * LLVM 15 branched on Jul 26.
 * The final LLVM 15.0.0 release is scheduled for Sep 6.
 * Current nightly (1.65.0) is scheduled for Nov 3.

Changes in this PR (apart from the LLVM update):
 * Pass `--set llvm.allow-old-toolchain` for many Docker images. LLVM 16 will require GCC >= 7.1, while LLVM 15 still allows older compilers with an option. Specify the option for builders still using GCC 5.4. #95026 updated some of the used toolchains, but not all.
 * Use the `+atomics-32` target feature for thumbv6m.
 * Explicitly link libatomic when cross-compiling LLVM to 32-bit target.
 * Explicitly disable zstd support, to avoid libzstd.so dependency.

New LLVM patches ([commits](https://github.com/rust-lang/llvm-project/commits/rustc/15.0-2022-08-09)):
 * [rust-only] Fix ICE with GCC 5.4 (15be58d7f0)
 * [rust-only] Fix build with GCC 5.4 (774edc10fa)
 * ~~[rust-only] Fix build with GCC 5.2 (1a6069a7bb)~~
 * ~~[rust-only] Fix ICE with GCC 5.2 (493081f290)~~
 * ~~[rust-only] Fix build with GCC 5.2 (0fc5979d73)~~
 * [backported] Addition of `+atomics` target feature (57bdd9892d).
 * [backported] Revert compiler-rt change that broke powerpc (9c68b43915)
 * [awaiting backport] Fix RelLookupTableConverter on gnux32 (639388a05f / https://github.com/llvm/llvm-project/issues/57021)

Tested images: dist-x86_64-linux, armhf-gnu, arm-android, dist-s390x-linux, dist-x86_64-illumos, dist-x86_64-freebsd, wasm32, dist-x86_64-musl, dist-various-1, dist-riscv64-linux, dist-mips-linux, dist-mipsel-linux, dist-powerpc-linux, dist-aarch64-linux, dist-x86_64-apple, x86_64-msvc-1, x86_64-msvc-2, dist-various-2, dist-arm-linux
Tested up to the usual ipv6 error: test-various, i686-gnu, x86_64-gnu-nopt

r? `@ghost`
2022-08-12 02:58:51 +00:00
Matthias Krüger
8237efc52d
Rollup merge of #100392 - nnethercote:simplify-visitors, r=cjgillot
Simplify visitors

By removing some unused arguments.

r? `@cjgillot`
2022-08-11 22:53:08 +02:00
Matthias Krüger
6ae0414122
Rollup merge of #100350 - jhpratt:stringify-vis, r=cjgillot
Stringify non-shorthand visibility correctly

This makes `stringify!(pub(in crate))` evaluate to `pub(in crate)` rather than `pub(crate)`, matching the behavior before the `crate` shorthand was removed. Further, this changes `stringify!(pub(in super))` to evaluate to `pub(in super)` rather than the current `pub(super)`. If the latter is not desired (it is _technically_ breaking), it can be undone.

Fixes #99981

`@rustbot` label +C-bug +regression-from-stable-to-beta +T-compiler
2022-08-11 22:53:06 +02:00
Matthias Krüger
e221aafae6
Rollup merge of #100307 - nnethercote:fix-96847, r=cjgillot
Fix #96847

r? `@petrochenkov`
2022-08-11 22:53:05 +02:00
Matthias Krüger
92b32e307c
Rollup merge of #99500 - tmandry:fuchsia-flags, r=petrochenkov
Fix flags when using clang as linker for Fuchsia

Don't add C runtime or set dynamic linker when linking with clang for
Fuchsia. Clang already does this for us.
2022-08-11 22:52:59 +02:00
Matthias Krüger
6737549aaf
Rollup merge of #99421 - Bryanskiy:android-crt-static, r=petrochenkov
add crt-static for android
2022-08-11 22:52:58 +02:00
Dylan DPC
7ecc8923db
Rollup merge of #100398 - nnethercote:improve-Zhir-stats, r=michaelwoerister
Improve `-Zhir-stats`

Add testing, improve coverage, avoid some double counting, and add more detail.

r? `@michaelwoerister`
2022-08-11 22:47:06 +05:30
Dylan DPC
bc0f9e39f4
Rollup merge of #100391 - nnethercote:improve-size-assertions, r=lqd
Improve size assertions

r? `@lqd`
2022-08-11 22:47:05 +05:30
Dylan DPC
b5f5bdce87
Rollup merge of #100351 - compiler-errors:diagnostic-convention, r=fee1-dead
Use `&mut Diagnostic` instead of `&mut DiagnosticBuilder` unless needed

This seems to be the established convention (02ff9e0) when `DiagnosticBuilder` was first added. I am guilty of introducing some of these.
2022-08-11 22:47:03 +05:30
Dylan DPC
1c43cabdfe
Rollup merge of #100232 - cjgillot:no-desugar-methodcall, r=nagisa
Do not consider method call receiver as an argument in AST.

Fixes https://github.com/rust-lang/rust/issues/73663
2022-08-11 22:47:01 +05:30
Dylan DPC
32bd147f79
Rollup merge of #100192 - tmiasko:rm-duplicated-locals, r=nagisa
Remove duplicated temporaries creating during box derefs elaboration

Temporaries created with `MirPatch::new_temp` will be declared after
patch application. Remove manually created duplicate declarations.

Removing duplicates exposes another issue. Visitor elaborates
terminator twice and attempts to access new, but not yet available,
local declarations. Remove duplicated call to `visit_terminator`.

Extracted from #99946.
2022-08-11 22:46:59 +05:30
Dylan DPC
d749914f79
Rollup merge of #100184 - Kixunil:stabilize_ptr_const_cast, r=m-ou-se
Stabilize ptr_const_cast

This stabilizes `ptr_const_cast` feature as was decided in a recent
[FCP](https://github.com/rust-lang/rust/issues/92675#issuecomment-1190660233)

Closes #92675
2022-08-11 22:46:58 +05:30
Dylan DPC
561ea0a746
Rollup merge of #99110 - audunhalland:match_has_guard_from_candidate, r=pnkfelix
Determine match_has_guard from candidates instead of looking up thir table again

Currently looking through mir build of matches because of interest in deref patterns. Finding some micro-optimizable things.
2022-08-11 22:46:57 +05:30
Dylan DPC
dfddc2f918
Rollup merge of #92744 - lambinoo:I-91161-non-exhaustive-foreign-variants, r=scottmcm
Check if enum from foreign crate has any non exhaustive variants when attempting a cast

Fixes #91161

As stated in the issue, this will require a crater run as it might break other people's stuff.
2022-08-11 22:46:56 +05:30
chenyukang
98518c2379 suggest const or static for global variable 2022-08-11 23:15:39 +08:00
Nicholas Nethercote
ce78042a42 Avoid lowering a MacArgs::Eq twice.
Fixes #96847.
2022-08-11 21:06:40 +10:00
bors
aeb5067967 Auto merge of #100315 - compiler-errors:norm-ct-in-proj, r=lcnr
Keep going if normalized projection has unevaluated consts in `QueryNormalizer`

#100312 was the wrong approach, I think this is the right one.

When normalizing a type, if we see that it's a projection, we currently defer to `tcx.normalize_projection_ty`, which normalizes the projections away but doesn't touch the unevaluated constants. So now we just continue to fold the type if it has unevaluated constants so we make sure to evaluate those too, if we can.

Fixes #100217
Fixes #83972
Fixes #84669
Fixes #86710
Fixes #82268
Fixes #73298
2022-08-11 10:47:48 +00:00
Nicholas Nethercote
4f8a1702ba Add a second level to the AST size reporting.
This tells you which variants of the enums are most common, which is
very useful. I've only done it for the AST for now, HIR can be done
later.
2022-08-11 20:46:41 +10:00
Nicholas Nethercote
85c749266d Add percentages to -Zhir-stats output. 2022-08-11 13:46:26 +10:00
Nicholas Nethercote
6a3c663cbb Change how AssocItem is reported.
Currently it's reported as either `TraitItem` or `ImplItem`. This commit
changes it to `AssocItem`, because having the report match the type name
is (a) consistent with other types, and (b) the trait/impl split isn't
that important here.
2022-08-11 12:46:55 +10:00
Nicholas Nethercote
288b6672be Improve AST stat collector.
This commit:
- Adds a comment explaining which `visit_*` methods should be
  implemented.
- Adds and removes some `visit_*` methods accordingly, improving
  coverage, and avoiding some double counting.
2022-08-11 12:46:49 +10:00
Nicholas Nethercote
b8b851f42e Simplify rustc_hir::intravisit::Visitor::visit_enum_def.
It is passed an argument that is never used.
2022-08-11 11:10:03 +10:00
Nicholas Nethercote
232bd80130 Simplify rustc_ast::visit::Visitor::visit_poly_trait_ref.
It is passed an argument that is never used.
2022-08-11 11:10:01 +10:00
Nicholas Nethercote
421125f30a Simplify rustc_ast::visit::Visitor::visit_enum_def.
It's passed three arguments that are never used.
2022-08-11 10:54:01 +10:00
Nicholas Nethercote
8c5303898e Simplify rustc_hir::intravisit::Visitor::visit_variant_data.
It has four arguments that are never used. This avoids lots of argument
passing in functions that feed into `visit_variant_data`.
2022-08-11 10:54:01 +10:00
Tyler Mandry
55d5dcb1aa Fix flags when using clang as linker for Fuchsia
Don't add C runtime or set dynamic linker when linking with clang for
Fuchsia. Clang already does this for us.
2022-08-10 16:35:27 -07:00
Scott McMurray
dfb3713cdb Update error message to clarify that it's not the enum itself that's non_exhaustive 2022-08-10 10:02:03 -07:00
Lamb
a3b84ad197 Check if extern crate enum has non exhaustive variant when cast 2022-08-10 09:55:41 -07:00
Bryanskiy
874ee5bede add crt-static for android 2022-08-10 19:42:24 +03:00
Camille GILLOT
9701845287 Do not consider method call receiver as an argument in AST. 2022-08-10 18:34:54 +02:00
Camille GILLOT
0df84ae67c Ban indirect references to Self too. 2022-08-10 18:33:06 +02:00
Camille GILLOT
e1e25a845c Generalize trait object generic param check to aliases. 2022-08-10 18:32:08 +02:00
Michael Goulet
96fc9f177e
Rollup merge of #100359 - b-naber:valtrees-pretty-print-ice, r=lcnr
Special-case references to leafs in valtree pretty-printing

Fixes https://github.com/rust-lang/rust/issues/100313
2022-08-10 09:28:24 -07:00
Michael Goulet
5459edf8bd
Rollup merge of #100349 - TaKO8Ki:remove-type-string-comparison, r=lcnr
Refactor: remove a type string comparison
2022-08-10 09:28:22 -07:00
Michael Goulet
eae824d5bb
Rollup merge of #100317 - kjetilkjeka:remove-nvptx32-logic, r=eddyb
Remove logic related to deprecated nvptx-nvidia-cuda (32-bit) target

As described in the MCP https://github.com/rust-lang/compiler-team/issues/496#issuecomment-1196328748

r? ``@eddyb``
2022-08-10 09:28:19 -07:00
Michael Goulet
d0d2f60e49
Rollup merge of #100286 - Thog:rust-lld-macosx-target, r=petrochenkov
Add support for link-flavor rust-lld for macOS

Also refactor iOS, watchOS and tvOS common code.

The ``-arch`` argument was moved to the ``apple_base`` module instead of the target definitions for macOS.
As ld64 requires ``-syslibroot`` to be passed, ``add_apple_sdk`` was modified accordingly.
2022-08-10 09:28:18 -07:00
Martin Habovstiak
2a3ce7890c Stabilize ptr_const_cast
This stabilizes `ptr_const_cast` feature as was decided in a recent
[FCP](https://github.com/rust-lang/rust/issues/92675#issuecomment-1190660233)

Closes #92675
2022-08-10 17:22:58 +02:00
David Wood
2eebd34cd5 errors: don't fail on broken primary translations
If a primary bundle doesn't contain a message then the fallback bundle
is used. However, if the primary bundle's message is broken (e.g. it
refers to a interpolated variable that the compiler isn't providing)
then this would just result in a compiler panic. While there aren't any
primary bundles right now, this is the type of issue that could come up
once translation is further along.

Signed-off-by: David Wood <david.wood@huawei.com>
2022-08-10 11:48:25 +01:00
bors
1603a70f82 Auto merge of #100356 - matthiaskrgr:rollup-he0vkjc, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #99573 (Stabilize backtrace)
 - #100069 (Add error if link_ordinal used with unsupported link kind)
 - #100086 (Add more `// unit-test`s to MIR opt tests)
 - #100332 (Rename integer log* methods to ilog*)
 - #100334 (Suggest a missing semicolon before an array)
 - #100340 (Iterate generics_def_id_map in reverse order to fix P-critical issue)
 - #100345 (docs: remove repetition in `is_numeric` function docs)
 - #100352 (Update cargo)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-08-10 06:09:10 +00:00
Matthias Krüger
636f0c71cb
Rollup merge of #100340 - spastorino:fix-100187, r=compiler-errors
Iterate generics_def_id_map in reverse order to fix P-critical issue

Closes #100187

Fixes a `P-critical` beta regression.
2022-08-10 07:21:38 +02:00
Matthias Krüger
354b831c32
Rollup merge of #100334 - TaKO8Ki:suggest-missing-semicolon-before-array, r=fee1-dead
Suggest a missing semicolon before an array

fixes #99658
2022-08-10 07:21:37 +02:00