about summary refs log tree commit diff
path: root/src/test/ui
AgeCommit message (Collapse)AuthorLines
2022-02-01Fix w/ commentskadmin-89/+189
2022-02-01Auto merge of #93548 - matthiaskrgr:rollup-f7dkn3p, r=matthiaskrgrbors-4/+91
Rollup of 7 pull requests Successful merges: - #86374 (Enable combining `+crt-static` and `relocation-model=pic` on `x86_64-unknown-linux-gnu`) - #91828 (Implement `RawWaker` and `Waker` getters for underlying pointers) - #92021 (Eliminate duplicate codes of is_single_fp_element) - #92584 (add rustc lint, warning when iterating over hashmaps 2) - #93267 (implement a lint for suspicious auto trait impls) - #93290 (remove `TyS::same_type`) - #93436 (Update compiler_builtins to fix duplicate symbols in `armv7-linux-androideabi` rlib) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-02-01Rollup merge of #93267 - lcnr:auto-trait-lint, r=nikomatsakisMatthias Krüger-4/+91
implement a lint for suspicious auto trait impls cc https://github.com/rust-lang/rust/pull/85048#issuecomment-1019805102 r? ``@nikomatsakis``
2022-02-01Auto merge of #93284 - eholk:disable-drop-range-analysis, r=pnkfelixbors-0/+15
Disable drop range analysis The previous PR, #93165, still performed the drop range analysis despite ignoring the results. Unfortunately, there were ICEs in the analysis as well, so some packages failed to build (see the issue #93197 for an example). This change further disables the analysis and just provides dummy results in that case.
2022-02-01Make dead code check a query.Camille GILLOT-10/+10
2022-02-01fix for the issue #92464ouz-a-0/+15
2022-02-01implement lint for suspicious auto trait implslcnr-4/+91
2022-01-31Rollup merge of #93513 - dtolnay:linewidth, r=nagisaEric Huss-5/+3
Allow any pretty printed line to have at least 60 chars Follow-up to #93155. The rustc AST pretty printer has a tendency to get stuck in "vertical smear mode" when formatting highly nested code, where it puts a linebreak at *every possible* linebreak opportunity once the indentation goes beyond the pretty printer's target line width: ```rust ... ((&([("test" as &str)] as [&str; 1]) as &[&str; 1]), (&([] as [ArgumentV1; 0]) as &[ArgumentV1; 0])) ... ``` ```rust ... [(1 as i32), (2 as i32), (3 as i32)] as [i32; 3] ... ``` This is less common after #93155 because that PR greatly reduced the total amount of indentation, but the "vertical smear mode" failure mode is still just as present when you have deeply nested modules, functions, or trait impls, such as in the case of macro-expanded code from `-Zunpretty=expanded`. Vertical smear mode is never the best way to format highly indented code though. It does not prevent the target line width from being exceeded, and it produces output that is less readable than just a longer line. This PR makes the pretty printing algorithm allow a minimum of 60 chars on every line independent of indentation. So as code gets more indented, the right margin eventually recedes to make room for formatting without vertical smear. ```console ├─────────────────────────────────────┤ ├─────────────────────────────────────┤ ├─────────────────────────────────────┤ ├───────────────────────────────────┤ ├─────────────────────────────────┤ ├───────────────────────────────┤ ├─────────────────────────────┤ ├───────────────────────────┤ ├───────────────────────────┤ ├───────────────────────────┤ ├───────────────────────────┤ ├───────────────────────────┤ ├─────────────────────────────┤ ├───────────────────────────────┤ ├─────────────────────────────────┤ ├───────────────────────────────────┤ ├─────────────────────────────────────┤ ```
2022-01-31Rollup merge of #93019 - 5225225:uppercase-suffix, r=wesleywiserEric Huss-0/+252
If an integer is entered with an upper-case base prefix (0Xbeef, 0O755, 0B1010), suggest to make it lowercase The current error for this case isn't really great, it just complains about the whole thing past the `0` being an invalid suffix.
2022-01-31Rollup merge of #91343 - FabianWolff:issue-91328-as-deref, r=jackh726Eric Huss-0/+104
Fix suggestion to slice if scrutinee is a `Result` or `Option` Fixes #91328.
2022-02-01Auto merge of #93386 - ↵bors-1/+27
WaffleLapkin:rustc_must_implement_one_of_check_target, r=nagisa Check that `#[rustc_must_implement_one_of]` is applied to a trait `#[rustc_must_implement_one_of]` only makes sense when applied to a trait, so it's sensible to emit an error otherwise.
2022-01-31Update test output for `ui/asm/aarch64/parse-error.rs`Fabian Wolff-7/+7
2022-01-31Bless all pretty printer tests and ui testsDavid Tolnay-5/+3
2022-01-31Add ValuePairs::Terms & Fix compile errorkadmin-132/+100
And use correct substs.
2022-01-31Make `span_extend_to_prev_str()` more robustFabian Wolff-7/+70
2022-01-31Add match on `Vec<_>` to `ui/typeck/issue-91328.rs` testFabian Wolff-1/+30
2022-01-31Fix suggestion to slice if scrutinee is a `Result` or `Option`Fabian Wolff-0/+75
2022-01-31Auto merge of #93348 - spastorino:fix-perf-overlap-mode2, r=nikomatsakisbors-12/+29
Move overlap_mode into trait level attribute r? `@nikomatsakis` Should fix some performance regressions noted on https://github.com/rust-lang/rust/pull/93175
2022-01-31Write UI tests, tweak message5225225-0/+252
2022-01-31regression test for issue 90847cameron-0/+9
2022-01-31Take in account the unreachable! macro in the non_fmt_panic lintLoïc BRANSTETT-30/+137
2022-01-31Fix invalid special casing of the unreachable! macroLoïc BRANSTETT-8/+45
2022-01-31Move overlap_mode into trait level attribute + feature flagSantiago Pastorino-12/+29
2022-01-31Auto merge of #93498 - matthiaskrgr:rollup-k5shwrc, r=matthiaskrgrbors-76/+218
Rollup of 8 pull requests Successful merges: - #90277 (Improve terminology around "after typeck") - #92918 (Allow eliding GATs in expression position) - #93039 (Don't suggest inaccessible fields) - #93155 (Switch pretty printer to block-based indentation) - #93214 (Respect doc(hidden) when suggesting available fields) - #93347 (Make `char::DecodeUtf16::size_hist` more precise) - #93392 (Clarify documentation on char::MAX) - #93444 (Fix some CSS warnings and errors from VS Code) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-01-31Rollup merge of #93461 - dtolnay:fmtyield, r=davidtwcoMatthias Krüger-0/+33
Accommodate yield points in the format_args expansion Fixes #93274. For the case `println!("{} {:?}", "", async {}.await)` in the issue, the expansion before: ```rust ::std::io::_print( ::core::fmt::Arguments::new_v1( &["", " ", "\n"], &[ ::core::fmt::ArgumentV1::new(&"", ::core::fmt::Display::fmt), ::core::fmt::ArgumentV1::new(&async {}.await, ::core::fmt::Debug::fmt), ], ), ); ``` After: ```rust ::std::io::_print( ::core::fmt::Arguments::new_v1( &["", " ", "\n"], &match (&"", &async {}.await) { _args => [ ::core::fmt::ArgumentV1::new(_args.0, ::core::fmt::Display::fmt), ::core::fmt::ArgumentV1::new(_args.1, ::core::fmt::Debug::fmt), ], }, ), ); ```
2022-01-31Rollup merge of #93395 - camelid:reserved-sugg, r=davidtwcoMatthias Krüger-130/+130
Improve suggestion for escaping reserved keywords r? `@davidtwco`
2022-01-31Rollup merge of #93214 - ibraheemdev:issue-93210, r=davidtwcoMatthias Krüger-0/+43
Respect doc(hidden) when suggesting available fields Resolves #93210
2022-01-31Rollup merge of #93155 - dtolnay:blockindent, r=nagisaMatthias Krüger-76/+72
Switch pretty printer to block-based indentation This PR backports https://github.com/dtolnay/prettyplease/commit/401d60c04213e6c66565e0e69a95b4588db5fdba from the `prettyplease` crate into `rustc_ast_pretty`. A before and after: ```diff - let res = - ((::alloc::fmt::format as - for<'r> fn(Arguments<'r>) -> String {format})(((::core::fmt::Arguments::new_v1 - as - fn(&[&'static str], &[ArgumentV1]) -> Arguments {Arguments::new_v1})((&([("test" - as - &str)] - as - [&str; 1]) - as - &[&str; 1]), - (&([] - as - [ArgumentV1; 0]) - as - &[ArgumentV1; 0])) - as - Arguments)) - as String); + let res = + ((::alloc::fmt::format as + for<'r> fn(Arguments<'r>) -> String {format})(((::core::fmt::Arguments::new_v1 + as + fn(&[&'static str], &[ArgumentV1]) -> Arguments {Arguments::new_v1})((&([("test" + as &str)] as [&str; 1]) as + &[&str; 1]), + (&([] as [ArgumentV1; 0]) as &[ArgumentV1; 0])) as + Arguments)) as String); ``` Previously the pretty printer would compute indentation always relative to whatever column a block begins at, like this: ```rust fn demo(arg1: usize, arg2: usize); ``` This is never the thing to do in the dominant contemporary Rust style. Rustfmt's default and the style used by the vast majority of Rust codebases is block indentation: ```rust fn demo( arg1: usize, arg2: usize, ); ``` where every indentation level is a multiple of 4 spaces and each level is indented relative to the indentation of the previous line, not the position that the block starts in. By itself this PR doesn't get perfect formatting in all cases, but it is the smallest possible step in clearly the right direction. More backports from `prettyplease` to tune the ibox/cbox indent levels around various AST node types are upcoming.
2022-01-31Rollup merge of #93039 - terrarier2111:fix-field-help, r=nagisaMatthias Krüger-0/+30
Don't suggest inaccessible fields Fixes: https://github.com/rust-lang/rust/issues/92999
2022-01-31Rollup merge of #92918 - compiler-errors:gat-expr-lifetime-elision, r=jackh726Matthias Krüger-0/+73
Allow eliding GATs in expression position Thoughts on whether this is worthwhile? Fixes #92836 r? ``@jackh726``
2022-01-30Bless all pretty printer tests and ui testsDavid Tolnay-76/+72
2022-01-31Auto merge of #90891 - nbdd0121:format, r=Mark-Simulacrumbors-9/+13
Create `core::fmt::ArgumentV1` with generics instead of fn pointer Split from (and prerequisite of) #90488, as this seems to have perf implication. `@rustbot` label: +T-libs
2022-01-30Mac callsDavid Tolnay-2/+12
2022-01-30Add regression test for issue 93274David Tolnay-0/+23
Currently fails with: error: future cannot be sent between threads safely --> $DIR/src/test/ui/fmt/format-with-yield-point.rs:21:17 | LL | assert_send(with_await()); | ^^^^^^^^^^^^ future returned by `with_await` is not `Send` | = help: the trait `Sync` is not implemented for `core::fmt::Opaque` note: future is not `Send` as this value is used across an await --> $DIR/src/test/ui/fmt/format-with-yield-point.rs:11:37 | LL | println!("{} {:?}", "", async {}.await); | --------------------------------^^^^^^- | | | | | await occurs here, with `$crate::format_args_nl!($($arg)*)` maybe used later | has type `ArgumentV1<'_>` which is not `Send` | `$crate::format_args_nl!($($arg)*)` is later dropped here note: required by a bound in `assert_send` --> $DIR/src/test/ui/fmt/format-with-yield-point.rs:18:24 | LL | fn assert_send(_: impl Send) {} | ^^^^ required by this bound in `assert_send` error: future cannot be sent between threads safely --> $DIR/src/test/ui/fmt/format-with-yield-point.rs:22:17 | LL | assert_send(with_macro_call()); | ^^^^^^^^^^^^^^^^^ future returned by `with_macro_call` is not `Send` | = help: the trait `Sync` is not implemented for `core::fmt::Opaque` note: future is not `Send` as this value is used across an await --> $DIR/src/test/ui/fmt/format-with-yield-point.rs:6:17 | LL | async {}.await | ^^^^^^ await occurs here, with `$crate::format_args_nl!($($arg)*)` maybe used later ... LL | println!("{} {:?}", "", m!()); | ----------------------------- | | | | | in this macro invocation | has type `ArgumentV1<'_>` which is not `Send` | `$crate::format_args_nl!($($arg)*)` is later dropped here note: required by a bound in `assert_send` --> $DIR/src/test/ui/fmt/format-with-yield-point.rs:18:24 | LL | fn assert_send(_: impl Send) {} | ^^^^ required by this bound in `assert_send` = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 2 previous errors
2022-01-30Compress amount of hashed bytes for `isize` values in StableHasherJakub Beránek-4/+4
2022-01-30Rollup merge of #93362 - compiler-errors:ice-gat-in-rpit, r=oli-obkMatthias Krüger-0/+20
Do not register infer var for GAT projection in RPIT Fixes #93340 Fixes #91603 r? ```@oli-obk```
2022-01-30Rollup merge of #93358 - compiler-errors:is-not-const, r=fee1-deadMatthias Krüger-0/+40
Add note suggesting that predicate may be satisfied, but is not `const` Not sure if we should be printing this in addition to, or perhaps _instead_ of the help message: ``` help: the trait `~const Add` is not implemented for `NonConstAdd` ``` Also added `ParamEnv::is_const` and `PolyTraitPredicate::is_const_if_const` and, in a separate commit, used those in other places instead of `== hir::Constness::Const`, etc. r? ````@fee1-dead````
2022-01-29Auto merge of #93457 - matthiaskrgr:rollup-e43ry1l, r=matthiaskrgrbors-5/+190
Rollup of 8 pull requests Successful merges: - #88205 (Add Explanation For Error E0772) - #92274 (Add `intrinsics::const_deallocate`) - #93236 (Make `NonNull::new` `const`) - #93299 (Fix dot separator when there is no source link) - #93410 (kmc-solid: Implement `net::FileDesc::duplicate`) - #93424 (fix nit) - #93431 (remove unused `jemallocator` crate) - #93453 (Add GUI theme change test) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-01-29Create `core::fmt::ArgumentV1` with generics instead of fn pointerGary Guo-9/+13
2022-01-29Rollup merge of #92274 - woppopo:const_deallocate, r=oli-obkMatthias Krüger-3/+186
Add `intrinsics::const_deallocate` Tracking issue: #79597 Related: #91884 This allows deallocation of a memory allocated by `intrinsics::const_allocate`. At the moment, this can be only used to reduce memory usage, but in the future this may be useful to detect memory leaks (If an allocated memory remains after evaluation, raise an error...?).
2022-01-29Rollup merge of #88205 - danii:e0772, r=GuillaumeGomezMatthias Krüger-2/+4
Add Explanation For Error E0772 I've added an error explanation for the error code E0772. Assists with #61137
2022-01-29Auto merge of #92312 - BGR360:needs-test, r=Mark-Simulacrumbors-0/+118
Add tests for three old ICEs Closes #84044 Closes #91594 Closes #89066
2022-01-29Test 1-tuple parentheses wrappingRob Pilling-14/+78
2022-01-29Document about some behaviors of `const_(de)allocate` and add some tests.woppopo-0/+33
2022-01-28Only suggest 1-tuple if expected and found types matchRob Pilling-4/+0
2022-01-28Add test for old ICE in #89066Ben Reeves-0/+67
2022-01-28Add test for old ICE in #91594Ben Reeves-0/+34
2022-01-28Add test for old ICEBen Reeves-0/+17
The ICE from #84044 no longer occurs.
2022-01-28Replace span suggestion with multipartRob Pilling-2/+2
2022-01-28Suggest 1-tuple parentheses, without existing parensRob Pilling-0/+8