Commit Graph

178 Commits

Author SHA1 Message Date
Esteban Küber a9841936fe Deduplicate more sized errors on call exprs
Change the implicit `Sized` `Obligation` `Span` for call expressions to
include the whole expression. This aids the existing deduplication
machinery to reduce the number of errors caused by a single unsized
expression.
2024-01-24 02:53:15 +00:00
clubby789 2cfc81766c Special case 'generic param from outer item' message for `Self` 2024-01-14 12:31:34 +00:00
George-lewis d56cdd48cb Bless tests
Update tests
2024-01-13 12:46:58 -05:00
Oli Scherer 55cab535e7 Taint more aggressively in astconv 2024-01-11 09:03:26 +00:00
bors 94807670a6 Auto merge of #117449 - oli-obk:query_merge_immobile_game, r=matthewjasper
Avoid silencing relevant follow-up errors

r? `@matthewjasper`

This PR only adds new errors to tests that are already failing and fixes one ICE.

Several tests were changed to not emit new errors. I believe all of them were faulty tests, and not explicitly testing for the code that had new errors.
2024-01-09 22:50:49 +00:00
Oli Scherer 0978f6e010 Avoid silencing relevant follow-up errors 2024-01-09 21:08:16 +00:00
Obei Sideg a8aa6878f6 Update test for `E0796` and `static_mut_ref` lint 2024-01-07 17:29:25 +03:00
Matthew Jasper 26f48b4cba Stabilize THIR unsafeck 2024-01-05 10:00:59 +00:00
Matthew Jasper 982b49494e Remove revisions for THIR unsafeck
This is to make the diff when stabilizing it easier to review.
2024-01-05 09:30:27 +00:00
Martin Nordholts 741884dab2 rustc_lint: Prevent multiple 'incompatible with previous forbid' lints 2023-12-28 19:46:40 +01:00
Veera 286f2d819e Update existing tests 2023-12-20 22:53:56 -05:00
Michael Goulet ad00641b74 Collect lang items from AST 2023-12-15 16:12:27 +00:00
lcnr 11d16c4082 update use of feature flags 2023-12-14 15:22:37 +01:00
Eric Huss f481596ee4 Remove edition umbrella features. 2023-12-10 13:03:28 -08:00
León Orell Valerian Liehr 55559d93e7
Resolve assoc item bindings by namespace
If a const is expected, resolve a const.
If a type is expected, resolve a type.
Don't try to resolve a type first falling back to consts.
2023-12-07 22:33:56 +01:00
Michael Goulet b97ff8eb16 Add print_trait_sugared 2023-12-05 17:15:46 +00:00
zetanumbers f7617c1cd4 Enable link-arg link kind inside of #[link] attribute
- Implement link-arg as an attribute
- Apply suggestions from review
  - Co-authored-by: Vadim Petrochenkov <vadim.petrochenkov@gmail.com>
- Add unstable book entry
2023-11-30 08:26:13 -08:00
bors 37b2813a7b Auto merge of #118138 - Nilstrieb:one-previous-error, r=WaffleLapkin
Fixes error count display is different when there's only one error left

Supersedes #114759

### What did I do?

I did the small change in `rustc_errors` by hand. Then I did the other changes in `/compiler` by hand, those were just find replace on `*.rs` in the workspace. The changes in run-make are find replace for `run-make` in the workspace.

All other changes are blessed using `x test TEST --bless`. I blessed the tests that were blessed in #114759.

### how to review this nightmare

ping bors with an `r+`. You should check that my logic is sound and maybe quickly scroll through the diff, but fully verifying it seems fairly hard to impossible. I did my best to do this correctly.

Thank you `@adrianEffe` for bringing this up and your initial implementation.

cc `@flip1995,` you said you want to do a subtree sync asap
cc `@RalfJung` maybe you want to do a quick subtree sync afterwards as well for Miri

r? `@WaffleLapkin`
2023-11-24 21:40:54 +00:00
Nilstrieb 41e8d152dc Show number in error message even for one error
Co-authored-by: Adrian <adrian.iosdev@gmail.com>
2023-11-24 19:15:52 +01:00
lcnr d51ef5c1af fix intercrate ambiguity causes 2023-11-23 12:25:41 +00:00
Esteban Küber 4f7dddd4a1 recover primary span label 2023-11-16 17:00:23 +00:00
Esteban Küber 8bd8f3b090 Suggest `unwrap()` on field not found for `Result`/`Option`
When encountering a `Result<T, _>` or `Option<T>` where `T` has a field
that's being accessed, suggest calling `.unwrap()` to get to the field.
2023-11-16 17:00:23 +00:00
Esteban Küber dfa75391f8 Suggest field typo through derefs
Take into account implicit dereferences when suggesting fields.

```
error[E0609]: no field `longname` on type `Arc<S>`
  --> $DIR/suggest-field-through-deref.rs:10:15
   |
LL |     let _ = x.longname;
   |               ^^^^^^^^ help: a field with a similar name exists: `long_name`
```

CC https://github.com/rust-lang/rust/issues/78374#issuecomment-719564114
2023-11-16 17:00:23 +00:00
Takayuki Maeda 9b9ea77641
Rollup merge of #117343 - Nadrieril:cleanup_check_match, r=davidtwco
Cleanup `rustc_mir_build/../check_match.rs`

The file had become pretty unwieldy, with a fair amount of duplication. As a bonus, I discovered that we weren't running some pattern checks in if-let chains.

I recommend looking commit-by-commit. The last commit is a whim, I think it makes more sense that way but I don't hold this opinion strongly.
2023-11-04 12:44:44 +09:00
Nicholas Nethercote 5c462a32bd Remove support for compiler plugins.
They've been deprecated for four years.

This commit includes the following changes.
- It eliminates the `rustc_plugin_impl` crate.
- It changes the language used for lints in
  `compiler/rustc_driver_impl/src/lib.rs` and
  `compiler/rustc_lint/src/context.rs`. External lints are now called
  "loaded" lints, rather than "plugins" to avoid confusion with the old
  plugins. This only has a tiny effect on the output of `-W help`.
- E0457 and E0498 are no longer used.
- E0463 is narrowed, now only relating to unfound crates, not plugins.
- The `plugin` feature was moved from "active" to "removed".
- It removes the entire plugins chapter from the unstable book.
- It removes quite a few tests, mostly all of those in
  `tests/ui-fulldeps/plugin/`.

Closes #29597.
2023-11-04 08:50:46 +11:00
Nadrieril 746197c08a Tweak spans for "adt defined here" note 2023-11-03 18:26:16 +01:00
Esteban Küber 17a6ae2df3 Detect object safety errors when assoc type is missing
When an associated type with GATs isn't specified in a `dyn Trait`, emit
an object safety error instead of only complaining about the missing
associated type, as it will lead the user down a path of three different
errors before letting them know that what they were trying to do is
impossible to begin with.

Fix #103155.
2023-10-30 22:12:07 +00:00
Camille GILLOT ec28dc7aa7 Use `PlaceMention` for match scrutinees. 2023-10-24 15:30:17 +00:00
Matthias Krüger 31865b7bfb
Rollup merge of #116992 - estebank:issue-69492, r=oli-obk
Mention the syntax for `use` on `mod foo;` if `foo` doesn't exist

Newcomers might get confused that `mod` is the only way of defining scopes, and that it can be used as if it were `use`.

Fix #69492.
2023-10-21 21:23:01 +02:00
Esteban Küber 2cca435717 Mention the syntax for `use` on `mod foo;` if `foo` doesn't exist
Newcomers might get confused that `mod` is the only way of defining
scopes, and that it can be used as if it were `use`.

Fix #69492.
2023-10-21 15:56:01 +00:00
Oli Scherer 60956837cf s/Generator/Coroutine/ 2023-10-20 21:10:38 +00:00
Esteban Küber 890e92feed Unify suggestion wording 2023-10-17 17:33:55 +00:00
Ralf Jung b1ebf002c3 don't UB on dangling ptr deref, instead check inbounds on projections 2023-10-15 18:12:46 +02:00
bors 71704c4f84 Auto merge of #116623 - Nadrieril:validate-range-endpoints, r=oli-obk
Fix overflow checking in range patterns

When a range pattern contains an overflowing literal, if we're not careful we might not notice the overflow and use the wrapped value. This makes for confusing error messages because linting against overflowing literals is only done in a later pass. So when a range is invalid we check for overflows to provide a better error.

This check didn't use to handle negative types; this PR fixes that. First commit adds tests, second cleans up without changing behavior, third does the fix.

EDIT: while I was at it, I fixed a small annoyance about the span of the overflow lint on negated literals.

Fixes https://github.com/rust-lang/rust/issues/94239
2023-10-11 10:07:19 +00:00
Nadrieril 1baf8bf54d Fix range overflow checking 2023-10-11 04:55:55 +02:00
bors 59edd67056 Auto merge of #116497 - compiler-errors:impl-span, r=cjgillot
Extend `impl`'s `def_span` to include its where clauses

Typically, we highlight the def-span of an impl in a diagnostic due to either:
1. coherence error
2. trait evaluation cycle
3. invalid implementation of built-in trait

I find that an impl's where clauses are very often required to understanding why these errors come about, which is unfortunate since where clauses may be located on different lines and don't show up in the error. This PR expands the def-span of impls to include these where clauses.

r? cjgillot since you've touched this code a while back to make some spans shorter, but you can also reassign to wg-diagnostics or compiler if you're busy or have no strong opinions.
2023-10-09 21:03:41 +00:00
Michael Goulet 592163fb71 Extend impl's def_span to include where clauses 2023-10-09 11:47:02 +00:00
Ali MJ Al-Nasrawy a8830631b9 remove trailing dots 2023-10-08 10:06:17 +00:00
Ali MJ Al-Nasrawy 996ffcb718 always show and explain sub region 2023-10-08 09:59:51 +00:00
Ali MJ Al-Nasrawy 5be0b2283a improve the suggestion of generic_bound_failure 2023-10-08 09:56:57 +00:00
bors 94bc9c737e Auto merge of #114811 - estebank:impl-ambiguity, r=wesleywiser
Show more information when multiple `impl`s apply

- When there are `impl`s without type params, show only those (to avoid showing overly generic `impl`s).
```
error[E0283]: type annotations needed
  --> $DIR/multiple-impl-apply.rs:34:9
   |
LL |     let y = x.into();
   |         ^     ---- type must be known at this point
   |
note: multiple `impl`s satisfying `_: From<Baz>` found
  --> $DIR/multiple-impl-apply.rs:14:1
   |
LL | impl From<Baz> for Bar {
   | ^^^^^^^^^^^^^^^^^^^^^^
...
LL | impl From<Baz> for Foo {
   | ^^^^^^^^^^^^^^^^^^^^^^
   = note: required for `Baz` to implement `Into<_>`
help: consider giving `y` an explicit type
   |
LL |     let y: /* Type */ = x.into();
   |          ++++++++++++
```

- Lower the importance of `T: Sized`, `T: WellFormed` and coercion errors, to prioritize more relevant errors. The pre-existing deduplication logic deals with hiding redundant errors better that way, and we show errors with more metadata that is useful to the user.

- Show `<SelfTy as Trait>::assoc_fn` suggestion in more cases.
```
error[E0790]: cannot call associated function on trait without specifying the corresponding `impl` type
  --> $DIR/cross-return-site-inference.rs:38:16
   |
LL |     return Err(From::from("foo"));
   |                ^^^^^^^^^^ cannot call associated function of trait
   |
help: use a fully-qualified path to a specific available implementation
   |
LL |     return Err(</* self type */ as From>::from("foo"));
   |                +++++++++++++++++++     +
```

Fix #88284.
2023-10-06 18:44:32 +00:00
Alex Macleod 5453a9f34d Add a note to duplicate diagnostics 2023-10-05 01:04:41 +00:00
Esteban Küber 91b9ffeab0 Reorder fullfillment errors to keep more interesting ones first
In `report_fullfillment_errors` push back `T: Sized`, `T: WellFormed`
and coercion errors to the end of the list. The pre-existing
deduplication logic eliminates redundant errors better that way, keeping
the resulting output with fewer errors than before, while also having
more detail.
2023-10-04 02:04:14 +00:00
Esteban Küber 2817ece19c Show more information when multiple `impl` apply 2023-10-04 02:04:13 +00:00
bors 958c2b87d8 Auto merge of #115821 - obeis:hir-analysis-migrate-diagnostics-5, r=compiler-errors
Migrate `rustc_hir_analysis` to session diagnostic [Part 5]

Finishing `coherence/builtin.rs` file
2023-09-29 00:24:57 +00:00
Matthias Krüger 6f4a0a1eb2
Rollup merge of #116162 - fmease:gate-n-validate-rustc_safe_intrinsic, r=Nilstrieb
Gate and validate `#[rustc_safe_intrinsic]`

Copied over from #116159:

> This was added as ungated in https://github.com/rust-lang/rust/pull/100719/files#diff-09c366d3ad3ec9a42125253b610ca83cad6b156aa2a723f6c7e83eddef7b1e8fR502, probably because the author looked at the surrounding attributes, which are ungated because they are gated specially behind the staged_api feature.
>
> I don't think we need to crater this, the attribute is entirely useless without the intrinsics feature, which is already unstable..

r? ``@Nilstrieb``
2023-09-26 15:57:26 +02:00
León Orell Valerian Liehr f54db7c3a9
Gate and validate #[rustc_safe_intrinsic] 2023-09-25 22:33:15 +02:00
Matthias Krüger 952d6608fc
Rollup merge of #116062 - eduardosm:start-fn-diag, r=WaffleLapkin
Change `start` to `#[start]` in some diagnosis

They refer to a function with the `start` attribute, but not necessarily named `start`.
2023-09-22 23:12:37 +02:00
bors 959b2c703d Auto merge of #115696 - RalfJung:closure-ty-print, r=oli-obk
adjust how closure/generator types are printed

I saw `&[closure@$DIR/issue-20862.rs:2:5]` and I thought it is a slice type, because that's usually what `&[_]` is... it took me a while to realize that this is just a confusing printer and actually there's no slice. Let's use something that cannot be mistaken for a regular type.
2023-09-22 15:19:38 +00:00
Eduardo Sánchez Muñoz 17dfabff9c Change `start` to `#[start]` in some diagnosis
They refer to a function with the `start` attribute, but not necessarily named `start`.
2023-09-22 15:58:43 +02:00
Ralf Jung c4ec12f4b7 adjust how closure/generator types and rvalues are printed 2023-09-21 22:20:58 +02:00
Obei Sideg 77e205a113 Migrate `rustc_hir_analysis` to session diagnostic
Part 5: Finishing `coherence/builtin.rs` file
2023-09-20 10:56:44 +03:00
Eduardo Sánchez Muñoz c599761140 rustc_hir_analysis: add a helper to check function the signature mismatches
This function is now used to check `#[panic_handler]`, `start` lang item, `main`, `#[start]` and intrinsic functions.

The diagnosis produced are now closer to the ones produced by trait/impl method signature mismatch.
2023-09-19 18:15:23 +02:00
clubby789 c2841e2a1e Migrate 'cast to bool' diagnostic 2023-09-18 14:03:57 +00:00
clubby789 6e2adbf6a3 Migrate 'explicit destructor call' diagnostic 2023-09-15 14:24:58 +00:00
Matthias Krüger 32cf2c4b68
Rollup merge of #115765 - asquared31415:cast_diag, r=WaffleLapkin
Add source type for invalid bool casts

Also adds tests for casting various types to `bool` that were otherwise untested.

r? `@WaffleLapkin`
2023-09-12 06:34:46 +02:00
asquared31415 e36adff4c2 add source type for invalid bool casts 2023-09-11 18:10:07 +00:00
Matthias Krüger 8b49731211
Rollup merge of #115744 - fmease:fix-e0401, r=compiler-errors
Improve diagnostic for generic params from outer items (E0401)

Generalize the wording of E0401 to talk about *outer items* instead of *outer functions* since the current phrasing is outdated. The outer item can be a function, constant, trait, ADT or impl block (see the new UI test for the more exotic examples).

Further, don't suggest introducing generic parameters to constant items unless the feature `generic_const_items` is enabled.

Lastly, make E0401 translatable while we're at it.

Fixes #115720.
2023-09-11 17:03:32 +02:00
Matthias Krüger f279afb455
Rollup merge of #115743 - compiler-errors:no-impls, r=davidtwco
Point out if a local trait has no implementations

Slightly helps with #115741
2023-09-11 17:03:32 +02: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
Michael Goulet 30e6cea0ae Point out if a local trait has no implementations 2023-09-10 21:20:36 +00:00
León Orell Valerian Liehr b00e408e61
Generalize E0401 2023-09-10 23:06:14 +02:00
Lieselotte 96c96645c7
Improve "associated type not found" diagnostics 2023-09-08 06:52:17 +02:00
bors 1accf068d8 Auto merge of #113126 - Bryanskiy:delete_old, r=petrochenkov
Replace old private-in-public diagnostic with type privacy lints

Next part of RFC https://github.com/rust-lang/rust/issues/48054.

r? `@petrochenkov`
2023-09-01 12:40:01 +00:00
Weihang Lo a11805ae46
feat(rustc_lint): make `CheckLintName` respect lint level 2023-08-30 19:24:44 +01:00
Kevin Reid 7b837e075a Don't suggest adding parentheses to call an inaccessible method.
Previously, the test code would emit E0615, thus revealing the existence
of private methods that the programmer probably does not care about.
Now it ignores their existence instead, producing error E0609 (no field).

The motivating example is:

```rust
let x = std::rc::Rc::new(());
x.inner;
```

which would previously mention the private method `Rc::inner()`, even
though `Rc<T>` intentionally has no public methods so that it can be a
transparent smart pointer for any `T`.
2023-08-29 14:47:28 -07:00
David Tolnay 823bacb6e3
Revert "Suggest using `Arc` on `!Send`/`!Sync` types"
This reverts commit 9de1a472b6.
2023-08-28 03:16:48 -07:00
Esteban Kuber 9de1a472b6 Suggest using `Arc` on `!Send`/`!Sync` types 2023-08-09 14:04:10 +00:00
Nilstrieb 5706be1854 Improve spans for indexing expressions
Indexing is similar to method calls in having an arbitrary
left-hand-side and then something on the right, which is the main part
of the expression. Method calls already have a span for that right part,
but indexing does not. This means that long method chains that use
indexing have really bad spans, especially when the indexing panics and
that span in coverted into a panic location.

This does the same thing as method calls for the AST and HIR, storing an
extra span which is then put into the `fn_span` field in THIR.
2023-08-04 13:17:39 +02:00
Bryanskiy e26614e6a7 Replace old private-in-public diagnostic with type privacy lints 2023-08-02 13:40:28 +03:00
bors bd1ae282f1 Auto merge of #113893 - mdibaiee:type-name-spill-flag, r=compiler-errors
new unstable option: -Zwrite-long-types-to-disk

This option guards the logic of writing long type names in files and instead using short forms in error messages in rustc_middle/ty/error behind a flag. The main motivation for this change is to disable this behaviour when running ui tests.

This logic can be triggered by running tests in a directory that has a long enough path, e.g. /my/very-long-path/where/rust-codebase/exists/

This means ui tests can fail depending on how long the path to their file is.

Some ui tests actually rely on this behaviour for their assertions, so for those we enable the flag manually.
2023-07-26 00:46:06 +00:00
Mahdi Dibaiee b2d052b22d write-long-types-to-disk: update tests 2023-07-25 12:08:44 +01:00
Mahdi Dibaiee 8df39667dc new unstable option: -Zwrite-long-types-to-disk
This option guards the logic of writing long type names in files and
instead using short forms in error messages in rustc_middle/ty/error
behind a flag. The main motivation for this change is to disable this
behaviour when running ui tests.

This logic can be triggered by running tests in a directory that has a
long enough path, e.g. /my/very-long-path/where/rust-codebase/exists/

This means ui tests can fail depending on how long the path to their
file is.

Some ui tests actually rely on this behaviour for their assertions,
so for those we enable the flag manually.
2023-07-24 12:25:05 +01:00
lcnr e449daad6c stop mentioning number of applicate implementations 2023-07-16 15:36:19 +02:00
Michael Goulet fe870424a7 Do not set up wrong span for adjustments 2023-07-10 20:09:26 +00:00
Matthias Krüger 207b24413c
Rollup merge of #113177 - estebank:hrlt-sugg, r=compiler-errors
Use structured suggestion when telling user about `for<'a>`

```
error[E0637]: `&` without an explicit lifetime name cannot be used here
  --> $DIR/E0637.rs:13:13
   |
LL |     T: Into<&u32>,
   |             ^ explicit lifetime name needed here
   |
help: consider introducing a higher-ranked lifetime here
   |
LL |     T: for<'a> Into<&'a u32>,
   |        +++++++       ++
```
2023-06-30 08:01:14 +02:00
Esteban Küber 7d33094d3a Use structured suggestion when telling user about `for<'a>`
```
error[E0637]: `&` without an explicit lifetime name cannot be used here
  --> $DIR/E0637.rs:13:13
   |
LL |     T: Into<&u32>,
   |             ^ explicit lifetime name needed here
   |
help: consider introducing a higher-ranked lifetime here
   |
LL |     T: for<'a> Into<&'a u32>,
   |        +++++++       ++
```
2023-06-30 00:34:14 +00:00
Bryanskiy 35c6a1d0f3 Fix type privacy lints error message 2023-06-29 16:24:07 +03:00
Matthias Krüger 42a495da7e
Rollup merge of #112670 - petrochenkov:typriv, r=eholk
privacy: Type privacy lints fixes and cleanups

See individual commits.
Follow up to https://github.com/rust-lang/rust/pull/111801.
2023-06-29 05:48:39 +02:00
Alexander Zhang 48167bd4bd Avoid guessing unknown trait impl in suggestions
When a trait is used without specifying the implementation (e.g. calling
a non-member associated function without fully-qualified syntax) and
there are multiple implementations available, use a placeholder comment
for the implementation type in the suggestion instead of picking a
random implementation.

Example:

```
fn main() {
    let _ = Default::default();
}
```

Previous output:

```
error[E0790]: cannot call associated function on trait without specifying the corresponding `impl` type
 --> test.rs:2:13
  |
2 |     let _ = Default::default();
  |             ^^^^^^^^^^^^^^^^ cannot call associated function of trait
  |
help: use a fully-qualified path to a specific available implementation (273 found)
  |
2 |     let _ = <FileTimes as Default>::default();
  |             +++++++++++++        +
```

New output:

```
error[E0790]: cannot call associated function on trait without specifying the corresponding `impl` type
 --> test.rs:2:13
  |
2 |     let _ = Default::default();
  |             ^^^^^^^^^^^^^^^^ cannot call associated function of trait
  |
help: use a fully-qualified path to a specific available implementation (273 found)
  |
2 |     let _ = </* self type */ as Default>::default();
  |             +++++++++++++++++++        +
```
2023-06-22 16:37:52 -07:00
Vadim Petrochenkov d326aed46f privacy: Feature gate new type privacy lints 2023-06-15 21:25:47 +03:00
Bryanskiy 6d46382f6f Private-in-public lints implementation 2023-06-12 01:02:19 +03:00
Michael Goulet 140c011ca6 Don't mention already set fields 2023-06-05 21:00:08 +00:00
Michael Goulet 795fdf7d61 Simplify suggestion when returning bare dyn trait 2023-05-18 01:47:55 +00:00
Matthias Krüger 363d158cd8
Rollup merge of #111215 - BoxyUwU:resolve_anon_consts_differently, r=cjgillot
Various changes to name resolution of anon consts

Sorry this PR is kind of all over the place ^^'

Fixes #111012

- Rewrites anon const nameres to all go through `fn resolve_anon_const` explicitly instead of `visit_anon_const` to ensure that we do not accidentally resolve anon consts as if they are allowed to use generics when they aren't. Also means that we dont have bits of code for resolving anon consts that will get out of sync (i.e. legacy const generics and resolving path consts that were parsed as type arguments)
- Renames two of the `LifetimeRibKind`, `AnonConst -> ConcreteAnonConst` and `ConstGeneric -> ConstParamTy`
- Noticed while doing this that under `generic_const_exprs` all lifetimes currently get resolved to errors without any error being emitted which was causing a bunch of tests to pass without their bugs having been fixed, incidentally fixed that in this PR and marked those tests as `// known-bug:`. I'm fine to break those since `generic_const_exprs` is a very unstable incomplete feature and this PR _does_ make generic_const_exprs "less broken" as a whole, also I can't be assed to figure out what the underlying causes of all of them are. This PR reopens #77357 #83993
- Changed `generics_of` to stop providing generics and predicates to enum variant discriminant anon consts since those are not allowed to use generic parameters
- Updated the error for non 'static lifetime in const arguments and the error for non 'static lifetime in const param tys to use `derive(Diagnostic)`

I have a vague idea why const-arg-in-const-arg.rs, in-closure.rs and simple.rs have started failing which is unfortunate since these were deliberately made to work, I think lifetime resolution being broken just means this regressed at some point and nobody noticed because the tests were not testing anything :( I'm fine breaking these too for the same reason as the tests for #77357 #83993. I couldn't get `// known-bug` to work for these ICEs and just kept getting different stderr between CI and local `--bless` so I just removed them and will create an issue to track re-adding (and fixing) the bugs if this PR lands.

r? `@cjgillot` cc `@compiler-errors`
2023-05-09 20:49:32 +02:00
Boxy 73b3ce26ec improve diagnostics and bless tests 2023-05-05 21:42:54 +01:00
Ezra Shaw fd8aa5ec7d
tweak "make mut" spans when assigning to locals 2023-05-05 22:40:04 +12:00
Vadim Petrochenkov 6f6c379ee0 rustc_middle: Fix `opt_item_ident` for non-local def ids 2023-05-03 20:09:10 +03:00
Michael Goulet bec7193072 Don't use implied trait predicates in gather_explicit_predicates_of 2023-05-01 15:45:28 +00:00
Josh Soref e09d0d2a29 Spelling - compiler
* account
* achieved
* advising
* always
* ambiguous
* analysis
* annotations
* appropriate
* build
* candidates
* cascading
* category
* character
* clarification
* compound
* conceptually
* constituent
* consts
* convenience
* corresponds
* debruijn
* debug
* debugable
* debuggable
* deterministic
* discriminant
* display
* documentation
* doesn't
* ellipsis
* erroneous
* evaluability
* evaluate
* evaluation
* explicitly
* fallible
* fulfill
* getting
* has
* highlighting
* illustrative
* imported
* incompatible
* infringing
* initialized
* into
* intrinsic
* introduced
* javascript
* liveness
* metadata
* monomorphization
* nonexistent
* nontrivial
* obligation
* obligations
* offset
* opaque
* opportunities
* opt-in
* outlive
* overlapping
* paragraph
* parentheses
* poisson
* precisely
* predecessors
* predicates
* preexisting
* propagated
* really
* reentrant
* referent
* responsibility
* rustonomicon
* shortcircuit
* simplifiable
* simplifications
* specify
* stabilized
* structurally
* suggestibility
* translatable
* transmuting
* two
* unclosed
* uninhabited
* visibility
* volatile
* workaround

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
2023-04-17 16:09:18 -04:00
Esteban Küber 5b40aa5eb4 Tweak output for 'add line' suggestion 2023-04-12 22:50:10 +00:00
Yuki Okushi 788de4701e
Rollup merge of #109923 - ElectrifyPro:visibility, r=wesleywiser
Update `error [E0449]: unnecessary visibility qualifier` to be more clear

This updates the error message `error[E0449]: unnecessary visibility qualifier` by clearly indicating that visibility qualifiers already inherit their visibility from a parent item. The error message previously implied that the qualifiers were permitted, which is not the case anymore.

Resolves #109822.
2023-04-11 12:18:50 +09:00
Tam Pham 4e5c120f33 Update ui tests involving invalid visibility qualifiers 2023-04-03 22:28:55 -05:00
Camille GILLOT 05082f57af Perform match checking on THIR. 2023-04-03 15:59:21 +00:00
lcnr c63861b9d5 evaluate: improve and fix recursion depth handling 2023-03-21 09:57:22 +01:00
clubby789 dd7df04e16 Remove uses of `box_syntax` in rustc and tools 2023-03-12 13:19:46 +00:00
Michael Goulet a439c0293c may not => cannot 2023-03-08 00:00:18 +00:00
Ezra Shaw 9f876cc900
docs/test: add UI test and docs for `E0476` 2023-02-25 19:31:02 +13:00
Michael Howell a5b639dc01 diagnostics: remove inconsistent English article "this" from E0107
Consider `tests/ui/const-generics/generic_const_exprs/issue-102768.stderr`,
the error message where it gives additional notes about where the associated
type is defined, and how the dead code lint doesn't have an article,
like in `tests/ui/lint/dead-code/issue-85255.stderr`. They don't have
articles, so it seems unnecessary to have one here.
2023-02-23 10:27:06 -07:00
Michael Howell 3f374128ee diagnostics: update test cases to refer to assoc fn with `self` as method 2023-02-22 08:40:47 -07:00