Commit Graph

19816 Commits

Author SHA1 Message Date
nils
2f9f097cb8 Migrate parts of rustc_expand to session diagnostics
This migrates everything but the `mbe` and `proc_macro` modules. It also
contains a few cleanups and drive-by/accidental diagnostic improvements
which can be seen in the diff for the UI tests.
2022-12-10 11:02:41 +01:00
bors
a000811405 Auto merge of #105512 - matthiaskrgr:rollup-i74avrf, r=matthiaskrgr
Rollup of 9 pull requests

Successful merges:

 - #102406 (Make `missing_copy_implementations` more cautious)
 - #105265 (Add `rustc_on_unimplemented` to `Sum` and `Product` trait.)
 - #105385 (Skip test on s390x as LLD does not support the platform)
 - #105453 (Make `VecDeque::from_iter` O(1) from `vec(_deque)::IntoIter`)
 - #105468 (Mangle "main" as "__main_void" on wasm32-wasi)
 - #105480 (rustdoc: remove no-op mobile CSS `#sidebar-toggle { text-align }`)
 - #105489 (Fix typo in apple_base.rs)
 - #105504 (rustdoc: make stability badge CSS more consistent)
 - #105506 (Tweak `rustc_must_implement_one_of` diagnostic output)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-12-10 05:32:44 +00:00
Matthias Krüger
376b0bce36
Rollup merge of #105506 - estebank:rustc_must_implement_one_of, r=compiler-errors
Tweak `rustc_must_implement_one_of` diagnostic output
2022-12-09 22:31:59 +01:00
Matthias Krüger
f78babd6c4
Rollup merge of #105489 - eltociear:patch-17, r=Dylan-DPC
Fix typo in apple_base.rs

erronous -> erroneous
2022-12-09 22:31:58 +01:00
Matthias Krüger
320d018268
Rollup merge of #105468 - sunfishcode:sunfishcode/main-void-wasi, r=estebank
Mangle "main" as "__main_void" on wasm32-wasi

On wasm, the age-old C trick of having a main function which can either have no arguments or argc+argv doesn't work, because wasm requires caller and callee signatures to match. WASI's current strategy is to have compilers mangle main's name to indicate which signature they're using. Rust uses the no-argument form, which should be mangled as `__main_void`.

This is needed on wasm32-wasi as of #105395.
2022-12-09 22:31:57 +01:00
Matthias Krüger
4fae5891d0
Rollup merge of #102406 - mejrs:missing_copy, r=wesleywiser
Make `missing_copy_implementations` more cautious

- Fixes https://github.com/rust-lang/rust/issues/98348
- Also makes the lint not fire on large types and types containing raw pointers. Thoughts?
2022-12-09 22:31:54 +01:00
bors
0d5573e6da Auto merge of #105363 - WaffleLapkin:thin2win_box_next_argument, r=nnethercote
Shrink `rustc_parse_format::Piece`

This makes both variants closer together in size (previously they were different by 208 bytes -- 16 vs 224). This may make things worse, but it's worth a try.

r? `@nnethercote`
2022-12-09 21:27:35 +00:00
Esteban Küber
b3b17bde31 Tweak rustc_must_implement_one_of diagnostic output 2022-12-09 10:44:11 -08:00
bors
e10201c9bb Auto merge of #104572 - pkubaj:patch-1, r=cuviper
Fix build on powerpc-unknown-freebsd

Probably also fixes build on arm and mips*. Related to https://github.com/rust-lang/rust/issues/104220
2022-12-09 12:00:58 +00:00
bors
14ca83a04b Auto merge of #105486 - matthiaskrgr:rollup-o7c4l1c, r=matthiaskrgr
Rollup of 10 pull requests

Successful merges:

 - #105216 (Remove unused GUI test)
 - #105245 (attempt to clarify align_to docs)
 - #105387 (Improve Rustdoc scrape-examples UI)
 - #105389 (Enable profiler in dist-powerpc64le-linux)
 - #105427 (Dont silently ignore rustdoc errors)
 - #105442 (rustdoc: clean up docblock table CSS)
 - #105443 (Move some queries and methods)
 - #105455 (use the correct `Reveal` during validation)
 - #105470 (Clippy: backport ICE fix before beta branch)
 - #105474 (lib docs: fix typo)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-12-09 09:19:26 +00:00
Ikko Ashimine
f41576bd3d
Fix typo in apple_base.rs
erronous -> erroneous
2022-12-09 18:09:32 +09:00
Matthias Krüger
04dac4285a
Rollup merge of #105455 - lcnr:correct-reveal-in-validate, r=jackh726
use the correct `Reveal` during validation

supersedes #105454. Deals with https://github.com/rust-lang/rust/issues/105009#issuecomment-1342395333, not closing #105009 as the ICE may leak into beta

The issue was the following:
- we optimize the mir, using `Reveal::All`
- some optimization relies on the hidden type of an opaque type
- we then validate using `Reveal::UserFacing` again which is not able to observe the hidden type

r? `@jackh726`
2022-12-09 07:25:47 +01:00
Matthias Krüger
6111a7345b
Rollup merge of #105443 - compiler-errors:move-more, r=oli-obk
Move some queries and methods

Each commit's title should be self-explanatory. Motivated to break up some large, general files and move queries into leaf crates.
2022-12-09 07:25:46 +01:00
bors
badd6a5a03 Auto merge of #104449 - oli-obk:unhide_unknown_spans, r=estebank,RalfJung
Start emitting labels even if their pointed to file is not available locally

r? `@estebank`

cc `@RalfJung`

fixes #97699
2022-12-09 06:24:28 +00:00
pkubaj
32c777e891 Fix build on powerpc-unknown-freebsd
Probably also fixes build on mips*. Related to https://github.com/rust-lang/rust/issues/104220
2022-12-09 02:11:15 +01:00
Maybe Waffle
c44c82de2b Assert size of rustc_parse_format::Piece<'_> 2022-12-08 22:50:39 +00:00
Dan Gohman
98ae83daae Mangle "main" as "__main_void" on wasm32-wasi
On wasm, the age-old C trick of having a main function which can either have
no arguments or argc+argv doesn't work, because wasm requires caller and
callee signatures to match. WASI's current strategy is to have compilers
mangle main's name to indicate which signature they're using. Rust uses the
no-argument form, which should be mangled as `__main_void`.

This is needed on wasm32-wasi as of #105395.
2022-12-08 13:15:40 -08:00
Matthias Krüger
660795eee5
Rollup merge of #105441 - nnethercote:rm-UnsafetyState, r=lcnr
Remove `UnsafetyState`

r? `@lcnr`
2022-12-08 12:57:33 +01:00
Matthias Krüger
fbfc5ada02
Rollup merge of #105423 - oli-obk:symbols, r=jackh726
Use `Symbol` for the crate name instead of `String`/`str`

It always got converted to a symbol anyway
2022-12-08 12:57:32 +01:00
Matthias Krüger
2fbde2b028
Rollup merge of #105408 - cuviper:help-rpitirpit, r=compiler-errors
Add help for `#![feature(impl_trait_in_fn_trait_return)]`

This adds a new variant `ImplTraitContext::FeatureGated`, so we can
generalize the help for `return_position_impl_trait_in_trait` to also
work for `impl_trait_in_fn_trait_return`.

cc #99697
2022-12-08 12:57:31 +01:00
Matthias Krüger
4d5a2f3d81
Rollup merge of #105405 - sunfishcode:sunfishcode/export-dynamic, r=TaKO8Ki
Stop passing -export-dynamic to wasm-ld.

-export-dynamic was a temporary hack added in the early days of the Rust wasm32 target when Rust didn't have a way to specify wasm exports in the source code. This flag causes all global symbols, and some compiler-internal symbols, to be exported, which is often more than needed.

Rust now does have a way to specify exports in the source code: `#[export_name = "..."]`.

So as the original comment suggests, -export-dynamic can now be removed, allowing users to have smaller binaries and better encapsulation in their wasm32-unknown-unknown modules.

It's possible that this change will require existing wasm32-unknown-unknown users will to add explicit `#[export_name = "..."]` directives to exporrt the symbols that their programs depend on having exported.
2022-12-08 12:57:30 +01:00
Matthias Krüger
f1f7560598
Rollup merge of #105317 - RalfJung:retag-rework, r=oli-obk
make retagging work even with 'unstable' places

This is based on top of https://github.com/rust-lang/rust/pull/105301. Only the last two commits are new.

While investigating https://github.com/rust-lang/unsafe-code-guidelines/issues/381 I realized that we would have caught this issue much earlier if the add_retag pass wouldn't bail out on assignments of the form `*ptr = ...`.

So this PR changes our retag strategy:
- When a new reference is created via `Rvalue::Ref` (or a raw ptr via `Rvalue::AddressOf`), we do the retagging as part of just executing that address-taking operation.
- For everything else, we still insert retags -- these retags basically serve to ensure that references stored in local variables (and their fields) are always freshly tagged, so skipping this for assignments like `*ptr = ...` is less egregious.
r? ```@oli-obk```
2022-12-08 12:57:30 +01:00
Matthias Krüger
e826a9acb4
Rollup merge of #105255 - cjgillot:issue-105197, r=compiler-errors
Make nested RPIT inherit the parent opaque's generics.

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

r? ```@compiler-errors```
2022-12-08 12:57:29 +01:00
Matthias Krüger
086bdbbd73
Rollup merge of #104922 - estebank:fur-elize, r=oli-obk
Detect long types in E0308 and write them to disk

On type error with long types, print an abridged type and write the full type to disk.

Print the widest possible short type while still fitting in the terminal.
2022-12-08 12:57:28 +01:00
lcnr
dd9d05cec4 validate: use the correct reveal during opts 2022-12-08 11:24:25 +01:00
Michael Goulet
3b9daac6a2 Move some suggestions from error_reporting to error_reporting::suggest 2022-12-08 05:58:30 +00:00
Michael Goulet
25a6daccab Move codegen_select_candidate to a rustc_traits 2022-12-08 05:16:57 +00:00
Michael Goulet
b36035c20f Move vtable methods into its own module 2022-12-08 05:16:57 +00:00
Michael Goulet
48270044b0 Move has_structural_eq_impls provider to rustc_ty_utils 2022-12-08 05:16:48 +00:00
Nicholas Nethercote
9af48e5ab6 Fix a typo. 2022-12-08 15:53:31 +11:00
Nicholas Nethercote
7a4669285a Remove UnsafetyState.
`FnCtxt::ps` is the only occurrence. It gets updated during HIR
typechecking, but is never looked at.
2022-12-08 15:42:57 +11:00
Oli Scherer
d30848b30a Use Symbol for the crate name instead of String/str 2022-12-07 20:30:02 +00:00
Matthias Krüger
4968af0ee8
Rollup merge of #105418 - BelovDV:fix-libc-hack, r=petrochenkov
fix: remove hack from link.rs

This logic implemented in libc.

r? `@petrochenkov`
2022-12-07 15:39:09 +01:00
Matthias Krüger
b23419b03d
Rollup merge of #105400 - BoxyUwU:braced_param_evaluatability, r=oli-obk
normalize before handling simple checks for evaluatability of `ty::Const`

`{{{{{{{ N }}}}}}}` is desugared into a `ConstKind::Unevaluated` for an anonymous `const` item so when calling `is_const_evaluatable` on it we skip the `ConstKind::Param(_) => Ok(())` arm which is incorrect.
2022-12-07 15:39:08 +01:00
Matthias Krüger
52cec8c99f
Rollup merge of #105368 - WaffleLapkin:deref-even-harder, r=TaKO8Ki
Remove more `ref` patterns from the compiler

Previous PR: #105045
2022-12-07 15:39:07 +01:00
Matthias Krüger
95da525982
Rollup merge of #105343 - nbdd0121:hir, r=fee1-dead
Simplify attribute handling in rustc_ast_lowering

Given that attributes is stored in a separate BTreeMap, it's not necessary to pass it in when constructing `hir::Expr`. We can just construct `hir::Expr` and then call `self.lower_attrs` later if it needs attributes.

As most desugaring code don't use attributes, this allows some code cleanup.
2022-12-07 15:39:07 +01:00
Matthias Krüger
3bcfa4c459
Rollup merge of #105267 - compiler-errors:issue-104613, r=oli-obk
Don't ICE in ExprUseVisitor on FRU for non-existent struct

Fixes #104613
Fixes #105202
2022-12-07 15:39:06 +01:00
bors
91b8f34ac2 Auto merge of #104799 - pcc:linkage-fn, r=tmiasko
Support Option and similar enums as type of static variable with linkage attribute

Compiler MCP:
rust-lang/compiler-team#565
2022-12-07 10:24:59 +00:00
Daniil Belov
a9cf163c08 fix: remove hack from link.rs (moved to libc) 2022-12-07 13:13:58 +03:00
bors
e491d2b24d Auto merge of #105291 - nnethercote:remove-LintPassObjects, r=cjgillot
Remove `{Early,Late}LintPassObjects`.

`EarlyContextAndPass` wraps a single early lint pass. We aggregate multiple passes into that single pass by using `EarlyLintPassObjects`.

This commit removes `EarlyLintPassObjects` by changing `EarlyContextAndPass` into `EarlyContextAndPasses`. I.e. it just removes a level of indirection. This makes the code simpler and slightly faster.

The commit does likewise for late lints.

r? `@cjgillot`
2022-12-07 03:52:19 +00:00
Josh Stone
e9dd59131b Add help for #![feature(impl_trait_in_fn_trait_return)]
This adds a new variant `ImplTraitContext::FeatureGated`, so we can
generalize the help for `return_position_impl_trait_in_trait` to also
work for `impl_trait_in_fn_trait_return`.
2022-12-06 17:53:50 -08:00
Dan Gohman
3a07aa9b5e Stop passing -export-dynamic to wasm-ld.
-export-dynamic was a temporary hack added in the early days of the Rust
wasm32 target when Rust didn't have a way to specify wasm exports in the
source code. This flag causes all global symbols, and some compiler-internal
symbols, to be exported, which is often more than needed.

Rust now does have a way to specify exports in the source code:
`#[export_name = "..."]`.

So as the original comment suggests, -export-dynamic can now be removed,
allowing users to have smaller binaries and better encapsulation in
their wasm32-unknown-unknown modules.

It's possible that this change will require existing wasm32-unknown-unknown
users will to add explicit `#[export_name = "..."]` directives to
exporrt the symbols that their programs depend on having exported.
2022-12-06 16:50:29 -08:00
Boxy
9f438bef0b normalize before matching on ConstKind 2022-12-06 22:53:13 +00:00
Matthias Krüger
280501d6bc
Rollup merge of #105382 - BoxyUwU:fixme_typo_sadface, r=lcnr
remove an excess `this`
2022-12-06 23:13:51 +01:00
Matthias Krüger
e434f613fd
Rollup merge of #105298 - krasimirgg:llvm-16-dec-1, r=cuviper
llvm-wrapper: adapt for an LLVM API change

Adapts llvm-wrapper for 8c7c20f033.
No functional changes intended.

Found via our experimental rust + llvm @ HEAD bot: https://buildkite.com/llvm-project/rust-llvm-integrate-prototype/builds/15404#0184d95d-5a68-4db6-ad32-51ddbc3ab543/202-571
2022-12-06 23:13:49 +01:00
Oli Scherer
f89d6236aa Properly indent messages 2022-12-06 18:59:46 +00:00
Oli Scherer
99348a5330 Change CTFE backtraces to use note instead of label to preserve their order
labels are reordered within the file in which they are reported, which can mess up the stack trace
2022-12-06 18:59:46 +00:00
Oli Scherer
7782a2b70d Remove now-redundant file/line info from const backtraces 2022-12-06 18:59:46 +00:00
Oli Scherer
10b75cbbb0 Start emitting labels even if their pointed to file is not available locally 2022-12-06 18:59:46 +00:00
Oli Scherer
19d7dceed3 remove an unnecessary ? 2022-12-06 18:59:45 +00:00