about summary refs log tree commit diff
path: root/src/test
AgeCommit message (Collapse)AuthorLines
2020-11-12Don't reuse bindings for `ref mut`Joshua Nelson-0/+8
Reusing bindings causes errors later in lowering: ``` error[E0596]: cannot borrow `vec` as mutable, as it is not declared as mutable --> /checkout/src/test/ui/async-await/argument-patterns.rs:12:20 | LL | async fn b(n: u32, ref mut vec: A) { | ^^^^^^^^^^^ | | | cannot borrow as mutable | help: consider changing this to be mutable: `mut vec` ```
2020-11-12Rollup merge of #78960 - ethanboxx:const-gen-test-default-error, r=lcnrGuillaume Gomez-0/+28
Test default values for const parameters. The last topic on #78433 I originally intended to place these tests in a single file, however, due to them being parser errors that are fatal, they must be in separate files to be detected. Thanks, ``@lcnr`` for mentoring me on this PR. r? ``@lcnr``
2020-11-12Rollup merge of #78916 - lcnr:const-generics-tests, r=varkorGuillaume Gomez-0/+1126
extend const generics test suite should implement most of #78433, especially all parts of [the hackmd](https://hackmd.io/WnFmN4MjRCqAjGmYfYcu2A?view) which I did not explicitly mention in that issue. r? ``@varkor``
2020-11-12Auto merge of #78782 - petrochenkov:nodoctok, r=Aaron1011bors-2/+2
Do not collect tokens for doc comments Doc comment is a single token and AST has all the information to re-create it precisely. Doc comments are also responsible for majority of calls to `collect_tokens` (with `num_calls == 1` and `num_calls == 0`, cc https://github.com/rust-lang/rust/pull/78736). (I also moved token collection into `fn parse_attribute` to deduplicate code a bit.) r? `@Aaron1011`
2020-11-11default_trait_paramEthan Brierley-0/+14
2020-11-11Add test `default_function_param`Ethan Brierley-0/+14
2020-11-11add error-in-impl-trait const generics testBastian Kauschke-0/+24
2020-11-11add rustdoc testBastian Kauschke-0/+148
2020-11-11Rollup merge of #78899 - tmiasko:inline-diverging, r=oli-obkJonas Schievink-0/+180
Support inlining diverging function calls The existing heuristic does penalize diverging calls to some degree, but since it never inlined them previously it might need some further modifications. Additionally introduce storage markers for all temporaries created by the inliner. The temporary introduced for destination rebrorrow, didn't use them previously.
2020-11-11Rollup merge of #78873 - tmiasko:inline-opts, r=oli-obkJonas Schievink-0/+75
Add flags customizing behaviour of MIR inlining * `-Zinline-mir-threshold` to change the default threshold. * `-Zinline-mir-hint-threshold` to change the threshold used by functions with inline hint. Having those as configurable flags makes it possible to experiment with with different inlining thresholds and substantially increase test coverage of MIR inlining when used with increased thresholds (for example, necessary to test #78844).
2020-11-11Rollup merge of #78832 - lcnr:const-evaluatable-unevaluated, r=oli-obkJonas Schievink-0/+61
look at assoc ct, check the type of nodes an example where types matter are function objects, see the added test which previously passed. Now does a shallow comparison of unevaluated constants. r? ```@oli-obk```
2020-11-10Rollup merge of #78912 - JulianKnodt:mcg_macro, r=lcnrJonas Schievink-0/+212
Add macro test for min-const-generics Adds a test which uses a macro inside a block for a const-expression, as per #78433 r? `@lcnr`
2020-11-10Rollup merge of #78908 - liketechnik:fix_macro_expand_src_link, r=jyn514Jonas Schievink-7/+4
(rustdoc) [src] link for types defined by macros shows invocation, not defintion Previously the [src] link on types defined by a macro pointed to the macro definition. This pr makes the Clean-Implementation for Spans aware of macro defined types, so that the link points to the invocation instead. I'm not totally sure if it's okay to add the 'macro awareness' in the Clean-Implementation, because it erases that knowledge for all following code. Maybe it would be more sensible to add the check only for the link generation at https://github.com/rust-lang/rust/blob/25f6938da459a57b43bdf16ed6bdad3225b2a3ce/src/librustdoc/html/render/mod.rs#L1619 Closes #39726.
2020-11-10Rollup merge of #78898 - SNCPlay42:issue-78892, r=Mark-SimulacrumJonas Schievink-0/+14
add regression test for #78892 closes #78892, which was already fixed on nightly.
2020-11-10Rollup merge of #78897 - hyd-dev:alloc-error-hook-newline, r=m-ou-seJonas Schievink-1/+1
Add missing newline to error message of the default OOM hook Currently the default OOM hook in libstd does not end the error message with a newline: ``` memory allocation of 4 bytes failedtimeout: the monitored command dumped core /playground/tools/entrypoint.sh: line 11: 7 Aborted timeout --signal=KILL ${timeout} "$`@"` ``` https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=030d8223eb57dfe47ef157709aa26542 This is because the `fmt::Arguments` passed to `dumb_print()` does not end with a newline. All other calls to `dumb_print()` in libstd pass a `\n`-ended `fmt::Arguments` to `dumb_print()`. For example: https://github.com/rust-lang/rust/blob/25f6938da459a57b43bdf16ed6bdad3225b2a3ce/library/std/src/sys_common/util.rs#L18 I think the `\n` was forgotten in #51264. This PR appends `\n` to the error string. ~~Note that I didn't add a test, because I didn't find tests for functions in ` library/std/src/alloc.rs` or a test that is similar to the test of this change would be.~~ *Edit: CI told me there is an existing test. Sorry.*
2020-11-10Rollup merge of #78669 - sasurau4:test/check-pass-consts, r=jyn514Jonas Schievink-4/+4
Use check-pass instead of build-pass in some consts ui test suits Helps with #62277 Changed tests modified by https://github.com/rust-lang/rust/pull/57175 because of the stabilization `#![feature(const_let)]`. They should be compile-fail because the feature gate checking disallow the feature before stabilization. So the feature gate checking have nothing to do with codegen according to https://rustc-dev-guide.rust-lang.org/feature-gate-ck.html.
2020-11-10Rollup merge of #78574 - sasurau4:test/check-pass-regions, r=jyn514Jonas Schievink-18/+18
Use check-pass instead of build-pass in regions ui test suite ## Overview Helps with #62277 Region inference have nothing to do with codegen because they are erased before codegen. Ref: https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/Is.20region.20inference.20.20nothing.20to.20do.20with.20codegen.20process.3F/near/215956759
2020-11-10Rollup merge of #76765 - guswynn:async_return, r=tmandryJonas Schievink-100/+218
Make it more clear what an about async fn's returns when referring to what it returns see #76547 This is *likely* not the ONLY place that this happens to be unclear, but we can move this fn to rustc_middle or something like that and reuse it if need be, to apply it to more diagnostics One outstanding question I have is, if the fn returns (), should I make the message more clear (what about `fn f()` vs `fn f() -> ()`, can you tell those apart in the hir?) R? `@tmandry` `@rustbot` modify labels +A-diagnostics +T-compiler
2020-11-10use check-pass instead of build-pass in consts ui test suitsDaiki Ihara-4/+4
2020-11-10add cross crate testBastian Kauschke-0/+47
2020-11-10add test for where clauses mentioning const paramsBastian Kauschke-0/+35
2020-11-10const param in asyncBastian Kauschke-0/+35
2020-11-10try referencing outer paramsBastian Kauschke-0/+247
2020-11-10exhaustively enumerate all values of a const paramBastian Kauschke-0/+310
2020-11-10add associated type bounds testBastian Kauschke-0/+71
2020-11-10add macro_rules test regarding bracesBastian Kauschke-0/+149
2020-11-10Add macro test for min-const-genericskadmin-0/+212
2020-11-10add generic param mismatch testBastian Kauschke-0/+38
2020-11-10const param macro testBastian Kauschke-0/+22
2020-11-09Update src/test/ui/issues/issue-76547.rsTyler Mandry-1/+1
Co-authored-by: Camelid <camelidcamel@gmail.com>
2020-11-09add nll compare mode stderr fileGus Wynn-0/+20
2020-11-10(rustdoc) [src] link for types defined by macros shows invocationFlorian Warzecha-7/+4
Previously the [src] link on types defined by a macro pointed to the macro definition. This commit makes the Clean-Implementation for Spans aware of macro defined types, so that the link points to the invocation instead.
2020-11-10Add flags customizing behaviour of MIR inliningTomasz Miąsko-0/+75
* `-Zinline-mir-threshold` to change the default threshold. * `-Zinline-mir-hint-threshold` to change the threshold used by functions with inline hint.
2020-11-09Rollup merge of #78710 - petrochenkov:macvisit, r=davidtwcoDylan DPC-1/+1
rustc_ast: Do not panic by default when visiting macro calls Panicking by default made sense when we didn't have HIR or MIR and everything worked on AST, but now all AST visitors run early and majority of them have to deal with macro calls, often by ignoring them. The second commit renames `visit_mac` to `visit_mac_call`, the corresponding structures were renamed earlier in https://github.com/rust-lang/rust/pull/69589.
2020-11-09Rollup merge of #78580 - tmiasko:inline-loop, r=oli-obkDylan DPC-0/+134
inliner: Break inlining cycles Keep track of all instances inlined so far. When examining a new call sites from an inlined body, skip those where callee had been inlined already to avoid potential inlining cycles. Fixes #78573.
2020-11-09Rollup merge of #78502 - matthewjasper:chalkup, r=nikomatsakisDylan DPC-0/+33
Update Chalk to 0.36.0 This PR updates Chalk and fixes a number of bugs in the chalk integration code. cc `@rust-lang/wg-traits` r? `@nikomatsakis`
2020-11-09Rollup merge of #76468 - SNCPlay42:lifetime-names, r=Mark-SimulacrumDylan DPC-3/+121
Improve lifetime name annotations for closures & async functions * Don't refer to async functions as "generators" in error output * Where possible, emit annotations pointing exactly at the `&` in the return type of closures (when they have explicit return types) and async functions, like we do for arguments. Addresses #74072, but I wouldn't call that *closed* until annotations are identical for async and non-async functions. * Emit a better annotation when the lifetime doesn't appear in the full name type, which currently happens for opaque types like `impl Future`. Addresses #74497, but further improves could probably be made (why *doesn't* it appear in the type as `impl Future + '1`?) This is included in the same PR because the changes to `give_name_if_anonymous_region_appears_in_output` would introduce ICE otherwise (it would return `None` in cases where it didn't previously, which then gets `unwrap`ped)
2020-11-10Add missing newline to error message of the default OOM hookhyd-dev-1/+1
2020-11-09use RegionNameHighlight for async fn and closure returnsSNCPlay42-5/+55
2020-11-09add regression test for #78892SNCPlay42-0/+14
2020-11-09Add `#[cfg(panic = "...")]`David Hewitt-10/+82
2020-11-09Rollup merge of #78748 - fanzier:tuple-assignment, r=petrochenkovDylan DPC-55/+214
Implement destructuring assignment for tuples This is the first step towards implementing destructuring assignment (RFC: https://github.com/rust-lang/rfcs/pull/2909, tracking issue: #71126). This PR is the first part of #71156, which was split up to allow for easier review. Quick summary: This change allows destructuring the LHS of an assignment if it's a (possibly nested) tuple. It is implemented via a desugaring (AST -> HIR lowering) as follows: ```rust (a,b) = (1,2) ``` ... becomes ... ```rust { let (lhs0,lhs1) = (1,2); a = lhs0; b = lhs1; } ``` Thanks to `@varkor` who helped with the implementation, particularly around default binding modes. r? `@petrochenkov`
2020-11-09Rollup merge of #78674 - tmiasko:inline-substs-for-mir-body, r=oli-obkDylan DPC-0/+91
inliner: Use substs_for_mir_body Changes from 68965 extended the kind of instances that are being inlined. For some of those, the `instance_mir` returns a MIR body that is already expressed in terms of the types found in substitution array, and doesn't need further substitution. Use `substs_for_mir_body` to take that into account. Resolves #78529. Resolves #78560.
2020-11-09Support inlining diverging function callsTomasz Miąsko-0/+180
Additionally introduce storage markers for all temporaries created by the inliner. The temporary introduced for destination rebrorrow, didn't use them previously.
2020-11-09inliner: Break inlining cyclesTomasz Miąsko-0/+134
When examining candidates for inlining, reject those that are determined to be recursive either because of self-recursive calls or calls to any instances already inlined.
2020-11-09Do not collect tokens for doc commentsVadim Petrochenkov-2/+2
2020-11-08Auto merge of #78712 - petrochenkov:visitok, r=Aaron1011bors-0/+121
rustc_ast: Visit tokens stored in AST nodes in mutable visitor After #77271 token visiting is enabled only for one visitor in `rustc_expand\src\mbe\transcribe.rs` which applies hygiene marks to tokens produced by declarative macros (`macro_rules` or `macro`), so this change doesn't affect anything else. When a macro has some interpolated token from an outer macro in its output ```rust macro inner() { $interpolated } ``` we can use the usual interpretation of interpolated tokens in token-based model - a None-delimited group - to write this macro in an equivalent form ```rust macro inner() { ⟪ a b c d ⟫ } ``` When we are expanding the macro `inner` we need to apply hygiene marks to all tokens produced by it, including the tokens inside the group. Before this PR we did this by visiting the AST piece inside the interpolated token and applying marks to all spans in it. I'm not sure this is 100% correct (ideally we should apply the marks to tokens and then re-parse the AST from tokens), but it's a very good approximation at least. We didn't however apply the marks to actual tokens stored in the nonterminal, so if we used the nonterminal as a token rather than as an AST piece (e.g. passed it to a proc macro), then we got hygiene bugs. This PR applies the marks to tokens in addition to the AST pieces thus fixing the issue. r? `@Aaron1011`
2020-11-08Auto merge of #78874 - m-ou-se:rollup-3jp1ijj, r=m-ou-sebors-24/+29
Rollup of 19 pull requests Successful merges: - #76097 (Stabilize hint::spin_loop) - #76227 (Stabilize `Poll::is_ready` and `is_pending` as const) - #78065 (make concurrency helper more pleasant to read) - #78570 (Remove FIXME comment in print_type_sizes ui test suite) - #78572 (Use SOCK_CLOEXEC and accept4() on more platforms.) - #78658 (Add a tool to run `x.py` from any subdirectory) - #78706 (Fix run-make tests running when LLVM is disabled) - #78728 (Constantify `UnsafeCell::into_inner` and related) - #78775 (Bump Rustfmt and RLS) - #78788 (Correct unsigned equivalent of isize to be usize) - #78811 (Make some std::io functions `const`) - #78828 (use single char patterns for split() (clippy::single_char_pattern)) - #78841 (Small cleanup in `TypeFoldable` derive macro) - #78842 (Honor the rustfmt setting in config.toml) - #78843 (Less verbose debug logging from inlining integrator) - #78852 (Convert a bunch of intra-doc links) - #78860 (rustc_resolve: Use `#![feature(format_args_capture)]`) - #78861 (typo and formatting) - #78865 (Don't fire `CONST_ITEM_MUTATION` lint when borrowing a deref) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2020-11-08Rollup merge of #78865 - Aaron1011:fix/const-item-mut-reborrow, r=varkorMara Bos-12/+17
Don't fire `CONST_ITEM_MUTATION` lint when borrowing a deref Fixes #78819 This extends the check for dereferences added in PR #77324 to cover mutable borrows, as well as direct writes. If we're operating on a dereference of a `const` item, we shouldn't be firing the lint.
2020-11-08Rollup merge of #78570 - sasurau4:test/check-pass-print-type-size, r=jyn514Mara Bos-12/+12
Remove FIXME comment in print_type_sizes ui test suite ## Overview Helps with #62277 > The type sizes are likely only printed when the actual layout is computed. For generic types, this only happens during codegen. ref: https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/Codegen.20process.20question/near/215836807 Some tests like `multiple_types.rs` are passed even if using `check-pass`. But tests should be agnostic to when the actual layout is computed. The `build-pass` is intentionally used for them. I remove FIXME comments.