about summary refs log tree commit diff
path: root/src/test/ui
AgeCommit message (Collapse)AuthorLines
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/+954
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-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 #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-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 #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-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.
2020-11-08Auto merge of #78410 - lcnr:revert75443, r=nikomatsakisbors-27/+0
revert #75443, update mir validator This PR reverts rust-lang#75443 to fix rust-lang#75992 and instead uses rust-lang#75419 to fix rust-lang#75313. Adapts rust-lang#75419 to correctly deal with unevaluated constants as otherwise some `feature(const_evaluatable_checked)` tests would ICE. Note that rust-lang#72793 was also fixed by rust-lang#75443, but as that issue only concerns `feature(type_alias_impl_trait)` I deleted that test case for now and would reopen that issue. rust-lang#75443 may have also allowed some other code to now successfully compile which would make this revert a breaking change after 2 stable versions, but I hope that this is a purely theoretical concern. See https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/generator.20upvars/near/214617274 for more reasoning about this. r? `@nikomatsakis` `@eddyb` `@RalfJung`
2020-11-07Use a semicolon instead of a dash in lint noteAaron Hill-4/+4
2020-11-07Don't fire `CONST_ITEM_MUTATION` lint when borrowing a derefAaron Hill-8/+13
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-07Auto merge of #78784 - Mark-Simulacrum:revert-77421, r=petrochenkovbors-24/+5
Revert "Revert "resolve: Avoid "self-confirming" import resolutions in one more case"" Specifically, this reverts commit b20bce8ce54ea9d47c2e3eb0b17cbb6baf916ae2 from #77421 to fix #77586. The lang team has decided that for the time being we want to avoid the breakage here (perhaps for a future edition; though almost certainly not the upcoming one), though a future PR may want to add a lint around this case (and perhaps others) which are unlikely to be readable code. r? `@petrochenkov` to confirm this is the right way to fix #77586.
2020-11-07Implement destructuring assignment for tuplesFabian Zaiser-55/+214
Co-authored-by: varkor <github@varkor.com>
2020-11-07remove FIXME comment of #62277 in print_type_sizez ui testsDaiki Ihara-12/+12
2020-11-07look at assoc ct, check the type of nodesBastian Kauschke-0/+61
2020-11-06Revert "Revert "resolve: Avoid "self-confirming" import resolutions in one ↵Mark Rousskov-24/+5
more case"" This reverts commit b20bce8ce54ea9d47c2e3eb0b17cbb6baf916ae2. It retains the test added in that commit as a check-pass test, intended to prevent future (unintentional) regressions.
2020-11-07Rollup merge of #78798 - ankushduacodes:fixing-typo, r=jonas-schievinkYuki Okushi-4/+4
Fixing Spelling Typos Fixing #78787
2020-11-07Rollup merge of #78167 - Nadrieril:fix-76836_, r=varkorYuki Okushi-5/+18
Fix unreachable sub-branch detection in or-patterns The previous implementation was too eager to avoid unnecessary "unreachable pattern" warnings. I feel more confident about this implementation than I felt about the previous one. Fixes https://github.com/rust-lang/rust/issues/76836. ``@rustbot`` modify labels: +A-exhaustiveness-checking
2020-11-06Fixing Spelling Typosankushduacodes-4/+4
2020-11-05Emit lints in the order in which they occur in the file.Nadrieril-4/+4