Commit graph

687 commits

Author SHA1 Message Date
Camille GILLOT 05812df603 Handle generic parameters. 2022-09-09 01:31:46 +00:00
Michael Goulet 249ede4195 Address rebase issues, make async fn in trait work 2022-09-09 01:31:45 +00:00
Michael Goulet 78b962a4f3 RPITIT placeholder items 2022-09-09 01:31:44 +00:00
Vadim Petrochenkov d8d3b83e3a rustc: Parameterize ty::Visibility over used ID
It allows using `LocalDefId` instead of `DefId` when possible, and also encode cheaper `Visibility<DefIndex>` into metadata.
2022-09-07 13:35:41 +04:00
Guillaume Gomez 4d830b7775
Rollup merge of #101434 - JhonnyBillM:replace-session-for-handler-in-into-diagnostic, r=davidtwco
Update `SessionDiagnostic::into_diagnostic` to take `Handler` instead of `ParseSess`

Suggested by the team in [this Zulip Topic](https://rust-lang.zulipchat.com/#narrow/stream/336883-i18n/topic/.23100717.20SessionDiagnostic.20on.20Handler).

`Handler` already has almost all the capabilities of `ParseSess` when it comes to diagnostic emission, in this migration we only needed to add the ability to access `source_map` from the emitter in order to get a `Snippet` and the `start_point`. Not sure if adding these two methods [`span_to_snippet_from_emitter` and  `span_start_point_from_emitter`] is the best way to address this gap.

P.S. If this goes in the right direction, then we probably may want to move `SessionDiagnostic` to `rustc_errors` and rename it to `DiagnosticHandler` or something similar.

r? `@davidtwco`
r? `@compiler-errors`
2022-09-06 17:00:26 +02:00
Dylan DPC e4534fe6fe
Rollup merge of #101391 - matthiaskrgr:perf0309, r=oli-obk
more clippy::perf fixes
2022-09-05 14:15:52 +05:30
Jhonny Bill Mena 321e60bf34 UPDATE - into_diagnostic to take a Handler instead of a ParseSess
Suggested by the team in this Zulip Topic https://rust-lang.zulipchat.com/#narrow/stream/336883-i18n/topic/.23100717.20SessionDiagnostic.20on.20Handler

Handler already has almost all the capabilities of ParseSess when it comes to diagnostic emission, in this migration we only needed to add the ability to access source_map from the emitter in order to get a Snippet and the start_point. Not sure if this is the best way to address this gap
2022-09-05 02:18:45 -04:00
Matthias Krüger 6f4726541e more clippy::perf fixes 2022-09-03 22:57:22 +02:00
Camille GILLOT e7164267a2 Do not call object_lifetime_default on lifetime params. 2022-09-03 21:11:42 +02:00
Dylan DPC a0056795da
Rollup merge of #100928 - CleanCut:rustc_metadata_diagnostics, r=davidtwco
Migrate rustc_metadata to SessionDiagnostics

Migrate rustc_metadata to SessionDiagnostics.

Part of https://github.com/rust-lang/rust/issues/100717
2022-09-03 10:33:05 +05:30
bors 2e35f954ad Auto merge of #98960 - cjgillot:entry-kind, r=estebank
Remove EntryKind from metadata.

This PR continues the refactor of metadata emission to be more systematic, iterating on definitions and filtering based on each definition's `DefKind`. This allows to remove the large `EntryKind` enum, replaced by linear tables in metadata.
2022-09-01 19:31:14 +00:00
Oli Scherer ee3c835018 Always import all tracing macros for the entire crate instead of piecemeal by module 2022-09-01 14:54:27 +00:00
Nathan Stocks 30adfd6a17 port 5 new diagnostics that appeared in master 2022-08-31 10:56:42 -06:00
Nathan Stocks 0d65819d52 respond to review feedback: mainly eliminate as many conversions as possible...
- ... when creating diagnostics in rustc_metadata
-  use the error_code! macro
- pass macro output to diag.code()
- use fluent from within manual implementation of SessionDiagnostic
- emit the untested errors in case they occur in the wild
- stop panicking in the probably-not-dead code, add fixme to write test
2022-08-31 10:56:42 -06:00
Nathan Stocks d0ba1fbaa4 port of locator.rs to SessionDiagnostics, fix some of the errors
revealed by tests, manually add a panic to test for dead code
2022-08-31 10:56:42 -06:00
Nathan Stocks bd8e312d73 port fs.rs to SessionDiagnostics 2022-08-31 10:56:42 -06:00
Nathan Stocks 32e1823b22 port creader.rs to SessionDiagnostics 2022-08-31 10:56:42 -06:00
Nathan Stocks f7e462a6c7 port encoder.rs to SessionDiagnostics 2022-08-31 10:56:42 -06:00
Nathan Stocks 3ed93107ff port native_libs.rs to SessionDiagnostics 2022-08-31 10:56:42 -06:00
Nathan Stocks 54645e880f set up rustc_metadata for SessionDiagnostics, port dependency_format.rs 2022-08-31 10:56:38 -06:00
Camille GILLOT 60a052f4d3 Handle MIR in a single place. 2022-08-30 19:07:22 +02:00
Camille GILLOT b94d421d08 Remove fn_has_self_parameter table. 2022-08-30 19:06:30 +02:00
Camille GILLOT b0b46c0a10 Separate macro_rules and macro_definition. 2022-08-30 19:06:12 +02:00
Camille GILLOT c485fccd81 Remove EntryKind. 2022-08-30 19:05:59 +02:00
Camille GILLOT affb12210d Create a module-reexports table. 2022-08-30 19:05:50 +02:00
Camille GILLOT d330dc8c11 Fix the panic message. 2022-08-30 19:05:42 +02:00
Camille GILLOT 30ae64e51f Create a table for fn_has_self_parameter. 2022-08-30 19:05:33 +02:00
Camille GILLOT 1ddb944311 Use tables for macros. 2022-08-30 19:05:15 +02:00
Camille GILLOT ca9f5645f3 Move AssocContainer to a metadata table. 2022-08-30 19:04:58 +02:00
Camille GILLOT 927e58d633 Move VariantData to a metadata table. 2022-08-30 19:04:49 +02:00
Camille GILLOT edd25c37c5 Simplify recursion scheme. 2022-08-30 19:04:41 +02:00
Camille GILLOT 73e9f37eaa Encode consts in metadata main loop. 2022-08-30 19:04:37 +02:00
Camille GILLOT 45ad22be8f Encode type in the main loop. 2022-08-30 19:04:04 +02:00
bors a0d07093f8 Auto merge of #100812 - Nilstrieb:revert-let-chains-nightly, r=Mark-Simulacrum
Revert let_chains stabilization

This is the revert against master, the beta revert was already done in #100538.

Bumps the stage0 compiler which already has it reverted.
2022-08-30 05:48:22 +00:00
Nilstrieb d1ef8180f9 Revert let_chains stabilization
This reverts commit 3266460749.

This is the revert against master, the beta revert was already done in #100538.
2022-08-29 19:34:11 +02:00
Dylan DPC 5555e13a6e
Rollup merge of #99821 - cjgillot:ast-lifetimes-2, r=compiler-errors
Remove separate indexing of early-bound regions

~Based on https://github.com/rust-lang/rust/pull/99728.~

This PR copies some modifications from https://github.com/rust-lang/rust/pull/97839 around object lifetime defaults.
These modifications allow to stop counting generic parameters during lifetime resolution, and rely on the indexing given by `rustc_typeck::collect`.
2022-08-29 16:49:39 +05:30
Daniel Paoliello cc49c3e582 Implementation of import_name_type 2022-08-26 09:15:35 -07:00
bors 76531befc4 Auto merge of #100436 - jyn514:macro-query-system, r=cjgillot
try and simplify some things in the query system
2022-08-25 05:35:27 +00:00
Joshua Nelson e188868014 get rid of another unnecessary lifetime macro argument 2022-08-23 21:52:29 -05:00
klensy f6329485a8 rmeta/query cache: don't write string values of preinterned symbols 2022-08-20 15:39:21 +03:00
bors 468887ef91 Auto merge of #100209 - cjgillot:source-file-index, r=estebank
Lazily decode SourceFile from metadata

Currently, source files from foreign crates are decoded up-front from metadata.
Spans from those crates were matched with the corresponding source using binary search among those files.

This PR changes the strategy by matching spans to files during encoding. This allows to decode source files on-demand, instead of up-front. The on-disk format for spans becomes: `<tag> <position from start of file> <length> <file index> <crate (if foreign file)>`.
2022-08-19 15:31:25 +00:00
klensy adba4691f6 cache strings while encoding/decoding to compiler artifacts 2022-08-15 17:56:37 +03:00
Mark Rousskov 154a09dd91 Adjust cfgs 2022-08-12 16:28:15 -04:00
Daniel Paoliello fda5144ceb Add error if link_ordinal used without raw-dylib 2022-08-09 11:02:41 -07:00
Dylan DPC 1dc4858914
Rollup merge of #96478 - WaffleLapkin:rustc_default_body_unstable, r=Aaron1011
Implement `#[rustc_default_body_unstable]`

This PR implements a new stability attribute — `#[rustc_default_body_unstable]`.

`#[rustc_default_body_unstable]` controls the stability of default bodies in traits.
For example:
```rust
pub trait Trait {
    #[rustc_default_body_unstable(feature = "feat", isssue = "none")]
    fn item() {}
}
```
In order to implement `Trait` user needs to either
- implement `item` (even though it has a default implementation)
- enable `#![feature(feat)]`

This is useful in conjunction with [`#[rustc_must_implement_one_of]`](https://github.com/rust-lang/rust/pull/92164), we may want to relax requirements for a trait, for example allowing implementing either of `PartialEq::{eq, ne}`, but do so in a safe way — making implementation of only `PartialEq::ne` unstable.

r? `@Aaron1011`
cc `@nrc` (iirc you were interested in this wrt `read_buf`), `@danielhenrymantilla` (you were interested in the related `#[rustc_must_implement_one_of]`)
P.S. This is my first time working with stability attributes, so I'm not sure if I did everything right 😅
2022-08-09 17:34:50 +05:30
Camille GILLOT 0d41f9145c Remove unused parameter. 2022-08-08 21:12:04 +02:00
Camille GILLOT bacb4db48c Only encode position from start of file. 2022-08-07 12:27:38 +02:00
Camille GILLOT 16ba778c12 Support parallel compiler. 2022-08-06 23:28:32 +02:00
Camille GILLOT 7c2d722fb0 Simplify encoding a bit. 2022-08-06 23:13:09 +02:00
Camille GILLOT d74af405eb Remove unused cache. 2022-08-06 23:09:15 +02:00