about summary refs log tree commit diff
path: root/src
AgeCommit message (Collapse)AuthorLines
2022-03-04Rollup merge of #94362 - Urgau:check-cfg-values, r=petrochenkovDylan DPC-3/+75
Add well known values to `--check-cfg` implementation This pull-request adds well known values for the well known names via `--check-cfg=values()`. [RFC 3013: Checking conditional compilation at compile time](https://rust-lang.github.io/rfcs/3013-conditional-compilation-checking.html#checking-conditional-compilation-at-compile-time) doesn't define this at all, but this seems a nice improvement. The activation is done by a empty `values()` (new syntax) similar to `names()` except that `names(foo)` also activate well known names while `values(aa, "aa", "kk")` would not. As stated this use a different activation logic because well known values for the well known names are not always sufficient. In fact this is problematic for every `target_*` cfg because of non builtin targets, as the current implementation use those built-ins targets to create the list the well known values. The implementation is straight forward, first we gather (if necessary) all the values (lazily or not) and then we apply them. r? ```@petrochenkov```
2022-03-04Auto merge of #94298 - Urgau:rustbuild-check-cfg, r=Mark-Simulacrumbors-0/+56
Enable conditional compilation checking on the Rust codebase This pull-request enable conditional compilation checking on every rust project build by the `bootstrap` tool. To be more specific, this PR only enable well known names checking + extra names (bootstrap, parallel_compiler, ...). r? `@Mark-Simulacrum`
2022-03-04Add known-bug directive to issue #47511 test casemarmeladema-4/+5
2022-03-04Downgrade `#[test]` on macro call to warningEsteban Kuber-27/+15
Follow up to #92959. Address #94508.
2022-03-04Distinguish binding assignments, use Ty::needs_dropEric Holk-0/+19
This better captures the actual behavior, rather than using hacks around whether the assignment has any projections.
2022-03-04Support RelWithDebInfo for lld.ridwanabdillahi-1/+9
2022-03-04Update `itertools`pierwill-5/+5
Update to 0.10.1
2022-03-04Rollup merge of #94600 - est31:master, r=notriddleMatthias Krüger-5/+5
Use if let instead of manual match Factored out of #94139 . `if let` is better here than both `let ... else` and `let ... = match`.
2022-03-04Rollup merge of #94593 - estebank:issue-94510, r=davidtwcoMatthias Krüger-0/+23
Do not recover from `Ty?` in macro parsing Follow up to #92746. Address #94510.
2022-03-04Rollup merge of #94568 - bjorn3:rustbuild_remove_dead_code, r=Mark-SimulacrumMatthias Krüger-17/+8
Remove some dead code from rustbuild This should reduce build time a tiny bit.
2022-03-04Rollup merge of #94524 - bjorn3:remove_num_cpus, r=Mark-SimulacrumMatthias Krüger-6/+6
Remove num_cpus dependency from bootstrap, build-manifest and rustc_s… …ession `std::threads::available_parallelism` was stabilized in rust 1.59. r? ```````````````````````````@Mark-Simulacrum```````````````````````````
2022-03-04Rollup merge of #94236 - reez12g:add_track_caller_87707, r=yaahcMatthias Krüger-0/+18
Add #[track_caller] to track callers when initializing poisoned Once This PR is for this Issue. https://github.com/rust-lang/rust/issues/87707 With this fix, we expect to be able to track the caller when poisoned Once is initialized.
2022-03-04Always include global target features in function attributesTomasz Miąsko-3/+3
This ensures that information about target features configured with `-C target-feature=...` or detected with `-C target-cpu=native` is retained for subsequent consumers of LLVM bitcode. This is crucial for linker plugin LTO, since this information is not conveyed to the plugin otherwise.
2022-03-04Auto merge of #94570 - shampoofactory:reopen-91719, r=workingjubileebors-49/+66
Reopen 91719 Reopened #91719, which was closed inadvertently due to technical difficulties.
2022-03-04Enable conditional compilation checking on the Rust codebaseLoïc BRANSTETT-0/+56
2022-03-04Add well known values to --check-cfg implementationLoïc BRANSTETT-1/+75
2022-03-04Use if let instead of manual matchest31-5/+5
2022-03-04librustdoc: adopt let else in more placesest31-95/+51
2022-03-04Auto merge of #94159 - erikdesjardins:align-load, r=nikicbors-8/+36
Add !align metadata on loads of &/&mut/Box Note that this refers to the alignment of what the loaded value points to, _not_ the alignment of the loaded value itself. r? `@ghost` (blocked on #94158)
2022-03-03add tests for metadata for unsized generics and opaquesMichael Goulet-0/+62
2022-03-03opaque types may also be sizedMichael Goulet-3/+20
2022-03-03type parameters have unit metadata if they are sizedMichael Goulet-0/+12
2022-03-04Auto merge of #94096 - cjgillot:ensure-stability, r=lcnrbors-378/+425
Ensure stability directives are checked in all cases Split off #93017 Stability and deprecation were not checked in all cases, for instance if a type error happened. This PR moves the check earlier in the pipeline to ensure the errors are emitted in all cases. r? `@lcnr`
2022-03-04fix invalid `unresolved imports` errors the asterisk wildcard syntax causesTakayuki Maeda-0/+28
use a path variabale
2022-03-04rustdoc-json: Make the `fns/generics.rs` test much more robustNixon Enraght-Moony-4/+25
2022-03-04rustdoc-json: Include GenericParamDefKind::Type::synthetic in JSONMartin Nordholts-5/+43
The rustdoc JSON for ``` pub fn f(_: impl Clone) {} ``` will effectively be ``` pub fn f<impl Clone: Clone>(_: impl Clone) ``` where a synthetic generic parameter called `impl Clone` with generic trait bound `Clone` is added to the function declaration. The generated HTML filters out these generic parameters by doing `self.params.iter().filter(|p| !p.is_synthetic_type_param())`, because the synthetic generic parameter is not of interest to regular users. For the same reason, we should expose whether or not a generic parameter is synthetic or not also in the rustdoc JSON, so that rustdoc JSON clients can also have the option to hide synthetic generic parameters.
2022-03-03delay bug instead of skipping check_exprMichael Goulet-1/+42
2022-03-03Add #[track_caller] to track callers when initializing poisoned Oncereez12g-0/+18
2022-03-04Auto merge of #94588 - Dylan-DPC:rollup-7pxd0i3, r=Dylan-DPCbors-101/+80
Rollup of 10 pull requests Successful merges: - #88805 (Clarification of default socket flags) - #93418 (rustdoc & doc: no `shortcut` for `rel="icon"`) - #93913 (Remove the everybody loops pass) - #93965 (Make regular stdio lock() return 'static handles) - #94339 (ARM: Only allow using d16-d31 with asm! when supported by the target) - #94404 (Make Ord and PartialOrd opt-out in `newtype_index`) - #94466 (bootstrap: correct reading of flags for llvm) - #94572 (Use `HandleOrNull` and `HandleOrInvalid` in the Windows FFI bindings.) - #94575 (CTFE SwitchInt: update comment) - #94582 (Fix a bug in `x.py fmt` that prevents some files being formatted.) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-03-04Do not recover from `Ty?` in macro parsingEsteban Kuber-0/+23
Follow up to #92746. Address #94510.
2022-03-04Rollup merge of #94582 - nnethercote:fix-x-fmt-bug, r=Mark-SimulacrumDylan DPC-1/+6
Fix a bug in `x.py fmt` that prevents some files being formatted. If you have a file in the repository root with the same name as a file somewhere within a directory, the latter currently won't get formatted. I have experienced this multiple times and not understood what was happening; I finally figured out the problem today. This commit fixes the problem. r? ```@Mark-Simulacrum```
2022-03-04Rollup merge of #94466 - jonhoo:bootstrap-proper-env-flags, r=Mark-SimulacrumDylan DPC-29/+70
bootstrap: correct reading of flags for llvm First, this reverts the `CFLAGS`/`CXXFLAGS` of #93918. Those flags are already read by `cc` and populated into `Build` earlier on in the process. We shouldn't be overriding that based on `CFLAGS`, since `cc` also respects overrides like `CFLAGS_{TARGET}` and `HOST_CFLAGS`, which we want to take into account. Second, this adds the same capability to specify target-specific versions of `LDFLAGS` as we have through `cc` for the `C*` flags: https://github.com/alexcrichton/cc-rs#external-configuration-via-environment-variables
2022-03-04Rollup merge of #93913 - bjorn3:remove_everybody_loops, r=jackh726Dylan DPC-67/+0
Remove the everybody loops pass It isn't used anymore by rustdoc. Split out of https://github.com/rust-lang/rust/pull/92895. There has been some previous discussion there.
2022-03-04Rollup merge of #93418 - ojeda:no-shortcut, r=camelidDylan DPC-4/+4
rustdoc & doc: no `shortcut` for `rel="icon"` According to https://html.spec.whatwg.org/multipage/links.html#rel-icon: > For historical reasons, the `icon` keyword may be preceded by the keyword "`shortcut`". And to https://developer.mozilla.org/en-US/docs/Web/HTML/Link_types: > **Warning:** The `shortcut` link type is often seen before `icon`, but this link type is non-conforming, ignored and **web authors must not use it anymore.** While it was removed from the Rust logo case a while ago in commit 085679c ("Use theme-adaptive SVG favicon from other Rust sites"), it is still there for the custom logo case. Also updated a few other instances. Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2022-03-04Auto merge of #94009 - compiler-errors:gat-rustdoc, r=GuillaumeGomezbors-176/+363
Support GATs in Rustdoc Implements: 1. Rendering GATs in trait definitions and impl blocks 2. Rendering GATs in types (e.g. in the return type of a function) Fixes #92341 This is my first rustdoc PR, so I have absolutely no idea how to produce tests for this. Advice from the rustdoc team would be wonderful! I tested locally and things looked correct: ![image](https://user-images.githubusercontent.com/3674314/153988325-9732cbf3-0645-4e1a-9e64-ddfd93877b55.png)
2022-03-03Generalize `get_nullable_type` to allow types where null is all-ones.Dan Gohman-2/+2
Generalize get_nullable_type to accept types that have an all-ones bit pattern as their sentry "null" value. This will allow [`OwnedFd`], [`BorrowedFd`], [`OwnedSocket`], and [`BorrowedSocket`] to be marked with `#[rustc_nonnull_optimization_guaranteed]`, which will allow `Option<OwnedFd>`, `Option<BorrowedFd>`, `Option<OwnedSocket>`, and `Option<BorrowedSocket>` to be used in FFI declarations, as described in the [I/O safety RFC]. For example, it will allow a function like `open` on Unix and `WSASocketW` on Windows to be declared using `Option<OwnedFd>` and `Option<OwnedSocket>` return types, respectively. The actual change to add `#[rustc_nonnull_optimization_guaranteed]` to the abovementioned types will be a separate PR, as it'll depend on having this patch in the stage0 compiler. Also, update the diagnostics to mention that "niche optimizations" are used in libstd as well as libcore, as `rustc_layout_scalar_valid_range_start` and `rustc_layout_scalar_valid_range_end` are already in use in libstd. [`OwnedFd`]: https://github.com/rust-lang/rust/blob/c9dc44be24c58ff13ce46416c4b97ab5c1bd8429/library/std/src/os/fd/owned.rs#L49 [`BorrowedFd`]: https://github.com/rust-lang/rust/blob/c9dc44be24c58ff13ce46416c4b97ab5c1bd8429/library/std/src/os/fd/owned.rs#L29 [`OwnedSocket`]: https://github.com/rust-lang/rust/blob/c9dc44be24c58ff13ce46416c4b97ab5c1bd8429/library/std/src/os/windows/io/socket.rs#L51 [`BorrowedSocket`]: https://github.com/rust-lang/rust/blob/c9dc44be24c58ff13ce46416c4b97ab5c1bd8429/library/std/src/os/windows/io/socket.rs#L29 [I/O safety RFC]: https://github.com/rust-lang/rfcs/blob/master/text/3128-io-safety.md#ownedfd-and-borrowedfdfd-1
2022-03-03Adjusted diagnostic output so that if there is no `use` in a item sequence,Felix S. Klock II-2/+2
then we just suggest the first legal position where you could inject a use. To do this, I added `inject_use_span` field to `ModSpans`, and populate it in parser (it is the span of the first token found after inner attributes, if any). Then I rewrote the use-suggestion code to utilize it, and threw out some stuff that is now unnecessary with this in place. (I think the result is easier to understand.) Then I added a test of issue 87613.
2022-03-03Adjusted diagnostic output so that if there is no `use` in a item sequence,Felix S. Klock II-4/+106
then we just suggest the first legal position where you could inject a use. To do this, I added `inject_use_span` field to `ModSpans`, and populate it in parser (it is the span of the first token found after inner attributes, if any). Then I rewrote the use-suggestion code to utilize it, and threw out some stuff that is now unnecessary with this in place. (I think the result is easier to understand.) Then I added a test of issue 87613.
2022-03-03Associate multiple with a crate too.Felix S. Klock II-3/+4
2022-03-03Associate multiple with a crate too.Felix S. Klock II-6/+7
2022-03-04Fix a bug in `x.py fmt` that prevents some files being formatted.Nicholas Nethercote-1/+6
If you have a file in the repository root with the same name as a file somewhere within a directory, the latter currently won't get formatted. I have experienced this multiple times and not understood what was happening; I finally figured out the problem today. This commit fixes the problem.
2022-03-03Emit `unused_attributes` if a level attr only has a reasonxFrednet-9/+81
2022-03-03Auto merge of #94571 - matthiaskrgr:rollup-4ul5ydb, r=matthiaskrgrbors-0/+41
Rollup of 8 pull requests Successful merges: - #92697 (Use cgroup quotas for calculating `available_parallelism`) - #94057 (improve comments for `simplify_type`) - #94547 (`parse_tt` cleanups) - #94550 (rustdoc: Add test for higher kinded functions generated by macros) - #94551 (Doc: Fix use of quote instead of backstick in Adapter::map.) - #94554 (Fix invalid lint_node_id being put on a removed stmt) - #94555 (all: fix some typos) - #94563 (Remove a unnecessary `..` pattern) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-03-03Tweak move errorEsteban Kuber-59/+94
Point at method definition that causes type to be consumed. Fix #94056.
2022-03-03add testsMichael Goulet-0/+76
2022-03-03don't forget generics for GATs in implsMichael Goulet-8/+2
2022-03-03make generic projection types print correctlyMichael Goulet-41/+107
2022-03-03Add a missing `#[no_mangle]`scottmcm-0/+1
2022-03-03refactor: prepare to associate multiple spans with a module.Felix S. Klock II-2/+2
2022-03-03refactor: prepare to associate multiple spans with a module.Felix S. Klock II-2/+2