Commit graph

22729 commits

Author SHA1 Message Date
Laurențiu Nicola
c48062fe2a Merge commit 'aa9bc8612514d216f84eec218dfd19ab83f3598a' into sync-from-ra 2023-06-05 12:04:23 +03:00
Oli Scherer
1570299af4 Remove const eval limit and implement an exponential backoff lint instead 2023-05-31 10:24:17 +00:00
jyn
aa65395c49 Update proc-macro-api for the new rustc metadata format 2023-05-26 11:59:25 -05:00
Arpad Borsos
35940bcda3 Remove identity_future from stdlib
This function/lang_item was introduced in #104321 as a temporary workaround of future lowering.
The usage and need for it went away in #104833.
After a bootstrap update, the function itself can be removed from `std`.
2023-05-07 10:52:01 +02:00
Ralf Jung
3a75e19258 Merge from rustc 2023-04-30 22:35:29 +02:00
Ralf Jung
77cdbe653e Merge from rustc 2023-04-28 15:49:39 +02:00
Matthias Krüger
e99a9904aa Rollup merge of #110766 - m-ou-se:fmt-rt, r=jyn514
More core::fmt::rt cleanup.

- Removes the `V1` suffix from the `Argument` and `Flag` types.

- Moves more of the format_args lang items into the `core::fmt::rt` module. (The only remaining lang item in `core::fmt` is `Arguments` itself, which is a public type.)

Part of https://github.com/rust-lang/rust/issues/99012

Follow-up to https://github.com/rust-lang/rust/pull/110616
2023-04-28 07:34:02 +02:00
Ralf Jung
d508c18c5b Merge from rustc 2023-04-26 09:51:54 +02:00
Matthias Krüger
6bd8fee558 Revert "Remove #[alloc_error_handler] from the compiler and library"
This reverts commit abc0660118cc95f47445fd33502a11dd448f5968.
2023-04-25 00:08:35 +02:00
Mara Bos
429d06b879 Remove "V1" from ArgumentsV1 and FlagsV1. 2023-04-24 16:16:14 +02:00
Ralf Jung
2084d975f2 Merge from rustc 2023-04-24 11:59:11 +02:00
bors
6d14583d2d Auto merge of #109507 - Amanieu:panic-oom-payload, r=davidtwco
Report allocation errors as panics

OOM is now reported as a panic but with a custom payload type (`AllocErrorPanicPayload`) which holds the layout that was passed to `handle_alloc_error`.

This should be review one commit at a time:
- The first commit adds `AllocErrorPanicPayload` and changes allocation errors to always be reported as panics.
- The second commit removes `#[alloc_error_handler]` and the `alloc_error_hook` API.

ACP: https://github.com/rust-lang/libs-team/issues/192

Closes #51540
Closes #51245
2023-04-22 12:27:45 +00:00
Ralf Jung
918b78e066 Merge from rustc 2023-04-22 10:35:35 +02:00
bors
6df808215b Auto merge of #109002 - michaelvanstraten:master, r=petrochenkov
Added byte position range for `proc_macro::Span`

Currently, the [`Debug`](https://doc.rust-lang.org/beta/proc_macro/struct.Span.html#impl-Debug-for-Span) implementation for [`proc_macro::Span`](https://doc.rust-lang.org/beta/proc_macro/struct.Span.html#) calls the debug function implemented in the trait implementation of `server::Span` for the type `Rustc` in the `rustc-expand` crate.

The current implementation, of the referenced function, looks something like this:
```rust
fn debug(&mut self, span: Self::Span) -> String {
    if self.ecx.ecfg.span_debug {
        format!("{:?}", span)
    } else {
        format!("{:?} bytes({}..{})", span.ctxt(), span.lo().0, span.hi().0)
    }
}
```

It returns the byte position of the [`Span`](https://doc.rust-lang.org/beta/proc_macro/struct.Span.html#) as an interpolated string.

Because this is currently the only way to get a spans position in the file, I might lead someone, who is interested in this information, to parsing this interpolated string back into a range of bytes, which I think is a very non-rusty way.

The proposed `position()`, method implemented in this PR, gives the ability to directly get this info.
It returns a [`std::ops::Range`](https://doc.rust-lang.org/std/ops/struct.Range.html#) wrapping the lowest and highest byte of the [`Span`](https://doc.rust-lang.org/beta/proc_macro/struct.Span.html#).

I put it behind the `proc_macro_span` feature flag because many of the other functions that have a similar footprint also are annotated with it, I don't actually know if this is right.

It would be great if somebody could take a look at this, thank you very much in advanced.
2023-04-21 10:47:27 +00:00
Amanieu d'Antras
35fc5780a7 Remove #[alloc_error_handler] from the compiler and library 2023-04-16 08:35:50 -07:00
Laurențiu Nicola
dbf04a5ee2 ⬆️ rust-analyzer 2023-03-20 08:31:01 +02:00
bors
544b4cfe4d Auto merge of #109069 - lnicola:rust-analyzer-2023-03-13, r=lnicola
⬆️ `rust-analyzer`

r? `@ghost`
2023-03-13 16:54:43 +00:00
Laurențiu Nicola
b2f6fd4f96 ⬆️ rust-analyzer 2023-03-13 10:42:24 +02:00
clubby789
c6da2f9d96 Remove uses of box_syntax in rustc and tools 2023-03-12 13:19:46 +00:00
Michael van Straten
e89d7dfe39 Renamed to byte_range and changed Range generics [skip ci] 2023-03-11 12:15:19 +01:00
Michael van Straten
e66d0208bc Fixed rust-analyser: no implementation for position() 2023-03-10 22:16:23 +01:00
bors
15b867b5db Auto merge of #101550 - CraftSpider:link-dead-windows, r=wesleywiser
Make compressed rmeta contain compressed data length after header

Fixes #90056, which is caused by link.exe introducing padding to the `.rustc` section, since it assumes this will have no effect besides allowing it to possibly use the extra space in future links.
2023-03-05 02:00:58 +00:00
Nicholas Nethercote
888c18d3f3 Rename many interner functions.
(This is a large commit. The changes to
`compiler/rustc_middle/src/ty/context.rs` are the most important ones.)

The current naming scheme is a mess, with a mix of `_intern_`, `intern_`
and `mk_` prefixes, with little consistency. In particular, in many
cases it's easy to use an iterator interner when a (preferable) slice
interner is available.

The guiding principles of the new naming system:
- No `_intern_` prefixes.
- The `intern_` prefix is for internal operations.
- The `mk_` prefix is for external operations.
- For cases where there is a slice interner and an iterator interner,
  the former is `mk_foo` and the latter is `mk_foo_from_iter`.

Also, `slice_interners!` and `direct_interners!` can now be `pub` or
non-`pub`, which helps enforce the internal/external operations
division.

It's not perfect, but I think it's a clear improvement.

The following lists show everything that was renamed.

slice_interners
- const_list
  - mk_const_list -> mk_const_list_from_iter
  - intern_const_list -> mk_const_list
- substs
  - mk_substs -> mk_substs_from_iter
  - intern_substs -> mk_substs
  - check_substs -> check_and_mk_substs (this is a weird one)
- canonical_var_infos
  - intern_canonical_var_infos -> mk_canonical_var_infos
- poly_existential_predicates
  - mk_poly_existential_predicates -> mk_poly_existential_predicates_from_iter
  - intern_poly_existential_predicates -> mk_poly_existential_predicates
  - _intern_poly_existential_predicates -> intern_poly_existential_predicates
- predicates
  - mk_predicates -> mk_predicates_from_iter
  - intern_predicates -> mk_predicates
  - _intern_predicates -> intern_predicates
- projs
  - intern_projs -> mk_projs
- place_elems
  - mk_place_elems -> mk_place_elems_from_iter
  - intern_place_elems -> mk_place_elems
- bound_variable_kinds
  - mk_bound_variable_kinds -> mk_bound_variable_kinds_from_iter
  - intern_bound_variable_kinds -> mk_bound_variable_kinds

direct_interners
- region
  - intern_region (unchanged)
- const
  - mk_const_internal -> intern_const
- const_allocation
  - intern_const_alloc -> mk_const_alloc
- layout
  - intern_layout -> mk_layout
- adt_def
  - intern_adt_def -> mk_adt_def_from_data (unusual case, hard to avoid)
  - alloc_adt_def(!) -> mk_adt_def
- external_constraints
  - intern_external_constraints -> mk_external_constraints

Other
- type_list
  - mk_type_list -> mk_type_list_from_iter
  - intern_type_list -> mk_type_list
- tup
  - mk_tup -> mk_tup_from_iter
  - intern_tup -> mk_tup
2023-02-24 07:32:24 +11:00
Rune Tynan
7b5cfdd72a Add v7 support to rust-analyzer 2023-02-20 13:38:30 -05:00
Laurențiu Nicola
7e711da2f0 ⬆️ rust-analyzer 2023-02-20 10:14:12 +02:00
Laurențiu Nicola
bc45c7659a ⬆️ rust-analyzer 2023-02-13 13:55:14 +02:00
Albert Larsan
3e0e51c108 Change src/test to tests in source files, fix tidy and tests 2023-01-11 09:32:13 +00:00
arcnmx
25242fe93f ⬆️ rust-analyzer
Merge commit '368e0bb32f1178cf162c2ce5f7e10b7ae211eb26'
2023-01-09 10:36:22 -08:00
Matthias Krüger
b3ef934ccb Rollup merge of #104873 - RalfJung:therefore, r=Dylan-DPC
RefCell::get_mut: fix typo

and fix the same typo in a bunch of other places
2022-11-25 10:44:40 +01:00
Ralf Jung
4297c9bacc RefCell::get_mut: fix typo
and fix the same typo in a bunch of other places
2022-11-25 08:52:06 +01:00
Laurențiu Nicola
a2a1d99545 ⬆️ rust-analyzer 2022-11-23 17:24:03 +02:00
Michael Goulet
61c744d4fd Rollup merge of #104211 - lnicola:rust-analyzer-2022-11-09, r=lnicola
⬆️ rust-analyzer

r? ``@ghost``
2022-11-09 21:53:38 -08:00
Laurențiu Nicola
79923c382a ⬆️ rust-analyzer 2022-11-09 21:49:10 +02:00
Dylan DPC
a65ca91b84 Rollup merge of #103919 - nnethercote:unescaping-cleanups, r=matklad
Unescaping cleanups

Some code improvements, and some error message improvements.

Best reviewed one commit at a time.

r? ````@matklad````
2022-11-09 19:21:22 +05:30
Nicholas Nethercote
7d2a1ee4fc Remove unescape_byte_literal.
It's easy to just use `unescape_literal` + `byte_from_char`.
2022-11-05 13:56:36 +11:00
Laurențiu Nicola
c60b1f6414 ⬆️ rust-analyzer 2022-11-01 11:31:31 +02:00
Laurențiu Nicola
8807fc4cc3 ⬆️ rust-analyzer 2022-10-26 17:40:41 +03:00
Ralf Jung
26a413e015 merge rustc history 2022-10-21 10:18:54 +02:00
Laurențiu Nicola
a99a48e786 ⬆️ rust-analyzer 2022-10-18 09:12:49 +03:00
Ralf Jung
4b61e5ecc8 merge rustc history 2022-10-12 19:53:57 +02:00
Ralf Jung
8536eb016c rename rustc_allocator_nounwind to rustc_nounwind 2022-10-11 22:47:31 +02:00
Laurențiu Nicola
4f55ebbd4f ⬆️ rust-analyzer 2022-10-11 10:37:35 +03:00
Andres Suarez
3a57388d13 update to syn-1.0.102 2022-10-09 13:51:55 -04:00
bors
02ae3d5ec6 Auto merge of #2583 - RalfJung:rustup, r=oli-obk
initial josh subtree sync

This demonstrates what a josh-based rustup would look like with my patched josh. To create it I did
```
git fetch http://localhost:8000/rust-lang/rust.git:start=75dd959a3a40eb5b4574f8d2e23aa6efbeb33573[:prefix=src/tools/miri]:/src/tools/miri.git master
git merge FETCH_HEAD
./rustup-toolchain HEAD && ./miri fmt
git commit -am rustup
```
Unlike the [previous attempt](https://github.com/rust-lang/miri/pull/2554), this does not add a new root commit to the repo.

Once we merge this, we committed to using josh for subtree syncing, and in particular a version of josh that includes https://github.com/josh-project/josh/pull/961 (or something compatible).
2022-10-08 08:53:29 +00:00
Petr Portnov
ed532e5a34 Fix duplicate usage of a article.
This fixes a typo first appearing in #94624
in which test-macro diagnostic uses "a" article twice.

Since I searched sources for " a a " sequences,
I also fixed the same issue in a few source files where I found it.

Signed-off-by: Petr Portnov <gh@progrm-jarvis.ru>
2022-10-02 21:40:39 +03:00
lcnr
6f13f12301 rustc_typeck to rustc_hir_analysis 2022-09-27 10:37:23 +02:00
Laurențiu Nicola
f5fde4df43 ⬆️ rust-analyzer 2022-09-20 17:39:17 +03:00
Laurențiu Nicola
459bbb4222 ⬆️ rust-analyzer 2022-09-13 15:38:11 +03:00
Laurențiu Nicola
65e1dc4d9c ⬆️ rust-analyzer 2022-09-06 21:20:49 +03:00
bors
c1918fcb9a Auto merge of #100210 - mystor:proc_macro_diag_struct, r=eddyb
proc_macro/bridge: send diagnostics over the bridge as a struct

This removes some RPC when creating and emitting diagnostics, and
simplifies the bridge slightly.

After this change, there are no remaining methods which take advantage
of the support for `&mut` references to objects in the store as
arguments, meaning that support for them could technically be removed if
we wanted. The only remaining uses of immutable references into the
store are `TokenStream` and `SourceFile`.

r? `@eddyb`
2022-09-01 00:26:53 +00:00