about summary refs log tree commit diff
path: root/src/test
AgeCommit message (Collapse)AuthorLines
2019-01-19Continune parsing after encountering Trait with paren argsEsteban Küber-12/+40
2019-01-19Rollup merge of #57723 - estebank:fix, r=davidtwcoMazdak Farrokhzad-3/+139
Point at cause for expectation in return type type error Various improvements and fixes for type errors in return expressions. Fix #57664.
2019-01-19Rollup merge of #57649 - petrochenkov:privexist, r=arielb1Mazdak Farrokhzad-6/+33
privacy: Account for associated existential types Turns out they *can* be associated (but only in impls, not traits). Fixes https://github.com/rust-lang/rust/issues/53546#issuecomment-454372879 r? @arielb1
2019-01-19Rollup merge of #57502 - nikomatsakis:fix-trait-alias-1b, r=nikomatsakisMazdak Farrokhzad-0/+122
make trait-aliases work across crates This is rebase of a small part of @alexreg's PR #55994. It focuses just on the changes that integrate trait aliases properly into crate metadata, excluding the stylistic edits and the trait objects. The stylistic edits I also rebased and can open a separate PR. The trait object stuff I found challenging and decided it basically needed to be reimplemented. For now I've excluded it. Since this is really @alexreg's work (I really just rebased) I am going to make it r=me once it is working. Fixes #56488. Fixes #57023.
2019-01-19Rollup merge of #57698 - michaelwoerister:issue57692, r=ZoxcMazdak Farrokhzad-0/+17
Fix typo bug in DepGraph::try_mark_green(). r? @Zoxc Fixes #57692.
2019-01-19Rollup merge of #57666 - ↵Mazdak Farrokhzad-5/+3
pnkfelix:generalize-huge-enum-test-to-work-cross-platform, r=nikomatsakis Generalize `huge-enum.rs` test and expected stderr for more cross platform cases With this change, I am able to build and test cross-platform `rustc` In particular, I can use the following in my `config.toml`: ``` [build] host = ["i686-unknown-linux-gnu", "x86_64-unknown-linux-gnu"] target = ["i686-unknown-linux-gnu", "x86_64-unknown-linux-gnu"] ``` Before this change, my attempt to run the test suite would fail because the error output differs depending on what your host and targets are. ---- To be concrete, here are the actual messages one can observe: ``` % ./build/x86_64-unknown-linux-gnu/stage1/bin/rustc ../src/test/ui/huge-enum.rs -Aunused --target=x86_64-unknown-linux-gnu error: the type `std::option::Option<[u32; 35184372088831]>` is too big for the current architecture error: aborting due to previous error % ./build/x86_64-unknown-linux-gnu/stage1/bin/rustc ../src/test/ui/huge-enum.rs -Aunused --target=i686-unknown-linux-gnu error: the type `std::option::Option<[u32; 536870911]>` is too big for the current architecture error: aborting due to previous error % ./build/i686-unknown-linux-gnu/stage1/bin/rustc ../src/test/ui/huge-enum.rs -Aunused --target=i686-unknown-linux-gnu error: the type `std::option::Option<[u32; 536870911]>` is too big for the current architecture error: aborting due to previous error % ./build/i686-unknown-linux-gnu/stage1/bin/rustc ../src/test/ui/huge-enum.rs -Aunused --target=x86_64-unknown-linux-gnu error: the type `[u32; 35184372088831]` is too big for the current architecture error: aborting due to previous error ``` To address these variations, I changed the test to be more aggressive in its normalization strategy. We cannot (and IMO should not) guarantee that `Option` will appear in the error output here. So I normalized both types `Option<[u32; N]>` and `[u32; N]` to just `TYPE`
2019-01-19Rollup merge of #57610 - mark-i-m:nested-matchers, r=petrochenkovMazdak Farrokhzad-20/+243
Fix nested `?` matchers fix #57597 I'm not 100% if this works yet... cc @alercah When this is ready (but perhaps not yet):
2019-01-19Rollup merge of #57501 - petrochenkov:highvar, r=alexregMazdak Farrokhzad-0/+89
High priority resolutions for associated variants In https://github.com/rust-lang/rust/pull/56225 variants were assigned lowest priority during name resolution to avoid crater run and potential breakage. This PR changes the rules to give variants highest priority instead. Some motivation: - If variants (and their constructors) are treated as associated items, then they are obviously *inherent* associated items since they don't come from traits. - Inherent associated items have higher priority during resolution than associated items from traits. - The reason is that there is a way to disambiguate in favor of trait items (`<Type as Trait>::Ambiguous`), but there's no way to disambiguate in favor of inherent items, so they became unusable in case of ambiguities if they have low priority. - It's technically problematic to fallback from associated types to anything until lazy normalization (?) is implemented. Crater found some regressions from this change, but they are all in type positions, e.g. ```rust fn f() -> Self::Ambiguos { ... } // Variant `Ambiguous` or associated type `Ambiguous`? ``` , so variants are not usable there right now, but they may become usable in the future if https://github.com/rust-lang/rfcs/pull/2593 is accepted. This PR keeps code like this successfully resolving, but introduces a future-compatibility lint `ambiguous_associated_items` that recommends rewriting it as `<Self as Trait>::Ambiguous`.
2019-01-19Auto merge of #56722 - Aaron1011:fix/blanket-eval-overflow, r=nikomatsakisbors-10/+41
Fix stack overflow when finding blanket impls Currently, SelectionContext tries to prevent stack overflow by keeping track of the current recursion depth. However, this depth tracking is only used when performing normal section (which includes confirmation). No such tracking is performed for evaluate_obligation_recursively, which can allow a stack overflow to occur. To fix this, this commit tracks the current predicate evaluation depth. This is done separately from the existing obligation depth tracking: an obligation overflow can occur across multiple calls to 'select' (e.g. when fulfilling a trait), while a predicate evaluation overflow can only happen as a result of a deep recursive call stack. Fixes #56701 I've re-used `tcx.sess.recursion_limit` when checking for predication evaluation overflows. This is such a weird corner case that I don't believe it's necessary to have a separate setting controlling the maximum depth.
2019-01-19Auto merge of #56479 - mark-i-m:unsat, r=nikomatsakisbors-94/+89
Better lifetime error message I propose the following error message as more user-friendly r? @nikomatsakis
2019-01-18Rollup merge of #57725 - estebank:parens, r=michaelwoeristerMazdak Farrokhzad-3/+9
Use structured suggestion to surround struct literal with parenthesis
2019-01-18Rollup merge of #57720 - dlrobertson:fix_57521, r=estebankMazdak Farrokhzad-2/+58
Fix suggestions given mulitple bad lifetimes When given multiple lifetimes prior to type parameters in generic parameters, do not ICE and print the correct suggestion. r? @estebank CC @pnkfelix Fixes: #57521
2019-01-18Rollup merge of #57657 - AB1908:regression-test-case, r=nikomatsakisMazdak Farrokhzad-0/+32
Add regression test to close #53787 Fixes #53787
2019-01-18Rollup merge of #57650 - AB1908:master, r=petrochenkovMazdak Farrokhzad-0/+13
librustc_metadata: Pass a default value when unwrapping a span Fixes #57323. When compiling with `static-nobundle` a-la `rustc -l static-nobundle=nonexistent main.rs` we now get a neat output in the form of: ``` error[E0658]: kind="static-nobundle" is feature gated (see issue #37403) | = help: add #![feature(static_nobundle)] to the crate attributes to enable error: aborting due to previous error For more information about this error, try `rustc --explain E0658`. ``` The build and tests completed successfully on my machine. Should I be adding a new test?
2019-01-18Rollup merge of #57635 - euclio:path-separators, r=michaelwoeristerMazdak Farrokhzad-15/+25
use structured macro and path resolve suggestions
2019-01-18Rollup merge of #57350 - folex:master, r=estebankMazdak Farrokhzad-0/+4
Better error note on unimplemented Index trait for string fixes #56740 I've tried to compile suggestion from comments in the issue #56740, but unsure of it. So I'm open to advice :) Current output will be like this: ```rust error[E0277]: the type `str` cannot be indexed by `{integer}` --> $DIR/str-idx.rs:3:17 | LL | let c: u8 = s[4]; //~ ERROR the type `str` cannot be indexed by `{integer}` | ^^^^ `str` cannot be indexed by `{integer}` | = help: the trait `std::ops::Index<{integer}>` is not implemented for `str` = note: you can use `.chars().nth()` or `.bytes().nth()` see chapter in The Book <https://doc.rust-lang.org/book/ch08-02-strings.html#indexing-into-strings> error: aborting due to previous error For more information about this error, try `rustc --explain E0277`. ``` `x.py test src/test/ui` succeeded and I've also tested output manually by compiling the following code: ```rust fn _f() { let s = std::string::String::from("hello"); let _c = s[0]; let s = std::string::String::from("hello"); let mut _c = s[0]; let s = "hello"; let _c = s[0]; let s = "hello"; let mut _c = &s[0]; } ``` Not sure if some docs should be changed too. I will also fix error message in the [Book :: Indexing into Strings](https://github.com/rust-lang/book/blob/db53e2e3cdf77beac853df6f29db4b3b86ea598c/src/ch08-02-strings.md#indexing-into-strings) if that PR will get approved :)
2019-01-18Rollup merge of #57302 - sinkuu:unused_assignments_fp, r=estebankMazdak Farrokhzad-0/+9
Fix unused_assignments false positive Fixes #22630. In liveness analysis, make `continue` jump to the loop condition's `LiveNode` (`cond` as in comment) instead of the loop's one (`expr`). https://github.com/rust-lang/rust/blob/069b0c410808c1d1d33b495e048b1186e9f8d57f/src/librustc/middle/liveness.rs#L1358-L1370
2019-01-18Rollup merge of #57107 - mjbshaw:thread_local_test, r=nikomatsakisMazdak Farrokhzad-0/+36
Add a regression test for mutating a non-mut #[thread_local] This should close #54901 since the regression has since been fixed.
2019-01-18Auto merge of #57737 - Centril:rollup, r=Centrilbors-0/+26
Rollup of 10 pull requests Successful merges: - #56594 (Remove confusing comment about ideally using `!` for `c_void`) - #57340 (Use correct tracking issue for c_variadic) - #57357 (Cleanup PartialEq docs.) - #57551 (resolve: Add a test for issue #57539) - #57636 (Fix sources sidebar not showing up) - #57646 (Fixes text becoming invisible when element targetted) - #57654 (Add some links in std::fs.) - #57683 (Document Unpin in std::prelude documentation) - #57685 (Enhance `Pin` impl applicability for `PartialEq` and `PartialOrd`.) - #57710 (Fix non-clickable urls) Failed merges: r? @ghost
2019-01-18Rollup merge of #57551 - petrochenkov:regrtest, r=nikomatsakisMazdak Farrokhzad-0/+26
resolve: Add a test for issue #57539 Add a test for the bugfix regression reported in https://github.com/rust-lang/rust/issues/57539 Closes https://github.com/rust-lang/rust/issues/57539
2019-01-18Point at return type when appropriateEsteban Küber-3/+16
2019-01-17Fix test after rebaseEsteban Küber-4/+6
2019-01-17Point at more cases involving return typesEsteban Küber-0/+3
2019-01-17Avoid pointing at multiple places on return type errorEsteban Küber-8/+2
2019-01-17Point more places where expectation comes fromEsteban Küber-2/+9
2019-01-17Do not give incorrect label for return type mismatchEsteban Küber-0/+117
2019-01-17Use structured suggestion to surround struct literal with parenthesisEsteban Küber-3/+9
2019-01-17fix compat-mode ui testMark Mansi-1/+1
2019-01-17Update testsMark Mansi-93/+88
2019-01-18Fix suggestions given mulitple bad lifetimesDan Robertson-2/+58
When given multiple lifetimes prior to type parameters in generic parameters, do not ICE and print the correct suggestion.
2019-01-17Bless test.Wesley Norris-2/+2
Bless test, remove submodule, and fix book entry. bless test again? maybe it'll work this time...
2019-01-17Minor changes to wording and formatting.Wesley Norris-3/+2
2019-01-17Bless test.Wesley Norris-2/+3
2019-01-18privacy: Account for associated existential typesVadim Petrochenkov-6/+33
2019-01-17Fix typo bug in DepGraph::try_mark_green().Michael Woerister-0/+17
2019-01-17Auto merge of #57520 - alexreg:tidy-copyright-lint, r=Mark-Simulacrumbors-62/+9
Add lint for copyright headers to 'tidy' tool r? @Mark-Simulacrum CC @centril
2019-01-17Add test for linking non-existent static libraryAB1908-0/+13
2019-01-16Auto merge of #57392 - Xanewok:always-calc-glob-map, r=petrochenkovbors-2/+2
Always calculate glob map but only for glob uses Previously calculating glob map was *opt-in*, however it did record node id -> ident use for every use directive. This aims to see if we can unconditionally calculate the glob map and not regress performance. Main motivation is to get rid of some of the moving pieces and simplify the compilation interface - this would allow us to entirely remove `CrateAnalysis`. Later, we could easily expose a relevant query, similar to the likes of `maybe_unused_trait_import` (so using precomputed data from the resolver, but which could be rewritten to be on-demand). r? @nikomatsakis Local perf run showed mostly noise (except `ctfe-stress-*`) but I'd appreciate if we could do a perf run run here and double-check that this won't regress performance.
2019-01-16Fix error templateAB1908-1/+1
2019-01-16Prioritize variants as inherent associated items during name resolutionVadim Petrochenkov-0/+89
2019-01-16Don't explicitly increment the depth for new trait predicatesAaron Hill-3/+70
2019-01-16Auto merge of #57321 - petrochenkov:atokens, r=nikomatsakisbors-1199/+1065
Implement basic input validation for built-in attributes Correct top-level shape (`#[attr]` vs `#[attr(...)]` vs `#[attr = ...]`) is enforced for built-in attributes, built-in attributes must also fit into the "meta-item" syntax (aka the "classic attribute syntax"). For some subset of attributes (found by crater run), errors are lowered to deprecation warnings. NOTE: This PR previously included https://github.com/rust-lang/rust/pull/57367 as well.
2019-01-16With this change, I am able to build and test cross-platform `rustc`Felix S. Klock II-5/+3
In particular, I can use the following in my `config.toml`: ``` [build] host = ["i686-unknown-linux-gnu", "x86_64-unknown-linux-gnu"] target = ["i686-unknown-linux-gnu", "x86_64-unknown-linux-gnu"] ``` Before this change, my attempt to run the test suite would fail because the error output differs depending on what your host and targets are. ---- To be concrete, here are the actual messages one can observe: ``` % ./build/x86_64-unknown-linux-gnu/stage1/bin/rustc ../src/test/ui/huge-enum.rs -Aunused --target=x86_64-unknown-linux-gnu error: the type `std::option::Option<[u32; 35184372088831]>` is too big for the current architecture error: aborting due to previous error % ./build/x86_64-unknown-linux-gnu/stage1/bin/rustc ../src/test/ui/huge-enum.rs -Aunused --target=i686-unknown-linux-gnu error: the type `std::option::Option<[u32; 536870911]>` is too big for the current architecture error: aborting due to previous error % ./build/i686-unknown-linux-gnu/stage1/bin/rustc ../src/test/ui/huge-enum.rs -Aunused --target=i686-unknown-linux-gnu error: the type `std::option::Option<[u32; 536870911]>` is too big for the current architecture error: aborting due to previous error % ./build/i686-unknown-linux-gnu/stage1/bin/rustc ../src/test/ui/huge-enum.rs -Aunused --target=x86_64-unknown-linux-gnu error: the type `[u32; 35184372088831]` is too big for the current architecture error: aborting due to previous error ``` To address these variations, I changed the test to be more aggressive in its normalization strategy. We cannot (and IMO should not) guarantee that `Option` will appear in the error output here. So I normalized both types `Option<[u32; N]>` and `[u32; N]` to just `TYPE`
2019-01-16Auto merge of #57416 - alexcrichton:remove-platform-intrinsics, r=nagisabors-363/+0
rustc: Remove platform intrinsics crate This was originally attempted in #57048 but it was realized that we could fully remove the crate via the `"unadjusted"` ABI on intrinsics. This means that all intrinsics in stdsimd are implemented directly against LLVM rather than using the abstraction layer provided here. That ends up meaning that this crate is no longer used at all. This crate developed long ago to implement the SIMD intrinsics, but we didn't end up using it in the long run. In that case let's remove it!
2019-01-16Remove trailing whitespaceAB1908-1/+0
2019-01-16Add regression test to close #53787AB1908-0/+33
2019-01-15update test outputmark-12/+60
2019-01-15update/add testsmark-8/+183
2019-01-15use structured macro and path resolve suggestionsAndy Russell-15/+25
2019-01-15Rollup merge of #57587 - Aaron1011:fix/const-pat-ice, r=alexcrichtonMazdak Farrokhzad-0/+1
Add 'rustc-env:RUST_BACKTRACE=0' to const-pat-ice test This ensures that the test passes, regardless of what the user has set RUST_BACKTRACE to.