about summary refs log tree commit diff
path: root/src/test/ui/issues
AgeCommit message (Collapse)AuthorLines
2022-03-02Rollup merge of #94464 - kckeiks:lifetime-elision-mismatch-hint-for-traits, ↵Matthias Krüger-0/+6
r=estebank Suggest adding a new lifetime parameter when two elided lifetimes should match up for traits and impls. Suggest adding a new lifetime parameter when two elided lifetimes should match up for functions in traits and impls. Issue #94462
2022-02-28Suggest adding a new lifetime parameter when two elided lifetimes should ↵Fausto-0/+6
match up for traits and impls. Issue #94462
2022-02-28Rollup merge of #94449 - GuillaumeGomez:explanation-e0726, r=UrgauMatthias Krüger-1/+2
Add long explanation for E0726 This is the cleaned up version of #87655 with the missing fixes. Part of https://github.com/rust-lang/rust/issues/61137. r? `@Urgau`
2022-02-28Tweak diagnosticsEsteban Kuber-4/+6
* Recover from invalid `'label: ` before block. * Make suggestion to enclose statements in a block multipart. * Point at `match`, `while`, `loop` and `unsafe` keywords when failing to parse their expression. * Do not suggest `{ ; }`. * Do not suggest `|` when very unlikely to be what was wanted (in `let` statements).
2022-02-28Update ui test with the add of E0726 explanationGuillaume Gomez-1/+2
2022-02-26Auto merge of #94078 - ↵bors-0/+4
TaKO8Ki:suggest-float-literal-for-float-divided-by-integer, r=estebank Suggest a float literal when dividing a floating-point type by `{integer}` closes #93829
2022-02-26suggest a float literal when dividing a floating-point type by {integer}Takayuki Maeda-0/+4
fix a message implement a rustfix-applicable suggestion implement `suggest_floating_point_literal` add `ObligationCauseCode::BinOp` remove duplicate code fix function names in uitests use `Diagnostic` instead of `DiagnosticBuilder`
2022-02-25Do not suggest using a const parameter when there are bounds on an unused ↵Chayim Refael Friedman-2/+0
type parameter The user wrote the bound, so it's obvious they want a type.
2022-02-19Rollup merge of #93658 - cchiw:issue-77443-fix, r=joshtriplettMatthias Krüger-1/+0
Stabilize `#[cfg(panic = "...")]` [Stabilization PR](https://rustc-dev-guide.rust-lang.org/stabilization_guide.html#stabilization-pr) for #77443
2022-02-18Rollup merge of #92806 - compiler-errors:better-impl-trait-deny, r=estebankMatthias Krüger-8/+8
Add more information to `impl Trait` error Fixes #92458 Let me know if I went overboard here, or if the suggestions could use some refinement. r? `@estebank` Feel free to reassign to someone else
2022-02-18Rollup merge of #92959 - asquared31415:test-non-fn-help, r=estebankMatthias Krüger-14/+0
Add more info and suggestions to use of #[test] on invalid items This pr changes the diagnostics for using `#[test]` on an item that can't be used as a test to explain that the attribute has no meaningful effect on non-functions and suggests the use of `#[cfg(test)]` for conditional compilation instead. Example change: ```rs #[test] mod test {} ``` previously output ``` error: only functions may be used as tests --> src/lib.rs:2:1 | 2 | mod test {} | ^^^^^^^^^^^ ``` now outputs ``` error: the `#[test]` attribute may only be used on a non-associated function --> $DIR/test-on-not-fn.rs:3:1 | LL | #[test] | ^^^^^^^ LL | mod test {} | ----------- expected a non-associated function, found a module | = note: the `#[test]` macro causes a a function to be run on a test and has no effect on non-functions help: replace with conditional compilation to make the item only exist when tests are being run | LL | #[cfg(test)] | ~~~~~~~~~~~~ ```
2022-02-17fix impl trait message, bless testsMichael Goulet-16/+8
2022-02-17Add more information to `impl Trait` deny errorMichael Goulet-4/+12
2022-02-17Revert "Auto merge of #91403 - cjgillot:inherit-async, r=oli-obk"Oli Scherer-7/+11
This reverts commit 3cfa4def7c87d571bd46d92fed608edf8fad236e, reversing changes made to 5d8767cb229b097fedb1dd4bd9420d463c37774f.
2022-02-15Overhaul `RegionKind` and `Region`.Nicholas Nethercote-2/+2
Specifically, change `Region` from this: ``` pub type Region<'tcx> = &'tcx RegionKind; ``` to this: ``` pub struct Region<'tcx>(&'tcx Interned<RegionKind>); ``` This now matches `Ty` and `Predicate` more closely. Things to note - Regions have always been interned, but we haven't been using pointer-based `Eq` and `Hash`. This is now happening. - I chose to impl `Deref` for `Region` because it makes pattern matching a lot nicer, and `Region` can be viewed as just a smart wrapper for `RegionKind`. - Various methods are moved from `RegionKind` to `Region`. - There is a lot of tedious sigil changes. - A couple of types like `HighlightBuilder`, `RegionHighlightMode` now have a `'tcx` lifetime because they hold a `Ty<'tcx>`, so they can call `mk_region`. - A couple of test outputs change slightly, I'm not sure why, but the new outputs are a little better.
2022-02-13Rollup merge of #93810 - matthewjasper:chalk-and-canonical-universes, r=jackh726Matthias Krüger-32/+32
Improve chalk integration - Support subtype bounds in chalk lowering - Handle universes in canonicalization - Handle type parameters in chalk responses - Use `chalk_ir::LifetimeData::Empty` for `ty::ReEmpty` - Remove `ignore-compare-mode-chalk` for tests that no longer hang (they may still fail or ICE) This is enough to get a hello world program to compile with `-Zchalk` now. Some of the remaining issues that are needed to get Chalk integration working on larger programs are: - rust-lang/chalk#234 - rust-lang/chalk#548 - rust-lang/chalk#734 - Generators are handled differently in chalk and rustc r? `@jackh726`
2022-02-13Rollup merge of #90532 - fee1-dead:improve-const-fn-err-msg, r=oli-obkMatthias Krüger-6/+27
More informative error message for E0015 Helps with #92380
2022-02-12Auto merge of #91403 - cjgillot:inherit-async, r=oli-obkbors-11/+7
Inherit lifetimes for async fn instead of duplicating them. The current desugaring of `async fn foo<'a>(&usize) -> &u8` is equivalent to ```rust fn foo<'a, '0>(&'0 usize) -> foo<'static, 'static>::Opaque<'a, '0, '_>; type foo<'_a, '_0>::Opaque<'a, '0, '1> = impl Future<Output = &'1 u8>; ``` following the RPIT model. Duplicating all the inherited lifetime parameters and setting the inherited version to `'static` makes lowering more complex and causes issues like #61949. This PR removes the duplication of inherited lifetimes to directly use ```rust fn foo<'a, '0>(&'0 usize) -> foo<'a, '0>::Opaque<'_>; type foo<'a, '0>::Opaque<'1> = impl Future<Output = &'1 u8>; ``` following the TAIT model. Fixes https://github.com/rust-lang/rust/issues/61949
2022-02-12Auto merge of #93697 - the8472:fix-windows-path-hash, r=Mark-Simulacrumbors-0/+1
Fix hashing for windows paths containing a CurDir component * the logic only checked for / but not for \ * verbatim paths shouldn't skip items at all since they don't get normalized * the extra branches get optimized out on unix since is_sep_byte is a trivial comparison and is_verbatim is always-false * tests lacked windows coverage for these cases That lead to equal paths not having equal hashes and to unnecessary collisions.
2022-02-12Update chalk testsMatthew Jasper-32/+32
2022-02-12ignore test on wasm32The 8472-0/+1
A fix applied to std::Path::hash triggers a miscompilation/assert in LLVM in this test on wasm32. The miscompilation appears to pre-existing. Reverting some previous changes done std::Path also trigger it and slight modifications such as changing the test path from "a" to "ccccccccccc" also make it pass, indicating it's very flaky. Since the fix is for a higher-tier platform than wasm it takes precedence.
2022-02-12bless youDeadbeef-6/+27
2022-02-12Bless nll tests.Camille GILLOT-11/+7
2022-02-10replace feature expression (cfg_panic) in lib and remove expression from testsCharisee-1/+0
Rebase commit
2022-02-04Rollup merge of #90132 - joshtriplett:stabilize-instrument-coverage, ↵Matthias Krüger-1/+1
r=wesleywiser Stabilize `-Z instrument-coverage` as `-C instrument-coverage` (Tracking issue for `instrument-coverage`: https://github.com/rust-lang/rust/issues/79121) This PR stabilizes support for instrumentation-based code coverage, previously provided via the `-Z instrument-coverage` option. (Continue supporting `-Z instrument-coverage` for compatibility for now, but show a deprecation warning for it.) Many, many people have tested this support, and there are numerous reports of it working as expected. Move the documentation from the unstable book to stable rustc documentation. Update uses and documentation to use the `-C` option. Addressing questions raised in the tracking issue: > If/when stabilized, will the compiler flag be updated to -C instrument-coverage? (If so, the -Z variant could also be supported for some time, to ease migrations for existing users and scripts.) This stabilization PR updates the option to `-C` and keeps the `-Z` variant to ease migration. > The Rust coverage implementation depends on (and automatically turns on) -Z symbol-mangling-version=v0. Will stabilizing this feature depend on stabilizing v0 symbol-mangling first? If so, what is the current status and timeline? This stabilization PR depends on https://github.com/rust-lang/rust/pull/90128 , which stabilizes `-C symbol-mangling-version=v0` (but does not change the default symbol-mangling-version). > The Rust coverage implementation implements the latest version of LLVM's Coverage Mapping Format (version 4), which forces a dependency on LLVM 11 or later. A compiler error is generated if attempting to compile with coverage, and using an older version of LLVM. Given that LLVM 13 has now been released, requiring LLVM 11 for coverage support seems like a reasonable requirement. If people don't have at least LLVM 11, nothing else breaks; they just can't use coverage support. Given that coverage support currently requires a nightly compiler and LLVM 11 or newer, allowing it on a stable compiler built with LLVM 11 or newer seems like an improvement. The [tracking issue](https://github.com/rust-lang/rust/issues/79121) and the [issue label A-code-coverage](https://github.com/rust-lang/rust/labels/A-code-coverage) link to a few open issues related to `instrument-coverage`, but none of them seem like showstoppers. All of them seem like improvements and refinements we can make after stabilization. The original `-Z instrument-coverage` support went through a compiler-team MCP at https://github.com/rust-lang/compiler-team/issues/278 . Based on that, `@pnkfelix` suggested that this needed a stabilization PR and a compiler-team FCP.
2022-02-03Fix some tests to use -Cinstrument-coverageWesley Wiser-1/+1
2022-01-29Create `core::fmt::ArgumentV1` with generics instead of fn pointerGary Guo-5/+5
2022-01-21Rollup merge of #92963 - terrarier2111:tuple-diagnostic, r=davidtwcoMatthias Krüger-4/+2
Implement tuple array diagnostic Fixes https://github.com/rust-lang/rust/issues/92089
2022-01-21Rollup merge of #92843 - camelid:str-concat-sugg, r=davidtwcoMatthias Krüger-4/+6
Improve string concatenation suggestion Before: error[E0369]: cannot add `&str` to `&str` --> file.rs:2:22 | 2 | let _x = "hello" + " world"; | ------- ^ -------- &str | | | | | `+` cannot be used to concatenate two `&str` strings | &str | help: `to_owned()` can be used to create an owned `String` from a string reference. String concatenation appends the string on the right to the string on the left and may require reallocation. This requires ownership of the string on the left | 2 | let _x = "hello".to_owned() + " world"; | ~~~~~~~~~~~~~~~~~~ After: error[E0369]: cannot add `&str` to `&str` --> file.rs:2:22 | 2 | let _x = "hello" + " world"; | ------- ^ -------- &str | | | | | `+` cannot be used to concatenate two `&str` strings | &str | = note: string concatenation requires an owned `String` on the left help: create an owned `String` from a string reference | 2 | let _x = "hello".to_owned() + " world"; | +++++++++++
2022-01-21Rollup merge of #92467 - Aaron1011:extern-local-region, r=oli-obkMatthias Krüger-21/+7
Ensure that early-bound function lifetimes are always 'local' During borrowchecking, we treat any free (early-bound) regions on the 'defining type' as `RegionClassification::External`. According to the doc comments, we should only have 'external' regions when checking a closure/generator. However, a plain function can also have some if its regions be considered 'early bound' - this occurs when the region is constrained by an argument, appears in a `where` clause, or in an opaque type. This was causing us to incorrectly mark these regions as 'external', which caused some diagnostic code to act as if we were referring to a 'parent' region from inside a closure. This PR marks all instantiated region variables as 'local' when we're borrow-checking something other than a closure/generator/inline-const.
2022-01-21Auto merge of #91359 - dtolnay:args, r=Mark-Simulacrumbors-5/+13
Emit simpler code from format_args I made this PR so that `cargo expand` dumps a less overwhelming amount of formatting-related code. <br> `println!("rust")` **Before:** ```rust { ::std::io::_print(::core::fmt::Arguments::new_v1(&["rust\n"], &match () { _args => [], })); }; ``` **After:** ```rust { ::std::io::_print(::core::fmt::Arguments::new_v1(&["rust\n"], &[])); }; ``` `println!("{}", x)` **Before:** ```rust { ::std::io::_print(::core::fmt::Arguments::new_v1( &["", "\n"], &match (&x,) { _args => [::core::fmt::ArgumentV1::new( _args.0, ::core::fmt::Display::fmt, )], }, )); }; ``` **After:** ```rust { ::std::io::_print(::core::fmt::Arguments::new_v1( &["", "\n"], &[::core::fmt::ArgumentV1::new(&x, ::core::fmt::Display::fmt)], )); }; ```
2022-01-18Make suggestions verboseNoah Lev-8/+14
2022-01-18Shorten and improve messagesNoah Lev-20/+10
2022-01-18Implement tuple array diagnosticthreadexception-4/+2
Co-authored-by: David Wood <Q0KPU0H1YOEPHRY1R2SN5B5RL@david.davidtw.co>
2022-01-18generic_arg_infer: placeholder in signature errlcnr-2/+2
2022-01-17add more info to invalid use of #[test] on invalid itemsasquared31415-14/+0
2022-01-17Emit simpler code from format_argsDavid Tolnay-5/+13
2022-01-17Auto merge of #92816 - tmiasko:rm-llvm-asm, r=Amanieubors-2/+0
Remove deprecated LLVM-style inline assembly The `llvm_asm!` was deprecated back in #87590 1.56.0, with intention to remove it once `asm!` was stabilized, which already happened in #91728 1.59.0. Now it is time to remove `llvm_asm!` to avoid continued maintenance cost. Closes #70173. Closes #92794. Closes #87612. Closes #82065. cc `@rust-lang/wg-inline-asm` r? `@Amanieu`
2022-01-12Add line breaks to make message easier to readNoah Lev-2/+6
2022-01-12Split up very long messageNoah Lev-2/+4
This should make it easier to read.
2022-01-12Improve suggestions for type errors with string concatenationNoah Lev-2/+2
Now, multipart suggestions are used instead of `span_to_snippet`, which improves code quality, makes the suggestion work even without access to source code, and, most importantly, improves the rendering of the suggestion.
2022-01-12Bless tests.Camille GILLOT-10/+3
2022-01-12Remove ui tests for LLVM-style inline assemblyTomasz Miąsko-2/+0
2022-01-04Rollup merge of #92507 - chordtoll:suggest-single-quotes, r=petrochenkovMatthias Krüger-0/+5
Suggest single quotes when char expected, str provided If a type mismatch occurs where a char is expected and a string literal is provided, suggest changing the double quotes to single quotes. We already provide this suggestion in the other direction ( ' -> " ). Especially useful for new rust devs used to a language in which single/double quotes are interchangeable. Fixes #92479.
2022-01-03Suggest changing quotes when str/char type mismatchchordtoll-0/+5
2021-12-31Ensure that early-bound function lifetimes are always 'local'Aaron Hill-21/+7
During borrowchecking, we treat any free (early-bound) regions on the 'defining type' as `RegionClassification::External`. According to the doc comments, we should only have 'external' regions when checking a closure/generator. However, a plain function can also have some if its regions be considered 'early bound' - this occurs when the region is constrained by an argument, appears in a `where` clause, or in an opaque type. This was causing us to incorrectly mark these regions as 'external', which caused some diagnostic code to act as if we were referring to a 'parent' region from inside a closure. This PR marks all instantiated region variables as 'local' when we're borrow-checking something other than a closure/generator/inline-const.
2021-12-30UI test updates for Result and Option method movesDavid Tolnay-2/+0
2021-12-26Add test cases for issue #26186PFPoitras-0/+62
2021-12-18Rollup merge of #91928 - fee1-dead:constification1, r=oli-obkMatthias Krüger-4/+4
Constify (most) `Option` methods r? ``@oli-obk``
2021-12-18Rollup merge of #89090 - cjgillot:bare-dyn, r=jackh726Matthias Krüger-5/+57
Lint bare traits in AstConv. Removing the lint from lowering allows to: - make lowering querification easier; - have the lint implementation in only one place. r? `@estebank`