about summary refs log tree commit diff
path: root/src
AgeCommit message (Collapse)AuthorLines
2021-03-02Rollup merge of #82597 - noslaver:fix-82137, r=nagisaYuki Okushi-15/+12
Get TyCtxt from self instead of passing as argument in AutoTraitFinder First contribution :crab:, let me know if anything is amiss. Fix #82137.
2021-03-02Rollup merge of #82593 - sunfishcode:wasi-docs, r=alexcrichtonYuki Okushi-0/+37
Teach rustdoc how to display WASI. As a followup to [this comment] in #82420, this patch teaches rustdoc how to display WASI. [this comment]: https://github.com/rust-lang/rust/pull/82420#issuecomment-784523826 r? `@alexcrichton`
2021-03-02Rollup merge of #82579 - osa1:issue82566, r=estebankYuki Okushi-0/+122
Fix turbofish recovery with multiple generic args This consists of two commits, each can be individually reviewed. - First commit fixes the issue in [this comment](https://github.com/rust-lang/rust/issues/82566#issuecomment-786924466). - Second commit fixes #82566 --- r? ````@estebank````
2021-03-02Rollup merge of #82516 - PoignardAzur:inherent-impl-ty, r=oli-obkYuki Okushi-18/+71
Add incomplete feature gate for inherent associate types. Mentored by ``````@oli-obk`````` So far the only change is that instead of giving an automatic error, the following code compiles: ```rust struct Foo; impl Foo { type Bar = isize; } ``` The backend work to make it actually usable isn't there yet. In particular, this: ```rust let x : Foo::Bar; ``` will give you: ```sh error[E0223]: ambiguous associated type --> /$RUSTC_DIR/src/test/ui/assoc-inherent.rs:15:13 | LL | let x : Foo::Bar; | ^^^^^^^^ help: use fully-qualified syntax: `<Foo as Trait>::Bar` ```
2021-03-02Rollup merge of #80874 - jyn514:intra-doc-docs, r=ManishearthYuki Okushi-13/+62
Update intra-doc link documentation to match the implementation r? `@Manishearth` cc `@camelid` `@m-ou-se` Relevant PRs: - https://github.com/rust-lang/rust/pull/74489 - https://github.com/rust-lang/rust/pull/80181 - https://github.com/rust-lang/rust/pull/76078 - https://github.com/rust-lang/rust/pull/77519 - https://github.com/rust-lang/rust/pull/73101 Relevant issues: - https://github.com/rust-lang/rust/issues/78800 - https://github.com/rust-lang/rust/issues/77200 - https://github.com/rust-lang/rust/issues/77199 / https://github.com/rust-lang/rust/issues/54191/ I haven't documented things that I consider 'just bugs', like https://github.com/rust-lang/rust/issues/77732, but I have documented features that aren't implemented, like https://github.com/rust-lang/rust/issues/78800.
2021-03-02Fix UI errorsErin Power-9/+3
2021-03-02Revert non-power-of-two vector restrictionErin Power-35/+2
2021-03-01Update booksEric Huss-0/+0
2021-03-01Test that using the previous lint names still applies the lintJoshua Nelson-0/+28
2021-03-01Address review commentsJoshua Nelson-22/+53
- Move MISSING_CRATE_LEVEL_DOCS to rustdoc directly - Update documentation This also takes the opportunity to make the `no-crate-level-doc-lint` test more specific.
2021-03-01Improve error messagesJoshua Nelson-9/+45
- Use `register_renamed` when rustdoc is running so the lint will still be active and use a structured suggestion - Test the behavior for rustc, not just for rustdoc (because it differs)
2021-03-01Add `declare_rustdoc_lint!` macroJoshua Nelson-14/+22
2021-03-01Move lint machinery into a separate fileJoshua Nelson-180/+183
2021-03-01Rename rustdoc lints to be a tool lint instead of built-in.Joshua Nelson-141/+271
- Rename `broken_intra_doc_links` to `rustdoc::broken_intra_doc_links` - Ensure that the old lint names still work and give deprecation errors - Register lints even when running doctests Otherwise, all `rustdoc::` lints would be ignored. - Register all existing lints as removed This unfortunately doesn't work with `register_renamed` because tool lints have not yet been registered when rustc is running. For similar reasons, `check_backwards_compat` doesn't work either. Call `register_removed` directly instead. - Fix fallout + Rustdoc lints for compiler/ + Rustdoc lints for library/ Note that this does *not* suggest `rustdoc::broken_intra_doc_links` for `rustdoc::intra_doc_link_resolution_failure`, since there was no time when the latter was valid.
2021-03-02Rollup merge of #82676 - dtolnay:powers, r=Mark-SimulacrumGuillaume Gomez-1/+1
Change twice used large const table to static This table is used twice in core::num::dec2flt::algorithm::power_of_ten. According to the semantics of const, a separate huge definition of the table is inlined at both places. https://github.com/rust-lang/rust/blob/5233edcf1c7ee70ac25e4ec1115c3546f53d8a2d/library/core/src/num/dec2flt/algorithm.rs#L16-L22 Theoretically this gets cleaned up by optimization passes, but in practice I am experiencing a miscompile from LTO on this code. Making the table a static, which would only be defined a single time and not require attention from LTO, eliminates the miscompile and seems semantically more appropriate anyway. A separate bug report on the LTO bug is forthcoming. Original addition of `const` is from #27307.
2021-03-02Rollup merge of #82662 - GuillaumeGomez:doc-attr-check, r=jyn514Guillaume Gomez-0/+38
Warn about unknown doc attributes Fixes #82652. For the text error, I decided to go for "invalid" instead of "unknown". What do you think? r? `@jyn514`
2021-03-02Rollup merge of #82655 - SkiFire13:fix-issue-81314, r=estebankGuillaume Gomez-16/+61
Highlight identifier span instead of whole pattern span in `unused` lint Fixes #81314 This pretty much just changes the span highlighted in the lint from `pat_sp` to `ident.span`. There's however an exception, which is in patterns with shorthands like `Point { y, ref mut x }`, where a suggestion to change just `x` would be invalid; in those cases I had to keep the pattern span. Another option would be suggesting something like `Point { y, x: ref mut _x }`. I also added a new test since there weren't any test that checked the `unused` lint with optional patterns.
2021-03-02Rollup merge of #82598 - GuillaumeGomez:rustdoc-rustc-pass, r=jyn514Guillaume Gomez-0/+17
Check stability and feature attributes in rustdoc Fixes #82588. cc `@Nemo157` `@camelid` r? `@jyn514`
2021-03-02Rollup merge of #82018 - jyn514:no-dummy-cache, r=camelid,GuillaumeGomezGuillaume Gomez-133/+82
Remove the dummy cache in `DocContext`; delete RenderInfo The same information is available everywhere; the only reason the dummy cache was needed is because it was previously stored in three different places. This consolidates the info a bit so the cache in `DocContext` is used throughout. As a bonus, it also completely removes `RenderInfo`. - Return a `Cache` from `run_global_ctxt`, not `RenderInfo` - Remove the unused `render_info` from `run_renderer` - Remove RenderInfo altogether Helps with https://github.com/rust-lang/rust/pull/82014. The next step is to move the `populate()` call before the `collect_intra_doc_links` pass, which currently breaks because a) lots of the cache is populated in early passes, and b) intra_doc_links itself sets some info with `register_res`. I'm working on separate PR for that to avoid making too many big changes at once. r? `@GuillaumeGomez`
2021-03-02Rollup merge of #81932 - jyn514:rustdoc-logging, r=Mark-SimulacrumGuillaume Gomez-1/+82
Always compile rustdoc with debug logging enabled when `download-rustc` is set Previously, logging at DEBUG or below would always be silenced, because rustc compiles tracing with the `static_max_level_info` feature. That makes sense for release artifacts, but not for developing rustdoc. Instead, this compiles two different versions of tracing: one in the release artifacts, distributed in the sysroot, and a new version compiled by rustdoc. Since `rustc_driver` is always linked to the version of sysroot, this copy/pastes `init_env_logging` into rustdoc. To avoid compiling an unnecessary version of tracing when `download-rustc` isn't set, this adds a new `using-ci-artifacts` feature for rustdoc and passes that feature in bootstrap. Addresses https://github.com/rust-lang/rust/issues/81930. This builds on https://github.com/rust-lang/rust/pull/79540. r? `@Mark-Simulacrum`
2021-03-02Rollup merge of #80734 - abonander:ab/issue-66693, r=oli-obkGuillaume Gomez-4/+92
check that first arg to `panic!()` in const is `&str` closes #66693 ~~TODO: regression test~~ cc `@RalfJung` for error message wording
2021-03-01Build cmake earlier on dist-x86_64-muslNikita Popov-3/+4
musl-toolchain.sh is called with REPLACE_CC=1, so it will replace the host compiler and the subsequent cmake build will fail because it cannot find the openssl headers. Move the cmake build earlier, so it happens before the compiler is replaced.
2021-03-01Set CMAKE_SYSTEM_NAME for solaris/illumosNikita Popov-0/+2
When cross-compiling to solaris/illumos targets, set CMAKE_SYSTEM_NAME to SunOS.
2021-03-01Build both Python 2 and Python 3 on x86 dist buildersNikita Popov-9/+14
Python 2 is needed for Clang 10, Python 3 for LLVM 12. The Python 2 dependency could be removed by upgrading to Clang 11, but that causes linker errors of unclear origin.
2021-03-01Build newer version of cmake in Docker imagesNikita Popov-0/+109
LLVM requires CMake 3.13.4, which is only available as of Ubuntu 20.04. On images using an older version, build it manually.
2021-03-01Update submodule to LLVM 12Nikita Popov-0/+0
2021-03-01Get TyCtxt from self instead of passing as argument in AutoTraitFinderNoam Koren-15/+12
methods
2021-03-01Auto merge of #82663 - jyn514:rollup-xh3cb0c, r=jyn514bors-66/+101
Rollup of 8 pull requests Successful merges: - #81210 (BTreeMap: correct node size test case for choices of B) - #82360 (config.toml parsing error improvements) - #82428 (Update mdbook) - #82480 (Remove `ENABLE_DOWNLOAD_RUSTC` constant) - #82578 (Add some diagnostic items for Clippy) - #82620 (Apply lint restrictions from renamed lints) - #82635 (Fix typos in rustc_infer::infer::nll_relate) - #82645 (Clarify that SyncOnceCell::set blocks.) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2021-03-01Add tests for doc attribute checkGuillaume Gomez-0/+38
2021-03-01Change twice used large const table to staticDavid Tolnay-1/+1
This table is used twice in core::num::dec2flt::algorithm::power_of_ten. According to the semantics of const, a separate huge definition of the table is inlined at both places. fn power_of_ten(e: i16) -> Fp { assert!(e >= table::MIN_E); let i = e - table::MIN_E; let sig = table::POWERS.0[i as usize]; let exp = table::POWERS.1[i as usize]; Fp { f: sig, e: exp } } Theoretically this gets cleaned up by optimization passes, but in practice I am experiencing a miscompile from LTO on this code. Making the table a static, which would only be defined a single time and not require attention from LTO, eliminates the miscompile and seems semantically more appropriate anyway. A separate bug report on the LTO bug is forthcoming.
2021-03-01Auto merge of #82587 - taiki-e:unaligned_references, r=oli-obkbors-0/+68
Enable report_in_external_macro in unaligned_references Fixes an issue where `unaligned_references` is not triggered in external macros, unlike `safe_packed_borrows`. Also, given that this lint is planned to eventually change to hard error (#82525), it would make sense for this lint to be triggered for external macros as well. See https://github.com/taiki-e/pin-project-lite/pull/55#issuecomment-787038676 and https://github.com/taiki-e/pin-project-lite/pull/55#issuecomment-787052874 for more. r? `@RalfJung`
2021-03-01Change built-in kernel targets to be os = none throughoutJohn Ericson-2/+2
Whether for Rust's own `target_os`, LLVM's triples, or GNU config's, the OS-related have fields have been for code running *on* that OS, not code that is *part* of the OS. The difference is huge, as syscall interfaces are nothing like freestanding interfaces. Kernels are (hypervisors and other more exotic situations aside) freestanding programs that use the interfaces provided by the hardware. It's *those* interfaces, the ones external to the program being built and its software dependencies, that are the content of the target. For the Linux Kernel in particular, `target_env: "gnu"` is removed for the same reason: that `-gnu` refers to glibc or GNU/linux, neither of which applies to the kernel itself. Relates to #74247 Thanks @ojeda for catching some things.
2021-03-01check that first arg to `panic!()` in const is `&str`Austin Bonander-4/+92
2021-03-01Rollup merge of #82620 - jyn514:apply-renamed-lints, r=ManishearthJoshua Nelson-0/+37
Apply lint restrictions from renamed lints Previously, if you denied the old name of a renamed lint, it would warn about using the new name, but otherwise do nothing. Now, it will behave the same as if you'd used the new name. Fixes https://github.com/rust-lang/rust/issues/82615. r? `@ehuss`
2021-03-01Rollup merge of #82578 - camsteffen:diag-items, r=oli-obkJoshua Nelson-41/+42
Add some diagnostic items for Clippy
2021-03-01Rollup merge of #82480 - jyn514:no-enable-constant, r=Mark-SimulacrumJoshua Nelson-23/+13
Remove `ENABLE_DOWNLOAD_RUSTC` constant `ENABLE_DOWNLOAD_RUSTC` was introduced as part of the MVP for `download-rustc` as a way not to rebuild artifacts that have already been downloaded. Unfortunately, it doesn't work very well: - Steps are ignored by default, which makes it easy to leave out a step that should be built. For example, the MVP forgot to enable any tests, so it was only possible to *build* locally. - It didn't work correctly even when it was enabled: calling `builder.ensure()` would completely ignore the constant and rebuild the step anyway. This has no obvious fix since `ensure()` has to return a `Step::Output`. Instead, this handles `download-rustc` in `impl Step for Rustc` and `impl Step for Std`, which to my knowledge are the only build steps that don't first go through `impl Step for Sysroot` (`Rustc` is used for the `rustc-dev` component). See https://github.com/rust-lang/rust/pull/79540#discussion_r563350075 and https://github.com/rust-lang/rust/issues/81930 for further context. Here are some example runs with these changes and `download-rustc` enabled: ``` $ x.py build src/tools/clippy Building stage1 tool clippy-driver (x86_64-unknown-linux-gnu) Finished release [optimized] target(s) in 1m 09s Building stage1 tool cargo-clippy (x86_64-unknown-linux-gnu) Finished release [optimized] target(s) in 0.11s $ x.py test src/tools/clippy Finished dev [unoptimized + debuginfo] target(s) in 0.09s Building stage1 tool clippy-driver (x86_64-unknown-linux-gnu) Finished release [optimized] target(s) in 0.09s Building rustdoc for stage1 (x86_64-unknown-linux-gnu) Finished release [optimized] target(s) in 0.28s Finished release [optimized] target(s) in 15.26s Running build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/clippy_driver-8b407b140e0aa91c test result: ok. 592 passed; 0 failed; 3 ignored; 0 measured; 0 filtered out $ x.py build src/tools/rustdoc Building rustdoc for stage1 (x86_64-unknown-linux-gnu) Finished release [optimized] target(s) in 41.28s Build completed successfully in 0:00:41 $ x.py test src/test/rustdoc-ui Building stage0 tool compiletest (x86_64-unknown-linux-gnu) Finished release [optimized] target(s) in 0.12s Building rustdoc for stage1 (x86_64-unknown-linux-gnu) Finished release [optimized] target(s) in 0.10s test result: ok. 105 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 8.15s $ x.py build compiler/rustc Finished dev [unoptimized + debuginfo] target(s) in 0.09s Build completed successfully in 0:00:00 ``` Note a few things: - Clippy depends on stage1 rustc-dev artifacts, but rustc didn't have to be recompiled. Instead, the artifacts were copied automatically. - All steps are always enabled. There is no danger of forgetting a step, since only the entrypoints have to handle `download-rustc`. - Building the compiler (`compiler/rustc`) automatically does no work. Helps with https://github.com/rust-lang/rust/issues/81930. r? `@Mark-Simulacrum`
2021-03-01Rollup merge of #82360 - osa1:issue82317, r=Mark-SimulacrumJoshua Nelson-2/+9
config.toml parsing error improvements Improve error messages for musl-libdir and wasi-root keys. Previously the parser would panic with `unwrap()`. Now it prints Target "wasm32-wasi" does not have a "wasi-root" key (and similar for the `musl-libdir` field, which is used in target that use musl) Also update comments around wasi-root field to make it clear that the field is only valid in wasm32-wasi target and needs to be moved to a `[target.wasm32-wasi]` section to be valid. Fixes #82317 --- r? `@Mark-Simulacrum`
2021-03-01:arrow_up: rust-analyzerLaurențiu Nicola-17/+15
2021-03-01Use a crate to produce rustdoc tree comparisons instead of the `diff` commandMichael Howell-13/+71
It doesn't exist on Windows, so we bring our own unified diff implementation. Fixes #82409
2021-03-01Use diagnostic items in into_iter_collectionsCameron Steffen-24/+22
2021-03-01Auto merge of #82216 - kulikjak:fix-solaris-target, r=nagisa,Mark-Simulacrumbors-16/+32
make x86_64-pc-solaris the default target for x86-64 Solaris This change makes `x86_64-pc-solaris` the default compilation target for x86-64 Solaris/Illumos (based on [this exchange](https://github.com/rust-lang/rust/issues/68214#issuecomment-748042054) with `@varkor).` I tried several ways of doing this (leveraging the alias support added with #61761 and improved/fixed with #80073) and found out that cross-compilation to the new one is by far the simplest way of doing this. It can be achieved by adding the following arguments: `--build x86_64-sun-solaris --host x86_64-pc-solaris --target x86_64-pc-solaris` and enabling the cross compilation with `PKG_CONFIG_ALLOW_CROSS=1` environment variable. I also removed alias support altogether - `x86_64-pc-solaris` and `x86_64-sun-solaris` are now two separate targets. The problem with aliases is that even if rust internally knows that two are the same, other tools building with rust don't know that, resulting in build issues like the one with firefox mentioned [here](https://github.com/rust-lang/rust/issues/68214#issuecomment-746144229). I think that once the dust settles and `x86_64-pc-solaris` becomes the default, `x86_64-sun-solaris` can be removed. If you agree with the above, I have two subsequent questions: 1. Is there a preferred way to display deprecation warnings when `x86_64-sun-solaris` is passed into the compiler as an argument? I am not sure whether target deprecation was done before. 2. Where would be the best way to document this change for those using rust on Solaris? Without the cross-compilation arguments (used once to build a new version), the build won't work. Should I add it into [RELEASES.md](https://github.com/rust-lang/rust/blob/master/RELEASES.md)? Thanks!
2021-03-01Update Docker to use the correct targetJakub Kulik-13/+26
2021-03-01Update supported platforms docJakub Kulik-2/+2
2021-03-01Change default Solaris x86 target to x86_64-pc-solarisJakub Kulik-1/+4
2021-03-01Auto merge of #78360 - tmiasko:storage-markers, r=wesleywiser,oli-obkbors-3/+128
Remove storage markers if they won't be used during code generation The storage markers constitute a substantial portion of all MIR statements. At the same time, for builds without any optimizations, the storage markers have no further use during and after MIR optimization phase. If storage markers are not necessary for code generation, remove them.
2021-03-01Add natvis for Result, NonNull, CString, CStr, and CowRyan Levick-0/+51
2021-03-01Add regression testGiacomo Stevanato-0/+45
2021-03-01config.toml error reporting:Ömer Sinan Ağacan-2/+9
Improve error messages for musl-libdir and wasi-root keys. Previously the parser would panic with `unwrap()`. Now it prints Target "wasm32-wasi" does not have a "wasi-root" key (and similar for the `musl-libdir` field, which is used in target that use musl) Also update comments around wasi-root field to make it clear that the field is only valid in wasm32-wasi target and needs to be moved to a `[target.wasm32-wasi]` section to be valid. Fixes #82317
2021-03-01Rollup merge of #82643 - Aaron1011:test-macro-attrs, r=petrochenkovYuki Okushi-371/+2249
Add more proc-macro attribute tests r? `@petrochenkov`
2021-03-01Rollup merge of #82622 - jyn514:cargo-test-args, r=Mark-SimulacrumYuki Okushi-0/+1
Propagate `--test-args` for `x.py test src/tools/cargo` Fixes https://github.com/rust-lang/rust/issues/82621.