about summary refs log tree commit diff
path: root/src/test/ui
AgeCommit message (Collapse)AuthorLines
2021-07-05Auto merge of #86282 - camelid:macro_rules-matchers, r=jyn514bors-4/+4
Pretty-print macro matchers instead of using source code Fixes #86208.
2021-07-05Rollup merge of #86859 - JohnTitor:test-69323, r=jackh726Yuki Okushi-0/+30
Add a regression test for issue-69323 Closes #69323 r? `@jackh726`
2021-07-04Auto merge of #86866 - nikomatsakis:issue-84841, r=oli-obkbors-0/+78
Hack: Ignore inference variables in certain queries Fixes #84841 Fixes #86753 Some queries are not built to accept types with inference variables, which can lead to ICEs. These queries probably ought to be converted to canonical form, but as a quick workaround, we can return conservative results in the case that inference variables are found. We should file a follow-up issue (and update the FIXMEs...) to do the proper refactoring. cc `@arora-aman` r? `@oli-obk`
2021-07-05Add a regression test for issue-69323Yuki Okushi-0/+30
2021-07-04be conservative in has_significant_dropNiko Matsakis-0/+34
2021-07-04allow inference vars in type_implements_traitNiko Matsakis-1/+35
2021-07-04Auto merge of #86255 - Smittyvb:mir-alloc-oom, r=RalfJung,oli-obkbors-0/+33
Support allocation failures when interpreting MIR This closes #79601 by handling the case where memory allocation fails during MIR interpretation, and translates that failure into an `InterpError`. The error message is "tried to allocate more memory than available to compiler" to make it clear that the memory shortage is happening at compile-time by the compiler itself, and that it is not a runtime issue. Now that memory allocation can fail, it would be neat if Miri could simulate low-memory devices to make it easy to see how much memory a Rust program needs. Note that this breaks Miri because it assumes that allocation can never fail.
2021-07-04Auto merge of #86833 - crlf0710:remove-std-raw-mod, r=SimonSapinbors-27/+15
Remove the deprecated `core::raw` and `std::raw` module. A few months has passed since #84207. I think now it's time for the final removal. Closes #27751. r? `@m-ou-se`
2021-07-03rustc_ast_pretty: Don't print space after `$`Noah Lev-4/+4
For example, this code: $arg:expr used to be pretty-printed as: $ arg : expr but is now pretty-printed as: $arg : expr
2021-07-03Auto merge of #85090 - Aaron1011:type-outlives-global, r=matthewjasper,jackh726bors-15/+15
Return `EvaluatedToOk` when type in outlives predicate is global A global type doesn't reference any local regions or types, so it's guaranteed to outlive any region.
2021-07-03add test caseNiko Matsakis-0/+10
2021-07-03Auto merge of #86571 - fee1-dead:const-trait-impl-fix, r=jackh726bors-0/+45
deny using default function in impl const Trait Fixes #79450. I don't know if my implementation is correct: - The check is in `rustc_passes::check_const`, should I put it somewhere else instead? - Is my approach (to checking the impl) optimal? It works for the current tests, but it might have some issues or there might be a better way of doing this.
2021-07-03Remove the deprecated `core::raw` and `std::raw` module.Charles Lew-27/+15
2021-07-03Auto merge of #86795 - JohnTitor:fix-bind, r=jackh726bors-0/+142
Fix const-generics ICE related to binding Fixes #83765, fixes #85848 r? `@jackh726` as you're familiar with `Binding`. I'd like to get some views if the current approach is right path.
2021-07-03Rollup merge of #86813 - JohnTitor:unused-doc-comments-help, r=jackh726Yuki Okushi-0/+106
Add a help message to `unused_doc_comments` lint Fixes #83492 This adds a help message to suggest a plain comment like the E0658 error. I've yet to come up with the best message about the doc attribute but the current shouldn't harm anything. I was thinking of recovering in the `doc_comment_between_if_else` case, but I came to the conclusion that it unlikely happened and was an overkill.
2021-07-03Rollup merge of #86796 - JohnTitor:test-70703, r=jonas-schievinkYuki Okushi-0/+26
Add a regression test for issue-70703 Closes #70703
2021-07-03Fix const-generics ICE related to bindingYuki Okushi-0/+142
2021-07-03Add a help message to `unused_doc_comments` lintYuki Okushi-0/+106
2021-07-02Auto merge of #85746 - m-ou-se:io-error-other, r=joshtriplettbors-1/+3
Redefine `ErrorKind::Other` and stop using it in std. This implements the idea I shared yesterday in the libs meeting when we were discussing how to handle adding new `ErrorKind`s to the standard library: This redefines `Other` to be for *user defined errors only*, and changes all uses of `Other` in the standard library to a `#[doc(hidden)]` and permanently `#[unstable]` `ErrorKind` that users can not match on. This ensures that adding `ErrorKind`s at a later point in time is not a breaking change, since the user couldn't match on these errors anyway. This way, we use the `#[non_exhaustive]` property of the enum in a more effective way. Open questions: - How do we check this change doesn't cause too much breakage? Will a crate run help and be enough? - How do we ensure we don't accidentally start using `Other` again in the standard library? We don't have a `pub(not crate)` or `#[deprecated(in this crate only)]`. cc https://github.com/rust-lang/rust/pull/79965 cc `@rust-lang/libs` `@ijackson` r? `@dtolnay`
2021-07-02Add a regression test for issue-70703Yuki Okushi-0/+26
2021-07-02Rollup merge of #86775 - fee1-dead:impl-const-test, r=jonas-schievinkYuki Okushi-22/+95
Test for const trait impls behind feature gates - Make the previous cross-crate tests use revisions instead of being separate files - Added test for gating const trait impls. cc ``@oli-obk`` ``@jonas-schievink``
2021-07-02Rollup merge of #86148 - FabianWolff:issue-85855, r=varkorYuki Okushi-0/+40
Check the number of generic lifetime and const parameters of intrinsics This pull request fixes #85855. The current code for type checking intrinsics only checks the number of generic _type_ parameters, but does not check for an incorrect number of lifetime or const parameters, which can cause problems later on, such as the ICE in #85855, where the code thought that it was looking at a type parameter but found a lifetime parameter: ``` error: internal compiler error: compiler/rustc_middle/src/ty/generics.rs:188:18: expected type parameter, but found another generic parameter ``` The changes in this PR add checks for the number of lifetime and const parameters, expand the scope of `E0094` to also apply to these cases, and improve the error message by properly pluralizing the number of expected generic parameters.
2021-07-01Minor adjustments and refactoringFabian Wolff-11/+4
2021-07-01Test for const trait impls behind feature gatesDeadbeef-0/+89
2021-07-01Use revisions for cross-crate testDeadbeef-22/+6
2021-07-01Auto merge of #86774 - GuillaumeGomez:rollup-rkcgvph, r=GuillaumeGomezbors-0/+29
Rollup of 6 pull requests Successful merges: - #86558 (Add suggestions for "undefined reference" link errors) - #86616 (rustc_span: Explicitly handle crates that differ from package names) - #86652 (Add support for leaf function frame pointer elimination) - #86666 (Fix misleading "impl Trait" error) - #86762 (mailmap: Add my work email address) - #86773 (Enable the tests developed with #86594) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2021-07-01Rollup merge of #86666 - ptrojahn:compare_kinds, r=petrochenkovGuillaume Gomez-0/+29
Fix misleading "impl Trait" error The kinds can't be compared directly, as types with references are treated as different because the lifetimes aren't bound in ty, but are in expected. Closes #84160
2021-07-01Auto merge of #86190 - asquared31415:extern-main-86110-fix, r=varkorbors-0/+15
Fix ICE when `main` is declared in an `extern` block Changes in #84401 to implement `imported_main` changed how the crate entry point is found, and a declared `main` in an `extern` block was detected erroneously. This was causing the ICE described in #86110. This PR adds a check for this case and emits an error instead. Previously a `main` declaration in an `extern` block was not detected as an entry point at all, so emitting an error shouldn't break anything that worked previously. In 1.52.1 stable this is demonstrated, with a `` `main` function not found`` error. Fixes #86110
2021-07-01Rollup merge of #86750 - fee1-dead:impl-const-test, r=jonas-schievinkYuki Okushi-0/+84
Test cross-crate usage of `feature(const_trait_impl)` This PR does two things: - Fixes metadata not encoded properly for functions in const trait impls. - Adds tests for using const trait impls cross-crate with the feature gate on the user crate either enabled or disabled. AFAIK, this means we can now constify some trait impls in the standard library 🎉 See #67792 for the tracking issue, cc `@oli-obk`
2021-07-01Rollup merge of #86728 - FabianWolff:issue-86721, r=LeSeulArtichautYuki Okushi-2/+80
Check node kind to avoid ICE in `check_expr_return()` This PR fixes #86721. The ICE described there is apparently due to a misunderstanding: https://github.com/rust-lang/rust/blob/e98897e5dc9898707bf4331c43b2e76ab7e282fe/compiler/rustc_typeck/src/check/expr.rs#L684-L685 Intuitively, one would think that calling `expect_item()` after `get_parent_item()` should succeed, but as it turns out, `get_parent_item()` can also return foreign, trait, and impl items as well as crates, whereas `expect_item()` specifically expects a `Node::Item`. I have therefore added an extra check to prevent this ICE.
2021-07-01Rollup merge of #86680 - camsteffen:dbg-opt-error, r=petrochenkovYuki Okushi-0/+6
Improve error for missing -Z with debugging option Before: ```text ❯ rustc --unpretty=hir error: Unrecognized option: 'unpretty' ``` After: ```text ❯ rustc --unpretty=hir error: Unrecognized option: 'unpretty'. Did you mean `-Z unpretty`? ```
2021-07-01Rollup merge of #85520 - FabianWolff:issue-85475, r=jackh726Yuki Okushi-0/+5
Fix typo and improve documentation for E0632 Edit: After https://github.com/rust-lang/rust/pull/85520#issuecomment-870095546, this PR has been boiled down to just an extended description for `E0632` and a fixed typo.
2021-06-30Add suggestion for missing compile flag groupCameron Steffen-0/+6
2021-06-30Add tests for cross-crate usage of `impl const`Deadbeef-0/+84
2021-06-30Emit explanatory note for functions in trait and impl items as wellFabian Wolff-4/+65
2021-06-30Auto merge of #86689 - rylev:future-compat-lint-group, r=nikomatsakisbors-9/+30
Only include lint in future_incompatible lint group if not an edition lint A follow up to #86330 - this only includes lints annotated with `FutureIncompatibleInfo` in the `future_incompatibile` lint group if the future compatibility is not tied to an edition. We probably want to rename `FutureIncompatibleInfo` to something else since this type is now used to indicate future breakages of all kinds (even those that happen in editions). I'd prefer to do that in a separate PR though. r? `@nikomatsakis`
2021-06-29Return `EvaluatedToOk` when type in outlives predicate is globalAaron Hill-15/+15
A global type doesn't reference any local regions or types, so it's guaranteed to outlive any region.
2021-06-29Test memory exhaustion in const evaluationSmitty-1/+13
2021-06-29Make memory exhaustion a hard errorSmitty-15/+5
2021-06-29Support allocation failures when interperting MIRSmitty-0/+31
Note that this breaks Miri. Closes #79601
2021-06-30Move some UI tests to more suitable subdirsYuki Okushi-7/+9
2021-06-29Check node kind to avoid ICE in `check_expr_return()`Fabian Wolff-0/+17
2021-06-29Auto merge of #86475 - crlf0710:miri_vtable_refactor, r=bjorn3bors-5/+5
Change vtable memory representation to use tcx allocated allocations. This fixes https://github.com/rust-lang/rust/issues/86324. However i suspect there's more to change before it can land. r? `@bjorn3` cc `@rust-lang/miri`
2021-06-29Auto merge of #86009 - cjgillot:fwarn, r=davidtwcobors-9/+9
Make ForceWarn a lint level. Follow-up to #85788 cc `@rylev`
2021-06-29Bless UI testsFabian Wolff-0/+5
2021-06-29Auto merge of #86704 - JohnTitor:rollup-lnrxo4i, r=JohnTitorbors-1395/+720
Rollup of 7 pull requests Successful merges: - #86059 (Add new tool to check HTML) - #86529 (Add support for OpenSSL 3.0.0) - #86657 (Fix `future_prelude_collision` false positive) - #86661 (Editon 2021 enables precise capture) - #86671 (Turn non_fmt_panic into a future_incompatible edition lint.) - #86673 (Make disjoint_capture_migration an edition lint.) - #86678 (Fix garbled suggestion for missing lifetime specifier) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2021-06-29Rollup merge of #86678 - FabianWolff:issue-86667, r=jackh726Yuki Okushi-0/+43
Fix garbled suggestion for missing lifetime specifier This PR fixes #86667. The suggestion code currently checks whether there is a generic parameter that is not a synthetic `impl Trait` parameter and, if so, suggests to insert a new lifetime `'a` before that generic parameter. However, it does not make sense to insert `'a` in front of an elided lifetime parameter, since these are synthetic as well, which leads to the garbled suggestion in #86667.
2021-06-29Rollup merge of #86673 - m-ou-se:disjoint-capture-edition-lint, r=nikomatsakisYuki Okushi-104/+186
Make disjoint_capture_migration an edition lint. This turns the disjoint capture lint into an edition lint, and changes all the wording to refer to the edition. This includes the same first commit as https://github.com/rust-lang/rust/pull/86671. See https://github.com/rust-lang/rust/pull/86671. Fixes most of https://github.com/rust-lang/project-rfc-2229/issues/43#issuecomment-869188197
2021-06-29Rollup merge of #86671 - m-ou-se:non-fmt-panic-future-incompatible, ↵Yuki Okushi-12/+24
r=nikomatsakis Turn non_fmt_panic into a future_incompatible edition lint. This turns the `non_fmt_panic` lint into a future_incompatible edition lint, so it becomes part of the `rust_2021_compatibility` group. See https://github.com/rust-lang/rust/issues/85894. This lint produces both warnings about semantical changes (e.g. `panic!("{{")`) and things that will become hard errors (e.g. `panic!("{")`). So I added a `explain_reason: false` that supresses the default "this will become a hard error" or "the semantics will change" message, and instead added a note depending on the situation. (cc `@rylev)` r? `@nikomatsakis`
2021-06-29Rollup merge of #86661 - sexxi-goose:edition_fix, r=nikomatsakisYuki Okushi-1279/+451
Editon 2021 enables precise capture r? `@nikomatsakis`