about summary refs log tree commit diff
path: root/src/test
AgeCommit message (Collapse)AuthorLines
2022-02-01Auto merge of #93548 - matthiaskrgr:rollup-f7dkn3p, r=matthiaskrgrbors-15/+240
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-01Rollup merge of #92584 - lcnr:query-stable-lint, r=estebankMatthias Krüger-0/+95
add rustc lint, warning when iterating over hashmaps 2 first introduced in #89558 and reverted in #90380 due to its perf impact r? ``@estebank``
2022-02-01Rollup merge of #86374 - bossmc:enable-static-pie-for-gnu, r=nagisaMatthias Krüger-11/+54
Enable combining `+crt-static` and `relocation-model=pic` on `x86_64-unknown-linux-gnu` Modern `gcc` versions support `-static-pie`, and `rustc` will already fall-back to `-static` if the local `gcc` is too old (and hence this change is optimistic rather than absolute). This brings the `-musl` and `-gnu` targets to feature compatibility (albeit with different default settings). Of note a `-static` or `-static-pie` binary based on glibc that uses NSS-backed functions (`gethostbyname` or `getpwuid` etc.) need to have access to the `libnss_X.so.2` libraries and any of their dynamic dependencies. I wasn't sure about the `# only`/`# ignore` changes (I've not got a `gnux32` toolchain to test with hence not also enabling `-static-pie` there).
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-01add a rustc::query_stability lintlcnr-0/+95
2022-02-01implement lint for suspicious auto trait implslcnr-4/+91
2022-01-31Rollup merge of #93513 - dtolnay:linewidth, r=nagisaEric Huss-7/+4
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-31Bless all pretty printer tests and ui testsDavid Tolnay-7/+4
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-31Move overlap_mode into trait level attribute + feature flagSantiago Pastorino-12/+29
2022-01-31Auto merge of #93498 - matthiaskrgr:rollup-k5shwrc, r=matthiaskrgrbors-231/+353
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-231/+207
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-30Restore a visual alignment mode for block commentsDavid Tolnay-3/+3
2022-01-30Bless all pretty printer tests and ui testsDavid Tolnay-234/+210
2022-01-31Auto merge of #90891 - nbdd0121:format, r=Mark-Simulacrumbors-21/+25
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-30Rollup merge of #93475 - GuillaumeGomez:theme-in-history, r=jshaEric Huss-0/+25
Add test to ensure that theme is applied correctly when going back in history Fixes #93258. r? `@jsha`
2022-01-30Rollup merge of #93183 - jsha:mobile-nav-fixes, r=GuillaumeGomezEric Huss-1/+10
rustdoc: mobile nav fixes - Make sure the mobile-topbar doesn't overflow its height if the user sets a bigger font. - Make sure the sidebar can be scrolled all the way to the bottom by shortening it to accommodate the mobile-topbar. - Make the item name in the mobile-topbar clickable to go to the top of the page. - Remove excess padding sidebar in mobile mode. Demo https://rustdoc.crud.net/jsha/mobile-nav-fixes/std/string/struct.String.html r? `@GuillaumeGomez`
2022-01-30Rollup merge of #92908 - dtolnay:rustdoc, r=GuillaumeGomezEric Huss-7/+53
Render more readable macro matcher tokens in rustdoc Follow-up to #92334. This PR lifts some of the token rendering logic from https://github.com/dtolnay/prettyplease into rustdoc so that even the matchers for which a source code snippet is not available (because they are macro-generated, or any other reason) follow some baseline good assumptions about where the tokens in the macro matcher are appropriate to space. The below screenshots show an example of the difference using one of the gnarliest macros I could find. Some things to notice: - In the **before**, notice how a couple places break in between `$(....)`↵`*`, which is just about the worst possible place that it could break. - In the **before**, the lines that wrapped are weirdly indented by 1 space of indentation relative to column 0. In the **after**, we use the typical way of block indenting in Rust syntax which is put the open/close delimiters on their own line and indent their contents by 4 spaces relative to the previous line (so 8 spaces relative to column 0, because the matcher itself is indented by 4 relative to the `macro_rules` header). - In the **after**, macro_rules metavariables like `$tokens:tt` are kept together, which is how just about everybody writing Rust today writes them. ## Before ![Screenshot from 2022-01-14 13-05-53](https://user-images.githubusercontent.com/1940490/149585105-1f182b78-751f-421f-a234-9dbc04fa3bbd.png) ## After ![Screenshot from 2022-01-14 13-06-04](https://user-images.githubusercontent.com/1940490/149585118-d4b52ea7-3e67-4b6e-a12b-31dfb8172f86.png) r? `@camelid`
2022-01-30Add test to ensure that theme is applied correctly when going back in historyGuillaume Gomez-0/+25
2022-01-29rustdoc: small fixes to mobile navigationJacob Hoffman-Andrews-1/+10
- Make sure the mobile-topbar doesn't overflow its height if the user sets a bigger font. - Make sure the sidebar can be scrolled all the way to the bottom by shortening it to accommodate the mobile-topbar. - Make the item name in the mobile-topbar clickable to go to the top of the page. - Remove excess padding sidebar in mobile mode.
2022-01-30Rollup merge of #93441 - ↵Matthias Krüger-0/+30
notriddle:notriddle/collect-crate-doc-links-very-early, r=petrochenkov rustdoc: load the set of in-scope traits for modules with no docstring Fixes #93428 This fix is a response to a couple of special cases related to the `module_id`, which is eventually used for trait candidates: * The module id is always set to the current crate, when checking `crate::`. Normally, the set of in-scope traits would be set in `load_links_in_attrs`, but if there are no doc comments, then that loop will never run. * the module id is set to the parent module, when resolving a module that is spelled like this: // Notice how we use an outlined doc comment here! // [`Test::my_fn`] mod something { } As with the above problem with `crate::`, we need to make sure the module gets its traits in scope resolved, even if it has no doc comments of its own.
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/+229
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-21/+25
2022-01-29Rollup merge of #93453 - GuillaumeGomez:theme-change-test, r=jshaMatthias Krüger-0/+16
Add GUI theme change test r? `@jsha`
2022-01-29Rollup merge of #93299 - GuillaumeGomez:dot-separator-no-source, r=jshaMatthias Krüger-0/+23
Fix dot separator when there is no source link Fixes #92973. We did well adding this test since there was a bug: ![Screenshot from 2022-01-25 17-05-48](https://user-images.githubusercontent.com/3050060/151016535-39b45f52-e1e0-4963-ad19-532e24ec4c9b.png) r? `@jsha`
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-29Document about some behaviors of `const_(de)allocate` and add some tests.woppopo-0/+33
2022-01-29Extend theme change GUI testGuillaume Gomez-0/+16
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-28Auto merge of #93427 - matthiaskrgr:rollup-esd3ixl, r=matthiaskrgrbors-0/+36
Rollup of 10 pull requests Successful merges: - #92611 (Add links to the reference and rust by example for asm! docs and lints) - #93158 (wasi: implement `sock_accept` and enable networking) - #93239 (Add os::unix::net::SocketAddr::from_path) - #93261 (Some unwinding related cg_ssa cleanups) - #93295 (Avoid double panics when using `TempDir` in tests) - #93353 (Unimpl {Add,Sub,Mul,Div,Rem,BitXor,BitOr,BitAnd}<$t> for Saturating<$t>) - #93356 (Edit docs introduction for `std::cmp::PartialOrd`) - #93375 (fix typo `documenation`) - #93399 (rustbuild: Fix compiletest warning when building outside of root.) - #93404 (Fix a typo from #92899) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup