about summary refs log tree commit diff
path: root/src/test/ui/parser
AgeCommit message (Collapse)AuthorLines
2022-11-07Make underscore_literal_suffix a hard error.Nicholas Nethercote-9/+21
It's been a warning for 5.5 years. Time to make it a hard error. Closes #42326.
2022-11-06Auto merge of #99943 - compiler-errors:tuple-trait, r=jackh726bors-8/+8
Implement `std::marker::Tuple`, use it in `extern "rust-call"` and `Fn`-family traits Implements rust-lang/compiler-team#537 I made a few opinionated decisions in this implementation, specifically: 1. Enforcing `extern "rust-call"` on fn items during wfcheck, 2. Enforcing this for all functions (not just ones that have bodies), 3. Gating this `Tuple` marker trait behind its own feature, instead of grouping it into (e.g.) `unboxed_closures`. Still needing to be done: 1. Enforce that `extern "rust-call"` `fn`-ptrs are well-formed only if they have 1/2 args and the second one implements `Tuple`. (Doing this would fix ICE in #66696.) 2. Deny all explicit/user `impl`s of the `Tuple` trait, kinda like `Sized`. 3. Fixing `Tuple` trait built-in impl for chalk, so that chalkification tests are un-broken. Open questions: 1. Does this need t-lang or t-libs signoff? Fixes #99820
2022-11-05Merge conflicts and rebase onto masterMichael Goulet-8/+8
2022-11-04Don't silently eat label before block in block-like exprMichael Goulet-0/+219
2022-11-04fake a base to suppress later extra error messageyukang-24/+21
2022-11-04Make non-ASCII errors more consistent.Nicholas Nethercote-30/+30
There are three kinds of "byte" literals: byte literals, byte string literals, and raw byte string literals. None are allowed to have non-ASCII chars in them. Two `EscapeError` variants exist for when that constraint is violated. - `NonAsciiCharInByte`: used for byte literals and byte string literals. - `NonAsciiCharInByteString`: used for raw byte string literals. As a result, the messages for raw byte string literals use different wording, without good reason. Also, byte string literals are incorrectly described as "byte constants" in some error messages. This commit eliminates `NonAsciiCharInByteString` so the three cases are handled similarly, and described correctly. The `mode` is enough to distinguish them. Note: Some existing error messages mention "byte constants" and some mention "byte literals". I went with the latter here, because it's a more correct name, as used by the Reference.
2022-11-04fix #102806, suggest use .. to fill in the rest of the fields of Structyukang-0/+73
2022-10-26Rollup merge of #95710 - ↵Dylan DPC-59/+0
fee1-dead-contrib:stabilize_arbitrary_enum_discriminant, r=joshtriplett Stabilize arbitrary_enum_discriminant, take 2 Documentation has been updated in https://github.com/rust-lang/reference/pull/1055. cc #86860 for previous stabilization report. Not yet marks https://github.com/rust-lang/rust/issues/60553 as done: need documentation in the rust reference.
2022-10-26Rollup merge of #103444 - chenyukang:yukang/fix-103425-extra-diag, r=davidtwcoDylan DPC-0/+44
Remove extra type error after missing semicolon error Fixes #103425
2022-10-25Fix #103451, find_width_of_character_at_span return width with 1 when ↵yukang-0/+37
reaching end
2022-10-25Rollup merge of #103333 - chenyukang:yukang/fix-103143, r=wesleywiserYuki Okushi-0/+25
Fix assertion failed for break_last_token and trailing token Fixes #103143
2022-10-24fix #103425, remove extra type error after missing semicolon erroryukang-0/+44
2022-10-23Rollup merge of #101293 - compiler-errors:lt-is-actually-char, r=estebankDylan DPC-12/+112
Recover when unclosed char literal is parsed as a lifetime in some positions Fixes #101278
2022-10-22Don't erroneously deny semicolons after closure expr within parentheses in a ↵Michael Goulet-0/+14
macro
2022-10-22Recover unclosed char literal being parsed as lifetimeMichael Goulet-12/+112
2022-10-22Stabilize arbitrary_enum_discriminant, take 2Deadbeef-59/+0
2022-10-20fix assertion failed for break_last_token and trailing tokenyukang-0/+25
2022-10-18Clean up query descriptionsnils-3/+3
Use the same tense everywhere and prefer display over debug, as these descriptions are user facing.
2022-10-14Rollup merge of #102938 - c410-f3r:here-we-go-again, r=petrochenkovDylan DPC-0/+7
Move some tests to more reasonable directories r? ``@petrochenkov``
2022-10-13Move some tests to more reasonable directoriesCaio-0/+7
2022-10-11Fix let removal suggestion in structMichael Goulet-6/+70
2022-10-10Rollup merge of #101789 - gimbles:let, r=estebankMatthias Krüger-2/+8
`let`'s not needed in struct field definitions Fixes #101683
2022-10-10`let` is not allowed in struct field definitionsgimbles-2/+8
Co-authored-by: jyn514 <jyn514@gmail.com> Co-authored-by: Esteban Kuber <estebank@users.noreply.github.com>
2022-10-10Rollup merge of #102345 - chenyukang:fix-102182-impl-trait, r=estebankYuki Okushi-0/+17
Recover from impl Trait in type param bound Fixes #102182 r? ``@estebank``
2022-10-08Stabilize half_open_range_patternsUrgau-118/+114
2022-10-08fix #102182, recover from impl Trait in type param boundyukang-0/+17
2022-10-06Rollup merge of #102694 - compiler-errors:fn-to-method, r=davidtwcoMatthias Krüger-27/+27
Suggest calling method if fn does not exist I tried to split this up into two commits, the first where we stash the resolution error until typeck (which causes a bunch of diagnostics changes because the ordering of error messages change), then the second commit is the actual logic that actually implements the suggestion. I am not in love with the presentation of the suggestion, so I could use some advice for how to format the actual messaging. r? diagnostics Fixes #102518
2022-10-05Delay function resolution error until typeckMichael Goulet-27/+27
2022-10-05Suggest `.into()` when all other coercion suggestions failMichael Goulet-14/+0
2022-10-01Auto merge of #101986 - WaffleLapkin:move_lint_note_to_the_bottom, r=estebankbors-10/+10
Move lint level source explanation to the bottom So, uhhhhh r? `@estebank` ## User-facing change "note: `#[warn(...)]` on by default" and such are moved to the bottom of the diagnostic: ```diff - = note: `#[warn(unsupported_calling_conventions)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #87678 <https://github.com/rust-lang/rust/issues/87678> + = note: `#[warn(unsupported_calling_conventions)]` on by default ``` Why warning is enabled is the least important thing, so it shouldn't be the first note the user reads, IMO. ## Developer-facing change `struct_span_lint` and similar methods have a different signature. Before: `..., impl for<'a> FnOnce(LintDiagnosticBuilder<'a, ()>)` After: `..., impl Into<DiagnosticMessage>, impl for<'a, 'b> FnOnce(&'b mut DiagnosticBuilder<'a, ()>) -> &'b mut DiagnosticBuilder<'a, ()>` The reason for this is that `struct_span_lint` needs to edit the diagnostic _after_ `decorate` closure is called. This also makes lint code a little bit nicer in my opinion. Another option is to use `impl for<'a> FnOnce(LintDiagnosticBuilder<'a, ()>) -> DiagnosticBuilder<'a, ()>` altough I don't _really_ see reasons to do `let lint = lint.build(message)` everywhere. ## Subtle problem By moving the message outside of the closure (that may not be called if the lint is disabled) `format!(...)` is executed earlier, possibly formatting `Ty` which may call a query that trims paths that crashes the compiler if there were no warnings... I don't think it's that big of a deal, considering that we move from `format!(...)` to `fluent` (which is lazy by-default) anyway, however this required adding a workaround which is unfortunate. ## P.S. I'm sorry, I do not how to make this PR smaller/easier to review. Changes to the lint API affect SO MUCH 😢
2022-10-01Recover wrong cased keywords starting functionsMaybe Waffle-3/+129
2022-10-01recover wrong-cased `use`s (`Use`, `USE`, etc)Maybe Waffle-0/+28
2022-10-01bless ui testsMaybe Waffle-10/+10
2022-09-30Rollup merge of #102350 - TaKO8Ki:incomplete-fn-in-struct-definition, ↵Matthias Krüger-5/+7
r=fee1-dead Improve errors for incomplete functions in struct definitions Given the following code: ```rust fn main() {} struct Foo { fn } ``` [playground](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=29139f870511f6918324be5ddc26c345) The current output is: ``` Compiling playground v0.0.1 (/playground) error: functions are not allowed in struct definitions --> src/main.rs:4:5 | 4 | fn | ^^ | = help: unlike in C++, Java, and C#, functions are declared in `impl` blocks = help: see https://doc.rust-lang.org/book/ch05-03-method-syntax.html for more information error: could not compile `playground` due to previous error ``` In this case, rustc should suggest escaping `fn` to use it as an identifier.
2022-09-29improve E0585 helpRageking8-18/+18
2022-09-28Auto merge of #101619 - Xiretza:rustc_parse-session-diagnostics, r=davidtwcobors-17/+17
Migrate more of rustc_parse to SessionDiagnostic Still far from complete, but I thought I'd add a checkpoint here because rebasing was starting to get annoying.
2022-09-27Rollup merge of #102284 - compiler-errors:missing-type-in-raw-ptr, r=davidtwcoMatthias Krüger-4/+31
Structured suggestion for missing `mut`/`const` in raw pointer Fixes #102261
2022-09-27Rework "inner attribute not permitted" errorsXiretza-1/+1
2022-09-27Migrate "invalid literal suffix" diagnostic to diagnostic structsXiretza-16/+16
2022-09-28improve errors for incomplete functions in struct definitionsTakayuki Maeda-5/+7
2022-09-27Structured suggestion for missing mut/const in pointerMichael Goulet-4/+31
2022-09-27fix a ui testTakayuki Maeda-0/+2
2022-09-27add a label to struct/enum/union ident nameTakayuki Maeda-3/+38
2022-09-26Rollup merge of #102286 - compiler-errors:recover-semi-in-block-item, ↵Matthias Krüger-4/+45
r=davidtwco Recover some items that expect braces and don't take semicolons Fixes #102262
2022-09-26Rollup merge of #102143 - Rageking8:fix-101540, r=TaKO8Kifee1-dead-0/+17
Recover from struct nested in struct Fixes #101540 r? `@TaKO8Ki` Not sure If I have done it right.
2022-09-25Recover some items that expect braces and don't take semicolonsMichael Goulet-4/+45
2022-09-23Auto merge of #102165 - matthiaskrgr:rollup-n5oquhe, r=matthiaskrgrbors-4/+4
Rollup of 8 pull requests Successful merges: - #100734 (Split out async_fn_in_trait into a separate feature) - #101664 (Note if mismatched types have a similar name) - #101815 (Migrated the rustc_passes annotation without effect diagnostic infrastructure) - #102042 (Distribute rust-docs-json via rustup.) - #102066 (rustdoc: remove unnecessary `max-width` on headers) - #102095 (Deduplicate two functions that would soon have been three) - #102104 (Set 'exec-env:RUST_BACKTRACE=0' in const-eval-select tests) - #102112 (Allow full relro on powerpc64-unknown-linux-gnu) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-09-22Improve the help message for an invalid calling conventionkhyperia-1/+1
2022-09-23Fix slight issues with stderrRageking8-2/+3
2022-09-23Change UI test stderrRageking8-4/+3