Commit Graph

84 Commits

Author SHA1 Message Date
Oli Scherer
33998a9751 Fix test by adding a stable way to get an opaque DefKind 2023-09-25 14:38:27 +00:00
Camille GILLOT
44ac8dcc71 Remove GeneratorWitness and rename GeneratorWitnessMIR. 2023-09-23 13:47:30 +00:00
Ralf Jung
7abbb9a4ff hide rustc line numbers in test 2023-09-22 10:37:40 +02:00
bors
dac91a82e1 Auto merge of #115677 - matthewjasper:let-expr-recovery, r=b-naber
Improve invalid let expression handling

- Move all of the checks for valid let expression positions to parsing.
- Add a field to ExprKind::Let in AST/HIR to mark whether it's in a valid location.
- Suppress some later errors and MIR construction for invalid let expressions.
- Fix a (drop) scope issue that was also responsible for #104172.

Fixes #104172
Fixes #104868
2023-09-14 19:56:55 +00:00
Matthias Krüger
2a087be735
Rollup merge of #115749 - oli-obk:smir_consts, r=compiler-errors
Allow loading the SMIR for constants and statics

cc https://github.com/rust-lang/project-stable-mir/issues/34

before this PR we were ICEing when trying to access the SMIR of anything other than functions
2023-09-11 21:16:23 +02:00
Matthew Jasper
2d7a5f528c Update tools and fulldeps tests 2023-09-11 15:51:19 +00:00
bors
5d62ab8981 Auto merge of #115387 - weihanglo:merge-check-and-lint, r=oli-obk
Make unknown/renamed/removed lints passed via command line respect lint levels
2023-09-11 08:56:29 +00:00
Oli Scherer
c2e790044c Allow loading the SMIR for constants and statics 2023-09-11 08:14:56 +00:00
Oli Scherer
0f4ff52e00 Implement and test monomorphization 2023-09-06 08:16:04 +00:00
Oli Scherer
a370f1baa3 Also use Const in SMIR instead of just ConstantKind 2023-09-06 08:16:04 +00:00
Oli Scherer
7f009e54bd Fail to test argument instantiation since we don't have types for most constants 2023-09-06 08:16:04 +00:00
Celina G. Val
d10d8290ac Add tests and use ControlFlow 2023-09-05 09:19:56 -07:00
Celina G. Val
3b01f65aa5 Diferentiate between ICE and compilation error 2023-09-05 08:54:03 -07:00
Urgau
efbe445ba7 Add help to allow lint for the implied by suggestion 2023-09-04 14:21:38 +02:00
Weihang Lo
a11805ae46
feat(rustc_lint): make CheckLintName respect lint level 2023-08-30 19:24:44 +01:00
ouz-a
c2fe0bf253 Create StableMir replacer for SMirCalls 2023-08-29 16:30:50 +03:00
Oli Scherer
ad8303739f Bump syn dependency 2023-07-26 08:42:40 +00:00
Oli Scherer
cf325e8187 Bump syn now that it doesn't affect diagnostics anymore 2023-07-26 08:26:50 +00:00
Jubilee
dff07259d0
Rollup merge of #113373 - jyn514:download-rustc-fixes, r=albertlarsan68
various download-rustc fixes

separated out from https://github.com/rust-lang/rust/pull/112143 because it keeps getting stuck in limbo.

best reviewed commit-by-commit
2023-07-11 21:00:27 -07:00
jyn
30e34f3857 Don't depend on crate names in tests/ui-fulldeps/missing-rustc-driver-error.rs
Not only are they a pain to update, but they differ depending on whether `parallel-rustc` is enabled or not
2023-07-11 22:30:28 -05:00
Matthias Krüger
39f558f8cf
Rollup merge of #113412 - spastorino:smir-types-1, r=oli-obk
Add basic types to SMIR

Still incomplete but I think this can be merged and we can keep iterating over it.

r? ``@oli-obk``
2023-07-08 15:49:47 +02:00
Santiago Pastorino
9ca51b92d4
Add Float ty to SMIR 2023-07-07 13:47:55 -03:00
Santiago Pastorino
42eccffce3
Add Uint ty to SMIR 2023-07-07 13:47:33 -03:00
Santiago Pastorino
458ead41d6
Add Int ty to SMIR 2023-07-07 13:47:09 -03:00
Santiago Pastorino
73e816e37c
Add Char ty to SMIR 2023-07-07 13:46:40 -03:00
Santiago Pastorino
61adcaf87b
Add rustc_ty_to_ty basic tests 2023-07-07 13:45:54 -03:00
Josh Stone
2b091ff3e2 Bless ui-fulldeps/missing-rustc-driver-error
The specific crates have changed, but the expected "help" remains.
2023-07-03 14:27:23 -07:00
bors
08fd6f719e Auto merge of #111269 - clubby789:validate-fluent-variables, r=davidtwco
Validate fluent variable references in tests

Closes #101109

Under `cfg(test)`, the `fluent_messages` macro will emit a list of variables referenced by each message and its attributes. The derive attribute will now emit a `#[test]` that checks that each referenced variable exists in the structure it's applied to.
2023-06-28 03:47:02 +00:00
许杰友 Jieyou Xu (Joe)
cef812bd95
Provide more context for rustc +nightly -Zunstable-options on stable 2023-06-27 23:23:33 +08:00
clubby789
8969d97437 Add test for invalid variables 2023-06-23 14:20:45 +00:00
Deadbeef
4f83717cf7 Use translatable diagnostics in rustc_const_eval 2023-06-01 14:45:18 +00:00
Nicholas Nethercote
781111ef35 Use Cow in {D,Subd}iagnosticMessage.
Each of `{D,Subd}iagnosticMessage::{Str,Eager}` has a comment:
```
// FIXME(davidtwco): can a `Cow<'static, str>` be used here?
```
This commit answers that question in the affirmative. It's not the most
compelling change ever, but it might be worth merging.

This requires changing the `impl<'a> From<&'a str>` impls to `impl
From<&'static str>`, which involves a bunch of knock-on changes that
require/result in call sites being a little more precise about exactly
what kind of string they use to create errors, and not just `&str`. This
will result in fewer unnecessary allocations, though this will not have
any notable perf effects given that these are error paths.

Note that I was lazy within Clippy, using `to_string` in a few places to
preserve the existing string imprecision. I could have used `impl
Into<{D,Subd}iagnosticMessage>` in various places as is done in the
compiler, but that would have required changes to *many* call sites
(mostly changing `&format("...")` to `format!("...")`) which didn't seem
worthwhile.
2023-05-29 09:23:43 +10:00
Matthias Krüger
f1922275b7
Rollup merge of #110747 - oli-obk:smirty, r=spastorino
Encode types in SMIR

The first commit makes sure we can actually store a Ty<'tcx> (with the lifetime) in the thread local and get it back out. The second commit then introduces types.

r? `@spastorino`
2023-05-10 06:12:13 +02:00
Oli Scherer
5c6e2342f6 Encode types in SMIR 2023-05-08 14:23:19 +00:00
Oli Scherer
7f74ae57e8 Create a trait to abstract over the smir API 2023-05-08 14:23:04 +00:00
Michael Goulet
a156bd7714 Make spans a bit better 2023-05-08 03:34:46 +00:00
Michael Goulet
2b9279f313 Diagnostic args are still args if they're documented 2023-05-08 03:19:54 +00:00
Matthias Krüger
77004eafea
Rollup merge of #110610 - spastorino:smir-terminator, r=oli-obk
Add Terminator conversion from MIR to SMIR, part #1

This adds internal MIR TerminatorKind to SMIR Terminator conversion.

r? ```@oli-obk```
2023-05-06 13:30:03 +02:00
Santiago Pastorino
4b85bea4ae
Add Assert terminator to SMIR 2023-05-05 10:34:52 -03:00
Santiago Pastorino
7dd59fceef
Add Drop terminator to SMIR 2023-05-03 18:38:15 -03:00
Nicholas Nethercote
8d359e4385 Move some Encodable/Decodable tests.
Round-trip encoding/decoding of many types is tested in
`compiler/rustc_serialize/tests/opaque.rs`. There is also a small amount
of encoding/decoding testing in three files in `tests/ui-fulldeps`.

There is no obvious reason why these three files are necessary. They
were originally added in 2014. Maybe it wasn't possible for a proc
macro to run in a unit test back then?

This commit just moves the testing from those three files into the unit
test.
2023-05-02 12:02:32 +10:00
Santiago Pastorino
2f503345b4
Add Call terminator to SMIR 2023-04-20 12:00:41 -03:00
Nilstrieb
b5d3d970fa Add rustc_fluent_macro to decouple fluent from rustc_macros
Fluent, with all the icu4x it brings in, takes quite some time to
compile. `fluent_messages!` is only needed in further downstream rustc
crates, but is blocking more upstream crates like `rustc_index`. By
splitting it out, we allow `rustc_macros` to be compiled earlier, which
speeds up `x check compiler` by about 5 seconds (and even more after the
needless dependency on `serde_json` is removed from
`rustc_data_structures`).
2023-04-18 18:56:22 +00:00
jyn
d6af60266e Support x test --stage 1 ui-fulldeps
Nils had an excellent idea the other day: the same way that rustdoc is
able to load `rustc_driver` from the sysroot, ui-fulldeps tests should
also be able to load it from the sysroot. That allows us to run fulldeps
tests with stage1, without having to fully rebuild the compiler twice.
It does unfortunately have the downside that we're running the tests on
the *bootstrap* compiler, not the in-tree sources, but since most of the
fulldeps tests are for the *API* of the compiler, that seems ok.

I think it's possible to extend this to `run-make-fulldeps`, but I've
run out of energy for tonight.

- Move `plugin` tests into a subdirectory.

  Plugins are loaded at runtime with `dlopen` and so require the ABI of
  the running compile to match the ABI of the compiler linked with
  `rustc_driver`. As a result they can't be supported in stage 1 and have
  to use `// ignore-stage1`.

- Remove `ignore-stage1` from most non-plugin tests

- Ignore diagnostic tests in stage 1. Even though this requires a stage
  2 build to load rustc_driver, it's primarily testing the error message
  that the *running* compiler emits when the diagnostic struct is malformed.

- Pass `-Zforce-unstable-if-unmarked` in stage1, not just stage2. That
  allows running `hash-stable-is-unstable` in stage1, since it now
  suggests adding `rustc_private` to enable loading the crates.

- Add libLLVM.so to the stage0 target sysroot, to allow fulldeps tests
  that act as custom drivers to load it at runtime.

- Pass `--sysroot stage0-sysroot` in compiletest so that we use the
  correct version of std.
2023-04-17 22:40:31 -05:00
Yuki Okushi
425913367b
Rollup merge of #110315 - oli-obk:mor_smir, r=WaffleLapkin
Add a stable MIR way to get the main function

This is useful for analysis tools that only analyze the code paths that a specific program actually goes through. Or for code generators built on top of stable MIR.
2023-04-14 23:00:36 +09:00
Oli Scherer
e404e77c0b Add a stable MIR way to get the main function 2023-04-14 07:28:56 +00:00
jyn
2ffb0de8cf Move most ui-fulldeps tests to ui
They pass fine. Only tests that required `extern crate rustc_*` or were
marked `ignore-stage1` have been keep in fulldeps.
2023-04-13 22:08:07 -05:00
clubby789
64f7597776 Migrate most of rustc_builtin_macros to diagnostic impls
Co-authored-by: Joe ST <joe@fbstj.net>
Co-authored-by: Michael Goulet <michael@errs.io>
2023-04-10 21:16:53 +01:00
bors
32ea4bb9e3 Auto merge of #109663 - fee1-dead-contrib:rustc_macros-syn-2.0, r=Nilstrieb
migrate rustc_macros to syn 2.0

WIP at this point since I need to work on migrating the code that heavily uses `NestedMeta` for parsing. Perhaps a full refactor would be nice..
2023-04-07 03:37:21 +00:00
Deadbeef
25fdea009e fix errors 2023-04-06 04:55:58 +00:00