about summary refs log tree commit diff
path: root/src/test
AgeCommit message (Collapse)AuthorLines
2021-07-22Don't hide fields of enum struct variantsNoah Lev-4/+2
* The toggle adds visual clutter * It's easy to miss that there are fields * Tuple variant fields are always shown, so it is inconsistent to hide struct variant fields * It's annoying to have to click the toggle every time
2021-07-22Add regression tests for the impl_trait_in_bindings ICEsAlex Macleod-0/+221
2021-07-22Auto merge of #86212 - ↵bors-114/+2
pnkfelix:mainline-targetted-revert-81473-warn-write-only-fields, r=simulacrum Revert PR 81473 to resolve (on mainline) issues 81626 and 81658. This is a nightly-targetted variant of PR #83171 The intent is to just address issue #81658 on all release channels, rather that keep repeatedly reverting PR #83171 on beta. However, our intent is *also* to reland PR #83171 after we have addressed issue #81658 , most likely by coupling the re-landing of PR #83171 with an enhancement like PR #83004
2021-07-22Add comment and more tests.Charles Lew-0/+384
2021-07-22Extend HIR WF checking to fieldsAaron Hill-8/+8
2021-07-22Rollup merge of #87307 - michaelwoerister:pgo-unwind-msvc, r=nagisaGuillaume Gomez-61/+1
Allow combining -Cprofile-generate and -Cpanic=unwind when targeting MSVC. The LLVM limitation that previously prevented this has been fixed in LLVM 9 which is older than the oldest LLVM version we currently support. Fixes https://github.com/rust-lang/rust/issues/61002. r? ``@nagisa`` (or anyone else from ``@rust-lang/wg-llvm)``
2021-07-22Rollup merge of #87288 - ijackson:rustdoc-theme, r=GuillaumeGomezGuillaume Gomez-11/+47
rustdoc: Restore --default-theme, etc, by restoring varname escaping In #86157 cd0f93193c84ddc6698f9b65909da71c084dcb74 Use Tera templates for rustdoc. dropped the following transformation from the keys of the default settings element's `data-` attribute names: .map(|(k, v)| format!(r#" data-{}="{}""#, k.replace('-', "_"), Escape(v))) The `Escape` part is indeed no longer needed, because Tera does that for us. But the massaging of `-` to `_` is needed, for the (bizarre) reasons explained in the new comments. I have tested that the default theme function works again for me. I have also verified that passing (in shell syntax) '--default-theme="zork&"' escapes the value in the HTML. Closes #87263
2021-07-22Rollup merge of #87281 - rust-lang:issue-81487, r=nikomatsakisGuillaume Gomez-0/+19
Normalize generic_ty before checking if bound is met Fixes #81487 r? `@nikomatsakis`
2021-07-22Rollup merge of #87270 - GuillaumeGomez:item-summary-table, r=notriddleGuillaume Gomez-0/+13
Don't display <table> in item summary Fixes #87231. r? `@notriddle`
2021-07-22bless nll testsOli Scherer-20/+16
2021-07-22Add a regression testOli Scherer-0/+24
2021-07-22Make mir borrowck's use of opaque types independent of the typeck query's resultOli Scherer-174/+96
2021-07-22Move implementors directly into lib2Guillaume Gomez-1/+1
2021-07-22Add tests for default-settingsGuillaume Gomez-0/+60
2021-07-22Auto merge of #87265 - Aaron1011:hir-wf-fn, r=estebankbors-44/+68
Support HIR wf checking for function signatures During function type-checking, we normalize any associated types in the function signature (argument types + return type), and then create WF obligations for each of the normalized types. The HIR wf code does not currently support this case, so any errors that we get have imprecise spans. This commit extends `ObligationCauseCode::WellFormed` to support recording a function parameter, allowing us to get the corresponding HIR type if an error occurs. Function typechecking is modified to pass this information during signature normalization and WF checking. The resulting code is fairly verbose, due to the fact that we can no longer normalize the entire signature with a single function call. As part of the refactoring, we now perform HIR-based WF checking for several other 'typed items' (statics, consts, and inherent impls). As a result, WF and projection errors in a function signature now have a precise span, which points directly at the responsible type. If a function signature is constructed via a macro, this will allow the error message to point at the code 'most responsible' for the error (e.g. a user-supplied macro argument).
2021-07-22Auto merge of #87250 - robojumper:87199-sized-relaxation, r=nikomatsakisbors-0/+56
Fix implicit Sized relaxation when attempting to relax other, unsupported trait Fixes #87199. Do note that this bug fix causes code like the `ref_arg::<[i32]>(&[5]);` line in the test case in combination with an affected function to no longer compile.
2021-07-21temporarily ignore a test until we reland PR 83171.Felix S. Klock II-0/+2
2021-07-21Revert PR 81473 to resolve (on mainline) issues 81626 and 81658.Felix S. Klock II-114/+0
Revert "Add missing brace" This reverts commit 85ad773049536d7fed9a94ae0ac74f97135c8655. Revert "Simplify base_expr" This reverts commit 899aae465eb4ef295dc1eeb2603f744568e0768c. Revert "Warn write-only fields" This reverts commit d3c69a4c0dd98af2611b7553d1a65afef6a6ccb0.
2021-07-22Auto merge of #87246 - rust-lang:placeholder-pretty, r=nikomatsakisbors-10/+10
When pretty printing, name placeholders as bound regions Split from #85499 When we see a placeholder that we are going to print, treat it as a bound var (and add it to a `for<...>`
2021-07-21Remove cargo workspace to build rustdoc-gui test crates because of cargo ↵Guillaume Gomez-24/+0
config not being applied
2021-07-21Add test to ensure tables are not inside items summaryGuillaume Gomez-0/+13
2021-07-21Rollup merge of #87346 - rylev:rename-force-warn, r=nikomatsakisEric Huss-32/+32
Rename force-warns to force-warn The renames the `--force-warns` option to `--force-warn`. This mirrors other lint options like `--warn` and `--deny` which are in the singular. r? `@nikomatsakis` cc `@ehuss` - this option is being used by Cargo. How do we make sure the transition to using the new name is as smooth as possible?
2021-07-21Rollup merge of #87024 - weihanglo:issue-85494, r=ManishearthEric Huss-7/+38
rustdoc: show count of item contents when hidden Resolves #85494
2021-07-21Rollup merge of #87342 - midgleyc:add-E0757-long, r=GuillaumeGomezGuillaume Gomez-0/+1
Add long explanation for E0757 Helps with #61137
2021-07-21Rollup merge of #87321 - midgleyc:add-E0722-long, r=GuillaumeGomezGuillaume Gomez-1/+2
Add long explanation for E0722 Helps with #61137
2021-07-21Rollup merge of #87311 - oli-obk:nll_suggestion_span, r=estebankGuillaume Gomez-8/+8
Get back the more precise suggestion spans of old regionck I noticed that when you turn on nll, the structured suggestion replaces a snippet instead of appending a snippet. It seems clearer to the user to only highlight the newly added characters instead of the entire `impl Trait` (and old regionck already does it this way). r? ``@estebank``
2021-07-21Rollup merge of #87273 - fee1-dead:impl-const-impl-bounds, r=oli-obkGuillaume Gomez-0/+15
Recognize bounds on impls as const bounds r? ```@oli-obk```
2021-07-21Rollup merge of #87230 - GuillaumeGomez:docblock-table-overflow, r=notriddleGuillaume Gomez-7/+18
Fix docblock <table> overflow Before: ![Screenshot from 2021-07-18 00-05-23](https://user-images.githubusercontent.com/3050060/126050272-ce08bc5f-74ff-4135-bc12-d708d87470cc.png) After: ![Screenshot from 2021-07-18 00-03-55](https://user-images.githubusercontent.com/3050060/126050273-42f41b4d-ad57-4a87-91de-18e63f8504ec.png) cc `@SergioBenitez` r? `@notriddle`
2021-07-21Rename force-warns to force-warnRyan Levick-32/+32
2021-07-21Add long explanation for E0757Chris Midgley-0/+1
2021-07-21Add PidFd type and seal traitsDominik Stolz-3/+3
Improve docs Split do_fork into two Make do_fork unsafe Add target attribute to create_pidfd field in Command Add method to get create_pidfd value
2021-07-21Add Linux-specific pidfd process extensionsAaron Hill-0/+27
Background: Over the last year, pidfd support was added to the Linux kernel. This allows interacting with other processes. In particular, this allows waiting on a child process with a timeout in a race-free way, bypassing all of the awful signal-handler tricks that are usually required. Pidfds can be obtained for a child process (as well as any other process) via the `pidfd_open` syscall. Unfortunately, this requires several conditions to hold in order to be race-free (i.e. the pid is not reused). Per `man pidfd_open`: ``` · the disposition of SIGCHLD has not been explicitly set to SIG_IGN (see sigaction(2)); · the SA_NOCLDWAIT flag was not specified while establishing a han‐ dler for SIGCHLD or while setting the disposition of that signal to SIG_DFL (see sigaction(2)); and · the zombie process was not reaped elsewhere in the program (e.g., either by an asynchronously executed signal handler or by wait(2) or similar in another thread). If any of these conditions does not hold, then the child process (along with a PID file descriptor that refers to it) should instead be created using clone(2) with the CLONE_PIDFD flag. ``` Sadly, these conditions are impossible to guarantee once any libraries are used. For example, C code runnng in a different thread could call `wait()`, which is impossible to detect from Rust code trying to open a pidfd. While pid reuse issues should (hopefully) be rare in practice, we can do better. By passing the `CLONE_PIDFD` flag to `clone()` or `clone3()`, we can obtain a pidfd for the child process in a guaranteed race-free manner. This PR: This PR adds Linux-specific process extension methods to allow obtaining pidfds for processes spawned via the standard `Command` API. Other than being made available to user code, the standard library does not make use of these pidfds in any way. In particular, the implementation of `Child::wait` is completely unchanged. Two Linux-specific helper methods are added: `CommandExt::create_pidfd` and `ChildExt::pidfd`. These methods are intended to serve as a building block for libraries to build higher-level abstractions - in particular, waiting on a process with a timeout. I've included a basic test, which verifies that pidfds are created iff the `create_pidfd` method is used. This test is somewhat special - it should always succeed on systems with the `clone3` system call available, and always fail on systems without `clone3` available. I'm not sure how to best ensure this programatically. This PR relies on the newer `clone3` system call to pass the `CLONE_FD`, rather than the older `clone` system call. `clone3` was added to Linux in the same release as pidfds, so this shouldn't unnecessarily limit the kernel versions that this code supports. Unresolved questions: * What should the name of the feature gate be for these newly added methods? * Should the `pidfd` method distinguish between an error occurring and `create_pidfd` not being called?
2021-07-20Add long explanation for E0722Chris Midgley-1/+2
2021-07-20Support HIR wf checking for function signaturesAaron Hill-44/+68
During function type-checking, we normalize any associated types in the function signature (argument types + return type), and then create WF obligations for each of the normalized types. The HIR wf code does not currently support this case, so any errors that we get have imprecise spans. This commit extends `ObligationCauseCode::WellFormed` to support recording a function parameter, allowing us to get the corresponding HIR type if an error occurs. Function typechecking is modified to pass this information during signature normalization and WF checking. The resulting code is fairly verbose, due to the fact that we can no longer normalize the entire signature with a single function call. As part of the refactoring, we now perform HIR-based WF checking for several other 'typed items' (statics, consts, and inherent impls). As a result, WF and projection errors in a function signature now have a precise span, which points directly at the responsible type. If a function signature is constructed via a macro, this will allow the error message to point at the code 'most responsible' for the error (e.g. a user-supplied macro argument).
2021-07-20Get back the more precise suggestion spans of old regionckOli Scherer-8/+8
2021-07-20Switch to store `Instance` directly within `VtblEntry`, fix `TraitVPtr` ↵Charles Lew-80/+48
representation.
2021-07-20Add internal attribute and tests.Charles Lew-0/+170
2021-07-20Auto merge of #87244 - jackh726:issue-71883, r=estebankbors-7/+150
Better diagnostics with mismatched types due to implicit static lifetime Fixes #78113 I think this is my first diagnostics PR...definitely happy to hear thoughts on the direction/implementation here. I was originally just trying to solve the error above, where the lifetime on a GAT was causing a cryptic "mismatched types" error. But as I was writing this, I realized that this (unintentionally) also applied to a different case: `wf-in-foreign-fn-decls-issue-80468.rs`. I'm not sure if this diagnostic should get a new error code, or even reuse an existing one. And, there might be some ways to make this even more generalized. Also, the error is a bit more lengthy and verbose than probably needed. So thoughts there are welcome too. This PR essentially ended up adding a new nice region error pass that triggers if a type doesn't match the self type of an impl which is selected because of a predicate because of an implicit static bound on that self type. r? `@estebank`
2021-07-20Allow combining -Cprofile-generate and -Cpanic=unwind when targetingMichael Woerister-61/+1
MSVC. The LLVM limitation that previously prevented this has been fixed in LLVM 9 which is older than the oldest LLVM version we currently support. See https://github.com/rust-lang/rust/issues/61002.
2021-07-20Auto merge of #87224 - RalfJung:miri-ptr-oob, r=oli-obkbors-10/+25
miri: better ptr-out-of-bounds errors For offsets larger than `isize::MAX`, display them as negative offsets. r? `@oli-obk`
2021-07-20Auto merge of #87141 - spastorino:remove_impl_trait_in_bindings, r=oli-obkbors-1609/+475
Remove impl trait in bindings Closes #86729 r? `@oli-obk`
2021-07-19Better errors when we don't have implicit statics in trait objectsjackh726-7/+102
2021-07-20Auto merge of #84959 - camsteffen:lint-suggest-group, r=estebankbors-2/+12
Suggest lint groups Fixes rust-lang/rust-clippy#6986
2021-07-19memorialize Anna Harren in the bastion of the turbofishMelody Horn-0/+3
2021-07-19Auto merge of #87284 - Aaron1011:remove-paren-special, r=petrochenkovbors-0/+19
Remove special case for `ExprKind::Paren` in `MutVisitor` The special case breaks several useful invariants (`ExpnId`s are globally unique, and never change). This special case was added back in 2016 in https://github.com/rust-lang/rust/pull/34355 r? `@petrochenkov`
2021-07-19Fix incorrect use of `#[repr(no_niche)]`Aaron Hill-8/+6
2021-07-19Warn on inert attributes used on bang macro invocationAaron Hill-0/+64
These attributes are currently discarded. This may change in the future (see #63221), but for now, placing inert attributes on a macro invocation does nothing, so we should warn users about it. Technically, it's possible for there to be attribute macro on the same macro invocation (or at a higher scope), which inspects the inert attribute. For example: ```rust #[look_for_inline_attr] #[inline] my_macro!() #[look_for_nested_inline] mod foo { #[inline] my_macro!() } ``` However, this would be a very strange thing to do. Anyone running into this can manually suppress the warning.
2021-07-19Remove special case for `ExprKind::Paren` in `MutVisitor`Aaron Hill-0/+19
The special case breaks several useful invariants (`ExpnId`s are globally unique, and never change). This special case was added back in 2016 in https://github.com/rust-lang/rust/pull/34355
2021-07-19Better diagnostics when mismatched types due to implict static lifetimejackh726-8/+56
2021-07-19Auto merge of #87153 - ↵bors-37/+41
michaelwoerister:debuginfo-names-dyn-trait-projection-bounds, r=wesleywiser [debuginfo] Emit associated type bindings in trait object type names. This PR updates debuginfo type name generation for trait objects to include associated type bindings and auto trait bounds -- so that, for example, the debuginfo type name of `&dyn Iterator<Item=Foo>` and `&dyn Iterator<Item=Bar>` don't both map to just `&dyn Iterator` anymore. The following table shows examples of debuginfo type names before and after the PR: | type | before | after | |------|---------|-------| | `&dyn Iterator<Item=u32>>` | `&dyn Iterator` | `&dyn Iterator<Item=u32>` | | `&(dyn Iterator<Item=u32>> + Sync)` | `&dyn Iterator` | `&(dyn Iterator<Item=u32> + Sync)` | | `&(dyn SomeTrait<bool, i8, Bar=u32>> + Send)` | `&dyn SomeTrait<bool, i8>` | `&(dyn SomeTrait<bool, i8, Bar=u32>> + Send)` | For targets that need C++-like type names, we use `assoc$<Item,u32>` instead of `Item=u32`: | type | before | after | |------|---------|-------| | `&dyn Iterator<Item=u32>>` | `ref$<dyn$<Iterator> >` | `ref$<dyn$<Iterator<assoc$<Item,u32> > > >` | | `&(dyn Iterator<Item=u32>> + Sync)` | `ref$<dyn$<Iterator> >` | `ref$<dyn$<Iterator<assoc$<Item,u32> >,Sync> >` | | `&(dyn SomeTrait<bool, i8, Bar=u32>> + Send)` | `ref$<dyn$<SomeTrait<bool, i8> > >` | `ref$<dyn$<SomeTrait<bool,i8,assoc$<Bar,u32> > >,Send> >` | The PR also adds self-profiling measurements for debuginfo type name generation (re. https://github.com/rust-lang/rust/issues/86431). It looks like the compiler spends up to 0.5% of its time in that task, so the potential for optimizing it via caching seems limited. However, the perf run also shows [the biggest regression](https://perf.rust-lang.org/detailed-query.html?commit=585e91c718b0b2c5319e1fffd0ff1e62aaf7ccc2&base_commit=b9197978a90be6f7570741eabe2da175fec75375&benchmark=tokio-webpush-simple-debug&run_name=incr-unchanged) in a test case that does not even invoke the code in question. This suggests that the length of the names we generate here can affect performance by influencing how much data the linker has to copy around. Fixes https://github.com/rust-lang/rust/issues/86134.