about summary refs log tree commit diff
path: root/src/test
AgeCommit message (Collapse)AuthorLines
2021-07-03Rollup merge of #84029 - drahnr:master, r=petrochenkovYuki Okushi-0/+31
add `track_path::path` fn for usage in `proc_macro`s Adds a way to declare a dependency on external files without including them, to either re-trigger the build of a file as well as covering the use case of including dependencies within the `rustc` invocation, such that tools like `sccache`/`cachepot` are able to handle references to external files which are not included. Ref #73921
2021-07-02Auto merge of #86806 - GuillaumeGomez:rollup-pr5r37w, r=GuillaumeGomezbors-20/+12
Rollup of 5 pull requests Successful merges: - #85749 (Revert "Don't load all extern crates unconditionally") - #86714 (Add linked list cursor end methods) - #86737 (Document rustfmt on nightly-rustc) - #86776 (Skip layout query when computing integer type size during mangling) - #86797 (Stabilize `Bound::cloned()`) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2021-07-02Rollup merge of #85749 - GuillaumeGomez:revert-smart-extern-crate-load, r=jyn514Guillaume Gomez-20/+12
Revert "Don't load all extern crates unconditionally" Fixes https://github.com/rust-lang/rust/issues/84738. This reverts https://github.com/rust-lang/rust/pull/83738. For the "smart" load of external crates, we need to be able to access their items in order to check their doc comments, which seems, if not impossible, quite complicated using only the AST. For some context, I first tried to extend the `IntraLinkCrateLoader` visitor by adding `visit_foreign_item`. Unfortunately, it never enters into this call, so definitely not the right place... I then added `visit_use_tree` to then check all the imports outside with something like this: ```rust let mut loader = crate::passes::collect_intra_doc_links::IntraLinkCrateLoader::new(resolver); ast::visit::walk_crate(&mut loader, krate); let mut items = Vec::new(); for import in &loader.imports_to_check { if let Some(item) = krate.items.iter().find(|i| i.id == *import) { items.push(item); } } for item in items { ast::visit::walk_item(&mut item); for attr in &item.attrs { loader.check_attribute(attr); } } ``` This was, of course, a failure. We find the items without problems, but we still can't go into the external crate to check its items' attributes. Finally, `@jyn514` suggested to look into the [`CrateLoader`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_metadata/creader/struct.CrateLoader.html), but it only seems to provide metadata (I went through [`CStore`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_metadata/creader/struct.CStore.html) and [`CrateMetadata`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_metadata/rmeta/decoder/struct.CrateMetadata.html)). I think we are too limited here (with AST only) to be able to determine the crates we actually need to import, but it's very likely that I missed something. Maybe `@petrochenkov` or `@Aaron1011` have an idea? So until we find a way to make it work completely, we need to revert it to fix the ICE. Once merged, we'll need to re-open #68427. r? `@jyn514`
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 track_path::path fn for proc-macro usageBernhard Schuster-0/+31
Ref #73921
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 #86659 - notriddle:notriddle/generics-rustdoc, r=GuillaumeGomezYuki Okushi-0/+103
fix(rustdoc): generics search This commit adds a test case for generics, re-adds generics data to the search index, and tweaks function indexing to use less space in JSON. This partially reverts commit 14ca89446c076bcf484d3d05bd991a4b7985a409.
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-01Revert "Don't load all extern crates unconditionally"Guillaume Gomez-20/+12
2021-07-01Minor adjustments and refactoringFabian Wolff-11/+4
2021-07-01fix(rustdoc): generics searchMichael Howell-0/+103
This commit adds a test case for generics, re-adds generics data to the search index, and tweaks function indexing to use less space in JSON. This reverts commit 14ca89446c076bcf484d3d05bd991a4b7985a409.
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-6/+70
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 #86773 - dns2utf8:rustdoc_enable_near_tests, r=GuillaumeGomezGuillaume Gomez-6/+6
Enable the tests developed with #86594 This PR requires `browser-ui-test@0.4.1`. Can we centralise the version number somehow and maybe automatically install it when tests are run? r? `@GuillaumeGomez`
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-01Rollup merge of #86652 - nagisa:nagisa/non-leaf-fp, r=petrochenkovGuillaume Gomez-0/+35
Add support for leaf function frame pointer elimination This PR adds ability for the target specifications to specify frame pointer emission type that's not just “always” or “whatever cg decides”. In particular there's a new mode that allows omission of the frame pointer for leaf functions (those that don't call any other functions). We then set this new mode for Aarch64-based Apple targets. Fixes #86196
2021-07-01Enable the tests developed with #86594Stefan Schindler-6/+6
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 #86746 - GuillaumeGomez:query-type-filter, r=notriddleYuki Okushi-0/+12
Fix rustdoc query type filter I realized while reviewing #86659 that the type filter was broken on search so I'd prefer it to get merged before merging #86659. r? `@notriddle`
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 support for leaf fn frame pointer eliminationSimonas Kazlauskas-0/+35
This PR adds ability for the target specifications to specify frame pointer emission type that's not just “always” or “whatever cg decides”. In particular there's a new mode that allows omission of the frame pointer for leaf functions (those that don't call any other functions). We then set this new mode for Aarch64-based Apple targets. Fixes #86196
2021-06-30Add tests for cross-crate usage of `impl const`Deadbeef-0/+84
2021-06-30Add test to ensure that the typed queries are not including other typesGuillaume Gomez-0/+12
2021-06-30Emit explanatory note for functions in trait and impl items as wellFabian Wolff-4/+65
2021-06-30Auto merge of #86650 - GuillaumeGomez:fix-boldness, r=Nemo157bors-2/+15
Fix boldness (put it back where needed) I realized that I created a GUI test that wasn't run because it had ".rs" extension instead of ".goml" so I moved its content into `font-weight.goml` (since it was checking font weight).
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-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 #86594 - dns2utf8:move_label_to_symbol, r=GuillaumeGomezbors-10/+55
rustdoc: Move label to symbol Implements #86578 depends on #85651 r? `@GuillaumeGomez` # Screenshot of mobile ![grafik](https://user-images.githubusercontent.com/739070/123267064-1be07f80-d4ec-11eb-8bdb-0b18a41908dc.png) # Screenshot on desktop ![grafik](https://user-images.githubusercontent.com/739070/123267204-46323d00-d4ec-11eb-97ca-2750421352f4.png)
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`
2021-06-29Rollup merge of #86657 - jam1garner:future_prelude_false_positive, ↵Yuki Okushi-0/+16
r=nikomatsakis Fix `future_prelude_collision` false positive Fixes #86633 The lint for checking if method resolution of methods named `try_into` will fail in 2021 edition previously would fire on all inherent methods, however for inherent methods that consume `self`, this takes priority over `TryInto::try_into` due to being inherent, while trait method and methods that take `&self` or `&mut self` don't take priority, and thus aren't affected by this false positive. This fix is rather simple: simply checking if the inherent method doesn't auto-deref or auto-ref (and thus takes `self`) and if so, prevents the lint from firing.
2021-06-28Auto merge of #86669 - Smittyvb:satisfy-windows-defender, r=Mark-Simulacrumbors-1/+1
Don't run a publically reachable server in tests This causes Windows Defender's firewall to pop up during tests to ask if I want to allow the test program to access the public Internet, since it was listening on `0.0.0.0` (the test passes regardless of how you respond to the modal, since the firewall only affects traffic outside of the computer, none of which actually happens in the test). The test server doesn't actually need to be publicly reachable, so this makes it so it is only reachable locally, which makes Windows Defender happy.
2021-06-28Add test for item-table with resize to mobileStefan Schindler-10/+55
2021-06-29Rollup merge of #86688 - JohnTitor:test-65384, r=jackh726Yuki Okushi-0/+30
Add a regression test for issue-65384 Closes #65384 r? `@jackh726`
2021-06-29Rollup merge of #86358 - klensy:pp-loop, r=Mark-SimulacrumYuki Okushi-3/+20
fix pretty print for `loop`
2021-06-29Rollup merge of #86206 - FabianWolff:issue-86188, r=Mark-SimulacrumYuki Okushi-29/+167
Fix type checking of return expressions outside of function bodies This pull request fixes #86188. The problem is that the current code for type-checking `return` expressions stops if the `return` occurs outside of a function body, while the correct behavior is to continue type-checking the return value expression (otherwise an ICE happens later on because variables declared in the return value expression don't have a type). Also, I have noticed that it is sometimes not obvious why a `return` is outside of a function body; for instance, in the example from #86188 (which currently causes an ICE): ```rust fn main() { [(); return || { let tx; }] } ``` I have changed the error message to also explain why the `return` is considered outside of the function body: ``` error[E0572]: return statement outside of function body --> ice0.rs:2:10 | 1 | / fn main() { 2 | | [(); return || { | |__________^ 3 | || let tx; 4 | || }] | ||_____^ the return is part of this body... 5 | | } | |_- ...not the enclosing function body ```
2021-06-28Only include lint in future_incompatible lint group if not an edition lintRyan Levick-9/+30
2021-06-28Bless the test suite.Charles Lew-5/+5