about summary refs log tree commit diff
path: root/src
AgeCommit message (Collapse)AuthorLines
2022-06-21Auto merge of #98148 - c410-f3r:assert-compiler, r=oli-obkbors-0/+42
[RFC 2011] Expand expressions where possible Tracking issue: https://github.com/rust-lang/rust/issues/44838 Fourth step of https://github.com/rust-lang/rust/pull/96496 Extends https://github.com/rust-lang/rust/pull/97665 considering expressions that are good candidates for expansion. r? `@oli-obk`
2022-06-20Rollup merge of #98276 - compiler-errors:const-format-macro, r=oli-obkMatthias Krüger-0/+99
Mention formatting macros when encountering `ArgumentV1` method in const Also open to just closing this if it's overkill. There are a lot of other distracting error messages around, so maybe it's not worth fixing just this one. Fixes #93665
2022-06-20Rollup merge of #98267 - compiler-errors:suggest-wildcard-arm, r=oli-obkMatthias Krüger-261/+210
Don't omit comma when suggesting wildcard arm after macro expr * Also adds `Span::eq_ctxt` to consolidate the various usages of `span.ctxt() == other.ctxt()` * Also fixes an unhygenic usage of spans which caused the suggestion to render weirdly when we had one arm match in a macro * Also always suggests a comma (i.e. even after a block) if we're rendering a wildcard arm in a single-line match (looks prettier :rose:) Fixes #94866
2022-06-20Rollup merge of #98159 - PrestonFrom:issue_95665, r=petrochenkovDylan DPC-0/+33
Include ForeignItem when visiting types for WF check Addresses Issue 95665 by including `hir::Node::ForeignItem` as a valid type to visit in `diagnostic_hir_wf_check`. Fixes #95665
2022-06-20Auto merge of #98284 - JohnTitor:rollup-7lbs143, r=JohnTitorbors-85/+163
Rollup of 5 pull requests Successful merges: - #98183 (Fix pretty printing of empty bound lists in where-clause) - #98268 (Improve `lifetime arguments are not allowed on` error message) - #98273 (Fix minor documentation typo) - #98274 (Minor improvements on error for `Self` type in items that don't allow it) - #98281 (Fix typo in `HashMap::drain` docs) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-06-20Rollup merge of #98274 - compiler-errors:self-type-error, r=cjgillotYuki Okushi-20/+95
Minor improvements on error for `Self` type in items that don't allow it Fixes #93796
2022-06-20Rollup merge of #98268 - compiler-errors:disallowed-generics-better, r=lcnrYuki Okushi-65/+65
Improve `lifetime arguments are not allowed on` error message Actually mention what thing we're improperly trying to add lifetime generics to.
2022-06-20Rollup merge of #98183 - dtolnay:emptybound, r=lcnrYuki Okushi-0/+3
Fix pretty printing of empty bound lists in where-clause Repro: ```rust macro_rules! assert_item_stringify { ($item:item $expected:literal) => { assert_eq!(stringify!($item), $expected); }; } fn main() { assert_item_stringify! { fn f<'a, T>() where 'a:, T: {} "fn f<'a, T>() where 'a:, T: {}" } } ``` Previously this assertion would fail because rustc renders the where-clause as `where 'a, T` which is invalid syntax. This PR makes the above assertion pass. This bug also affects `-Zunpretty=expanded`. The intention is for that to emit syntactically valid code, but the buggy output is not valid Rust syntax. ```console $ rustc <(echo "fn f<'a, T>() where 'a:, T: {}") -Zunpretty=expanded #![feature(prelude_import)] #![no_std] #[prelude_import] use ::std::prelude::rust_2015::*; #[macro_use] extern crate std; fn f<'a, T>() where 'a, T {} ``` ```console $ rustc <(echo "fn f<'a, T>() where 'a:, T: {}") -Zunpretty=expanded | rustc - error: expected `:`, found `,` --> <anon>:7:23 | 7 | fn f<'a, T>() where 'a, T {} | ^ expected `:` ```
2022-06-20Auto merge of #98264 - compiler-errors:missing-arg-placeholder, r=jackh726bors-111/+111
Make missing argument placeholder more obvious that it's a placeholder Use `/* ty */` instead of `{ty}`, since people might be misled into thinking that this is valid syntax, and not just a diagnostic placeholder. Fixes #96880
2022-06-19Include ForeignItem when visiting types for WF checkPreston From-0/+33
Addresses Issue 95665 by including `hir::Node::ForeignItem` as a valid type to visit in `diagnostic_hir_wf_check`. Fixes #95665
2022-06-19Mention formatting macros when encountering ArgumentV1::new in constMichael Goulet-0/+99
2022-06-20Auto merge of #97931 - xldenis:fix-if-let-source-scopes, r=nagisabors-165/+279
Fix `SourceScope` for `if let` bindings. Fixes #97799. I'm not sure how to test this properly, is there any way to observe the difference in behavior apart from `ui` tests? I'm worried that they would be overlooked in the case of a regression.
2022-06-19Don't suggest adding Self as a type parameterMichael Goulet-3/+2
2022-06-19Mention what item is using an invalid `Self` typeMichael Goulet-20/+96
2022-06-19Be more specific for what lifetimes are not allowed onMichael Goulet-65/+65
2022-06-20Auto merge of #98265 - JohnTitor:rollup-wtfqc4g, r=JohnTitorbors-2/+2
Rollup of 4 pull requests Successful merges: - #95534 (Add `core::mem::copy` to complement `core::mem::drop`.) - #97912 (Stabilize `Path::try_exists()` and improve doc) - #98225 (Make debug_triple depend on target json file content rather than file path) - #98257 (Fix typos in `IntoFuture` docs) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-06-19Be more hygenic with spansMichael Goulet-260/+174
2022-06-19Only omit trailing comma if block doesn't come from macro expansionMichael Goulet-1/+36
2022-06-20Rollup merge of #98225 - bjorn3:stable_target_json_hash, r=nagisaYuki Okushi-2/+2
Make debug_triple depend on target json file content rather than file path This ensures that changes to target json files will force a recompilation. And more importantly that moving the files doesn't force a recompilation. This should fix https://github.com/Rust-for-Linux/linux/issues/792 (cc ``@ojeda)``
2022-06-19Auto merge of #97268 - jyn514:faster-assemble, r=Mark-Simulacrumbors-20/+46
Make "Assemble stage1 compiler" orders of magnitude faster (take 2) This used to take upwards of 5 seconds for me locally. I found that the culprit was copying the downloaded LLVM shared object: ``` [22:28:03] Install "/home/jnelson/rust-lang/rust/build/x86_64-unknown-linux-gnu/ci-llvm/lib/libLLVM-14-rust-1.62.0-nightly.so" to "/home/jnelson/rust-lang/rust/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib/libLLVM-14-rust-1.62.0-nightly.so" [22:28:09] c Sysroot { compiler: Compiler { stage: 1, host: x86_64-unknown-linux-gnu(x86_64-unknown-linux-gnu) } } ``` It turned out that `install()` used full copies unconditionally. Change it to try using a hard-link before falling back to copying. - Panic if we generate a symbolic link in a tarball - Change install to use copy internally, like in my previous PR - Change copy to dereference symbolic links, which avoids the previous regression in #96803. I also took the liberty of fixing `x dist llvm-tools` to work even if you don't call `x build` previously.
2022-06-19Make missing argument placeholder more obvious that it's a placeholderMichael Goulet-111/+111
2022-06-19Make "Assemble stage1 compiler" orders of magnitude fasterJoshua Nelson-18/+20
This used to take upwards of 5 seconds for me locally. I found that the culprit was copying the downloaded LLVM shared object: ``` [22:28:03] Install "/home/jnelson/rust-lang/rust/build/x86_64-unknown-linux-gnu/ci-llvm/lib/libLLVM-14-rust-1.62.0-nightly.so" to "/home/jnelson/rust-lang/rust/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib/libLLVM-14-rust-1.62.0-nightly.so" [22:28:09] c Sysroot { compiler: Compiler { stage: 1, host: x86_64-unknown-linux-gnu(x86_64-unknown-linux-gnu) } } ``` It turned out that `install()` used full copies unconditionally. Change it to use `copy()` internally, which uses hard links instead when available. Note that this has a change in behavior: Installing a file will also change permissions on the source, not just the destination, if hard links are used. To avoid changing the behavior on symlinks for existing code, I introduce a new function `copy_internal` which only dereferences symlinks when told to do so.
2022-06-19Panic if `dist` generates a symbolic link in a generated tarballJoshua Nelson-2/+26
This avoids regressions in rustup-toolchain-install-master
2022-06-19Preserve the path of the target spec json file for usage by rustdocbjorn3-2/+2
2022-06-19Auto merge of #98255 - Dylan-DPC:rollup-hr129rg, r=Dylan-DPCbors-13/+53
Rollup of 5 pull requests Successful merges: - #98105 (rustdoc: remove tuple link on round braces) - #98136 (Rename `impl_constness` to `constness`) - #98146 (Remove --memory-init-file flag when linking with Emscripten) - #98219 (Skip late bound regions in GATSubstCollector) - #98233 (Remove accidental uses of `&A: Allocator`) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-06-19Rollup merge of #98105 - notriddle:notriddle/tuple-links, r=jshaDylan DPC-13/+53
rustdoc: remove tuple link on round braces This is #98069 but for tuples. The reasoning is the same: * This PR also changes it so that tuples with all-generic elements still link to the primitive.tuple.html page, just like slices. So there still plenty of on-ramps for anybody who doesn't know about it. * It's too hard to see when round braces are a separate link from the type inside of them. * It's too hard to click even if you do notice them. Before: * impl [ToSocketAddrs](https://doc.rust-lang.org/nightly/std/net/trait.ToSocketAddrs.html) for [(](https://doc.rust-lang.org/nightly/std/primitive.tuple.html)[IpAddr](https://doc.rust-lang.org/nightly/std/net/enum.IpAddr.html), [u16](https://doc.rust-lang.org/nightly/std/primitive.u16.html)[)](https://doc.rust-lang.org/nightly/std/primitive.tuple.html) * impl<K, V> [FromIterator](https://notriddle.com/notriddle-rustdoc-test/std/iter/trait.FromIterator.html)<[(](https://notriddle.com/notriddle-rustdoc-test/std/primitive.tuple.html)K, V[)](https://notriddle.com/notriddle-rustdoc-test/std/primitive.tuple.html)> for [BTreeMap](https://notriddle.com/notriddle-rustdoc-test/std/collections/struct.BTreeMap.html)<K, V> After: * impl [ToSocketAddrs](https://doc.rust-lang.org/nightly/std/net/trait.ToSocketAddrs.html) for ([IpAddr](https://doc.rust-lang.org/nightly/std/net/enum.IpAddr.html), [u16](https://doc.rust-lang.org/nightly/std/primitive.u16.html)) * impl<K, V> [FromIterator](https://notriddle.com/notriddle-rustdoc-test/std/iter/trait.FromIterator.html)<[(K, V)](https://notriddle.com/notriddle-rustdoc-test/std/primitive.tuple.html)> for [BTreeMap](https://notriddle.com/notriddle-rustdoc-test/std/collections/struct.BTreeMap.html)<K, V>
2022-06-19Auto merge of #98238 - cjgillot:lint-mod, r=oli-obkbors-34/+67
Make some lints incremental. Those lints do not track a state, so don't need to be performed for the full crate at once.
2022-06-19Bless 32bit ui tests.Camille GILLOT-12/+12
2022-06-19Auto merge of #97944 - nikic:freebsd-update, r=Mark-Simulacrumbors-10/+10
Update FreeBSD toolchain to 12.3 Update the FreeBSD toolchain to 12.3. FreeBSD 11 is EOL since September 30, 2021. I've locally verified that the `dist-x86_64-freebsd` docker image builds successfully. r? `@Mark-Simulacrum`
2022-06-19Auto merge of #98242 - matthiaskrgr:rollup-qbbkwtf, r=matthiaskrgrbors-29/+36
Rollup of 5 pull requests Successful merges: - #97511 (Don't build the compiler before building rust-demangler) - #98165 (once cell renamings) - #98207 (Update cargo) - #98229 (Add new eslint checks) - #98230 (Fix weird js condition) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-06-19Rollup merge of #98230 - GuillaumeGomez:weird-js-condition, r=notriddleMatthias Krüger-4/+1
Fix weird js condition While going around the code, I found this weird condition. Fixing also affects the generated results in some cases apparently (could only find this one). Any idea maybe `@notriddle?` r? `@notriddle`
2022-06-19Rollup merge of #98229 - GuillaumeGomez:eslint-checks, r=Dylan-DPCMatthias Krüger-0/+2
Add new eslint checks r? ```@Dylan-DPC```
2022-06-19Rollup merge of #98207 - arlosi:update-cargo, r=Dylan-DPCMatthias Krüger-1/+1
Update cargo 4 commits in 4d92f07f34ba7fb7d7f207564942508f46c225d3..8d42b0e8794ce3787c9f7d6d88b02ae80ebe8d19 2022-06-10 01:11:04 +0000 to 2022-06-17 16:46:26 +0000 - Use specific terminology for sparse HTTP-based registry (rust-lang/cargo#10764) - chore: Upgrade to clap 3.2 (rust-lang/cargo#10753) - Improve testing framework for http registries (rust-lang/cargo#10738) - doc: Improve example of using the links field (rust-lang/cargo#10728)
2022-06-19Rollup merge of #98165 - WaffleLapkin:once_things_renamings, r=m-ou-seMatthias Krüger-22/+26
once cell renamings This PR does the renamings proposed in https://github.com/rust-lang/rust/issues/74465#issuecomment-1153703128 - Move/rename `lazy::{OnceCell, Lazy}` to `cell::{OnceCell, LazyCell}` - Move/rename `lazy::{SyncOnceCell, SyncLazy}` to `sync::{OnceLock, LazyLock}` (I used `Lazy...` instead of `...Lazy` as it seems to be more consistent, easier to pronounce, etc) ```@rustbot``` label +T-libs-api -T-libs
2022-06-19Rollup merge of #97511 - jyn514:faster-cargo-build, r=Mark-SimulacrumMatthias Krüger-2/+6
Don't build the compiler before building rust-demangler This saves a lot of time compiling, since rust-demangler doesn't actually use any unstable features. This is not quite ideal because it uses ToolStd, not ToolBootstrap, so rust-demangler would be able to add unstable library features in the future. But it's a lot better than before, and `builder.cargo` doesn't currently know how to handle stages other than 0.
2022-06-19Make some lints incremental.Camille GILLOT-22/+55
2022-06-18Auto merge of #98237 - RalfJung:miri, r=RalfJungbors-9/+13
update Miri Fixes https://github.com/rust-lang/rust/issues/98107 r? `@ghost` Cc `@rust-lang/miri`
2022-06-18Remove weird JS conditionGuillaume Gomez-4/+1
2022-06-18update MiriRalf Jung-9/+13
2022-06-18Auto merge of #96501 - jyn514:individual-paths, r=Mark-Simulacrumbors-67/+190
Pass all paths to `Step::run` at once when using `ShouldRun::krate` Helps with https://github.com/rust-lang/rust/pull/95503. The goal is to run `cargo test -p rustc_data_structures -p rustc_lint_defs` instead of `cargo test -p rustc_data_structures; cargo test -p rustc_lint_defs`, which should both recompile less and avoid replaying cached warnings. This was surprisingly complicated. The main changes are: 1. Invert the order of iteration in `StepDescription::run`. Previously, it did something like: ```python for path in paths: for (step, should_run) in should_runs: if let Some(set) = should_run.pathset_for_path(path): step.run(builder, set) ``` That worked ok for individual paths, but didn't allow passing more than one path at a time to `Step::run` (since `pathset_for_paths` only had one path available to it). Change it to instead look at the intersection of `paths` and `should_run.paths`: ```python for (step, should_run) in should_runs: if let Some(set) = should_run.pathset_for_paths(paths): step.run(builder, set) ``` 2. Change `pathset_for_path` to take multiple pathsets. The goal is to avoid `x test library/alloc` testing *all* library crates, instead of just alloc. The changes here are similarly subtle, to use the intersection between the paths rather than all paths in `should_run.paths`. I added a test for the behavior to try and make it more clear. Note that we use pathsets instead of just paths to allow for sets with multiple aliases (*cough* `all_krates` *cough*). See the documentation added in the next commit for more detail. 3. Change `StepDescription::run` to explicitly handle 0 paths. Before this was implicitly handled by the `for` loop, which just didn't excute when there were no paths. Now it needs a check, to avoid trying to run all steps (this is a problem for steps that use `default_condition`). 4. Change `RunDescription` to have a list of pathsets, rather than a single path. 5. Remove paths as they're matched This allows checking at the end that no invalid paths are left over. Note that if two steps matched the same path, this will no longer run both; but that's a bug anyway. 6. Handle suite paths separately from regular sets. Running multiple suite paths at once instead of in separate `make_run` invocations is both tricky and not particularly useful. The respective test Steps already handle this by introspecting the original paths. Avoid having to deal with it by moving suite handling into a seperate loop than `PathSet::Set` checks. `@rustbot` label +A-rustbuild
2022-06-18Fix bug when using `--bless`Michael Howell-3/+1
2022-06-18Add test cases for tuples with linksMichael Howell-0/+18
2022-06-18Add tests for fixed bugsJoshua Nelson-4/+40
2022-06-18Pass all paths to `Step::run` at once when using `ShouldRun::krate`Joshua Nelson-66/+153
This was surprisingly complicated. The main changes are: 1. Invert the order of iteration in `StepDescription::run`. Previously, it did something like: ```python for path in paths: for (step, should_run) in should_runs: if let Some(set) = should_run.pathset_for_path(path): step.run(builder, set) ``` That worked ok for individual paths, but didn't allow passing more than one path at a time to `Step::run` (since `pathset_for_paths` only had one path available to it). Change it to instead look at the intersection of `paths` and `should_run.paths`: ```python for (step, should_run) in should_runs: if let Some(set) = should_run.pathset_for_paths(paths): step.run(builder, set) ``` 2. Change `pathset_for_path` to take multiple pathsets. The goal is to avoid `x test library/alloc` testing *all* library crates, instead of just alloc. The changes here are similarly subtle, to use the intersection between the paths rather than all paths in `should_run.paths`. I added a test for the behavior to try and make it more clear. Note that we use pathsets instead of just paths to allow for sets with multiple aliases (*cough* `all_krates` *cough*). See the documentation added in the next commit for more detail. 3. Change `StepDescription::run` to explicitly handle 0 paths. Before this was implicitly handled by the `for` loop, which just didn't excute when there were no paths. Now it needs a check, to avoid trying to run all steps (this is a problem for steps that use `default_condition`). 4. Change `RunDescription` to have a list of pathsets, rather than a single path. 5. Remove paths as they're matched This allows checking at the end that no invalid paths are left over. Note that if two steps matched the same path, this will no longer run both; but that's a bug anyway. 6. Handle suite paths separately from regular sets. Running multiple suite paths at once instead of in separate `make_run` invocations is both tricky and not particularly useful. The respective test Steps already handle this by introspecting the original paths. Avoid having to deal with it by moving suite handling into a seperate loop than `PathSet::Set` checks.
2022-06-18Adding new eslint checks:Guillaume Gomez-0/+2
* no-sequences * no-throw-literal
2022-06-18Auto merge of #98216 - JohnTitor:rollup-jlcmu5d, r=JohnTitorbors-82/+155
Rollup of 5 pull requests Successful merges: - #97803 (Impl Termination for Infallible and then make the Result impls of Termination more generic) - #97828 (Allow configuring where artifacts are downloaded from) - #98150 (Emscripten target: replace -g4 with -g, and -g3 with --profiling-funcs) - #98195 (Fix rustdoc json primitive handling) - #98205 (Remove a possible unnecessary assignment) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-06-18Rollup merge of #98195 - GuillaumeGomez:rustdoc-json-primitive, r=notriddleYuki Okushi-3/+20
Fix rustdoc json primitive handling Fixes https://github.com/rust-lang/rust/issues/98006. cc `@matthiaskrgr`
2022-06-18Rollup merge of #97828 - ferrocene:pa-config-artifacts, r=jyn514Yuki Okushi-73/+132
Allow configuring where artifacts are downloaded from Bootstrap has support for downloading prebuilt LLVM and rustc artifacts to speed up local builds, but that currently works only for users working on `rust-lang/rust`. Forks of the repository (for example Ferrocene) might have different URLs to download artifacts from, or might use a different email address on merge commits, breaking both LLVM and rustc artifact downloads. This PR refactors bootstrap to load the download URLs and other constants from `src/stage0.json`, allowing downstream forks to tweak those values. It also future-proofs the download code to easily allow forks to add their own custom protocols (like `s3://`). This PR is best reviewed commit-by-commit.
2022-06-18Rollup merge of #97803 - Gankra:term, r=dtolnayYuki Okushi-6/+3
Impl Termination for Infallible and then make the Result impls of Termination more generic This allows things like `Result<ExitCode, E>` to 'just work'
2022-06-18Auto merge of #97652 - RalfJung:cenum_impl_drop_cast, r=nagisabors-1/+16
make cenum_impl_drop_cast deny-by-default Also make it show up as future breakage diagnostic. In https://github.com/rust-lang/rust/pull/96862 we are proposing to change behavior of those drops *again*, so this looks like a good opportunity to increase our pressure on getting them out of the ecosystem. Looking at the [tracking issue](https://github.com/rust-lang/rust/issues/73333), so far nobody spoke up in favor of this (accidental) feature. Cc https://github.com/rust-lang/rust/issues/73333 `@oli-obk`