about summary refs log tree commit diff
path: root/src/test
AgeCommit message (Collapse)AuthorLines
2019-09-26hir: Disallow `target_feature` on constantsDavid Wood-51/+152
This commit fixes an ICE when `target_feature` is applied to constants. Signed-off-by: David Wood <david@davidtw.co>
2019-09-25Rollup merge of #64738 - gnzlbg:miri_norm_abi, r=oli-obkMazdak Farrokhzad-0/+53
Add const-eval support for SIMD types, insert, and extract This adds initial support for constant-evaluation of Abi::Vector types. r? @oli-obk
2019-09-25Rollup merge of #64508 - Centril:or-pat-hir, r=matthewjasperMazdak Farrokhzad-10/+13
or-patterns: Push `PatKind/PatternKind::Or` at top level to HIR & HAIR Following up on work in https://github.com/rust-lang/rust/pull/64111, https://github.com/rust-lang/rust/pull/63693, and https://github.com/rust-lang/rust/pull/61708, in this PR: - We change `hair::Arm.patterns: Vec<Pattern<'_>>` into `hir::Arm.pattern: Pattern<'_>`. - `fn hair::Arm::top_pats_hack` is introduced as a temporary crutch in MIR building to avoid more changes. - We change `hir::Arm.pats: HirVec<P<Pat>>` into `hir::Arm.pat: P<Pat>`. - The hacks in `rustc::hir::lowering` are removed since the representation hack is no longer necessary. - In some places, `fn hir::Arm::top_pats_hack` is introduced to leave some things as future work. - Misc changes: HIR pretty printing is adjusted to behave uniformly wrt. top/inner levels, rvalue promotion is adjusted, regionck, and dead_code is also. - Type checking is adjusted to uniformly handle or-patterns at top/inner levels. To make things compile, `p_0 | ... | p_n` is redefined as a "reference pattern" in [`fn is_non_ref_pat`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_typeck/check/struct.FnCtxt.html#method.is_non_ref_pat) for now. This is done so that reference types are not eagerly stripped from the `expected: Ty<'tcx>`. - Liveness is adjusted wrt. the `unused_variables` and `unused_assignments` lints to handle top/inner levels uniformly and the handling of `fn` parameters, `let` locals, and `match` arms are unified in this respect. This is not tested for now as exhaustiveness checks are reachable and will ICE. - In `check_match`, checking `@` and by-move bindings is adjusted. However, exhaustiveness checking is not adjusted the moment and is handled by @dlrobertson in https://github.com/rust-lang/rust/pull/63688. - AST borrowck (`construct.rs`) is not adjusted as AST borrowck will be removed soon. r? @matthewjasper cc @dlrobertson @varkor @oli-obk
2019-09-25Remove fail testsgnzlbg-201/+0
2019-09-25Clean testsgnzlbg-11/+31
2019-09-25Test errorsgnzlbg-60/+181
2019-09-25Refactorgnzlbg-0/+24
2019-09-25Allow simd_insert and simd_extract in const_fngnzlbg-290/+2
2019-09-25Rollup merge of #64753 - ehuss:json-short-explain, r=Mark-SimulacrumMazdak Farrokhzad-2/+0
Don't emit explain with json short messages. This fixes an issue where `--error-format=json --json=diagnostic-short` would emit the "For more information about this error" message, which doesn't match the behavior of `--error-format=short` which explicitly excludes it.
2019-09-25Rollup merge of #64746 - estebank:elide-impl-trait-obligations-on-err, ↵Mazdak Farrokhzad-107/+173
r=cramertj Remove blanket silencing of "type annotation needed" errors Remove blanket check for existence of other errors before emitting "type annotation needed" errors, and add some eager checks to avoid adding obligations when they refer to types that reference `[type error]` in order to reduce unneeded errors. Fix #64084.
2019-09-25Rollup merge of #64599 - csmoe:doc_async_reexport, r=nikomatsakisMazdak Farrokhzad-1/+19
Rustdoc render async function re-export Closes #63710 r? @nikomatsakis
2019-09-25Rollup merge of #64428 - GuillaumeGomez:error-explanation-E0524, r=CentrilMazdak Farrokhzad-10/+9
Error explanation e0524 Part of https://github.com/rust-lang/rust/issues/61137
2019-09-25Rollup merge of #64324 - alexcrichton:share-generics-again, r=michaelwoeristerMazdak Farrokhzad-8/+61
rustc: Fix mixing crates with different `share_generics` This commit addresses #64319 by removing the `dylib` crate type from the list of crate type that exports generic symbols. The bug in #64319 arises because a `dylib` crate type was trying to export a symbol in an uptream crate but it miscalculated the symbol name of the uptream symbol. This isn't really necessary, though, since `dylib` crates aren't that heavily used, so we can just conservatively say that the `dylib` crate type never exports generic symbols, forcibly removing them from the exported symbol lists if were to otherwise find them. The fix here happens in two places: * First is in the `local_crate_exports_generics` method, indicating that it's now `false` for the `Dylib` crate type. Only rlibs actually export generics at this point. * Next is when we load exported symbols from upstream crate. If, for our compilation session, the crate may be included from a dynamic library, then its generic symbols are removed. When the crate was linked into a dynamic library its symbols weren't exported, so we can't consider them a candidate to link against. Overally this should avoid situations where we incorrectly calculate the upstream symbol names in the face of differnet `share_generics` options, ultimately... Closes #64319
2019-09-24Don't emit explain with json short messages.Eric Huss-2/+0
2019-09-24Rollup merge of #64748 - Centril:fix-64744, r=estebankMazdak Farrokhzad-2/+16
Fix #64744. Account for the Zero sub-pattern case. Fixes https://github.com/rust-lang/rust/issues/64744. r? @estebank
2019-09-24Rollup merge of #64698 - Centril:infer-const-with-stash, r=estebankMazdak Farrokhzad-0/+84
Recover on `const X = 42;` and infer type + Error Stash API Here we: 1. Introduce a notion of the "error stash". This is a map in the `Handler` to which you can `err.stash(...)` away your diagnostics and then steal them in a later "phase" of the compiler (e.g. stash in parser, steal in typeck) to enrich them with more information that isn't available in the previous "phase". I believe I've covered all the bases to make sure these diagnostics are actually emitted eventually even under `#[cfg(FALSE)]` but please check my logic. 2. Recover when parsing `[const | static mut?] $ident = $expr;` which has a missing type. Use the "error stash" to stash away the error and later steal the error in typeck where we emit the error as `MachineApplicable` with the actual inferred type. This builds on https://github.com/rust-lang/rust/pull/62804. cc https://github.com/rust-lang/rfcs/pull/2545 r? @estebank
2019-09-24Rollup merge of #64016 - nnethercote:Compiler-fiddling, r=oli-obkMazdak Farrokhzad-1/+2
Streamline `Compiler` A few commits to clean up `Compiler`. r? @Zoxc
2019-09-24Fix #64744 -- handle zero sub-pats case.Mazdak Farrokhzad-2/+16
2019-09-24Add additional tests for type alias impl trait coherenceAaron Hill-0/+71
2019-09-24fix rebaseEsteban Küber-1/+1
2019-09-24Remove blanket silencing of "type annotation needed" errorsEsteban Küber-107/+173
Remove blanket check for existence of other errors before emitting "type annotation needed" errors, and add some eager checks to avoid adding obligations when they refer to types that reference `[type error]` in order to reduce unneded errors.
2019-09-24Fix coherence checking for impl trait in type aliasesAaron Hill-0/+49
Fixes #63677 RFC #2071 (impl-trait-existential-types) does not explicitly state how impl trait type alises should interact with coherence. However, there's only one choice which makes sense - coherence should look at the underlying type (i.e. the 'defining' type of the impl trait) of the type alias, just like we do for non-impl-trait type aliases. Specifically, impl trait type alises which resolve to a local type should be treated like a local type with respect to coherence (e.g. impl trait type aliases which resolve to a forieign type should be treated as a foreign type, and those that resolve to a local type should be treated as a local type). Since neither inherent impls nor direct trait impl (i.e. `impl MyType` or `impl MyTrait for MyType`) are allowd for type aliases, this usually does not come up. Before we ever attempt to do coherence checking, we will have errored out if an impl trait type alias was used directly in an 'impl' clause. However, during trait selection, we sometimes need to prove bounds like 'T: Sized' for some type 'T'. If 'T' is an impl trait type alias, this requires to know the coherence behavior for impl trait type aliases when we perform coherence checking. Note: Since determining the underlying type of an impl trait type alias requires us to perform body type checking, this commit causes us to type check some bodies easlier than we otherwise would have. However, since this is done through a query, this shouldn't cause any problems For completeness, I've added an additional test of the coherence-related behavior of impl trait type aliases.
2019-09-24Add some more testsgnzlbg-27/+296
2019-09-24Move tests to SIMD subdirectorygnzlbg-8/+8
2019-09-24Add a fail testgnzlbg-0/+36
2019-09-24Add const-eval support for SIMD types, insert, and extractgnzlbg-0/+72
2019-09-24Stabilize `str::len`, `[T]::len`, `is_empty` and `str::as_bytes` as const fnOliver Scherer-17/+16
2019-09-23rustc: Fix mixing crates with different `share_generics`Alex Crichton-8/+61
This commit addresses #64319 by removing the `dylib` crate type from the list of crate type that exports generic symbols. The bug in #64319 arises because a `dylib` crate type was trying to export a symbol in an uptream crate but it miscalculated the symbol name of the uptream symbol. This isn't really necessary, though, since `dylib` crates aren't that heavily used, so we can just conservatively say that the `dylib` crate type never exports generic symbols, forcibly removing them from the exported symbol lists if were to otherwise find them. The fix here happens in two places: * First is in the `local_crate_exports_generics` method, indicating that it's now `false` for the `Dylib` crate type. Only rlibs actually export generics at this point. * Next is when we load exported symbols from upstream crate. If, for our compilation session, the crate may be included from a dynamic library, then its generic symbols are removed. When the crate was linked into a dynamic library its symbols weren't exported, so we can't consider them a candidate to link against. Overally this should avoid situations where we incorrectly calculate the upstream symbol names in the face of differnet `share_generics` options, ultimately... Closes #64319
2019-09-23Add parser recovery for `const $ident = $expr;`.Mazdak Farrokhzad-0/+84
Then use the diagnostics-stealing API to stash parser errors and enrich them with type information in typeck.
2019-09-23Auto merge of #64695 - Centril:rollup-t1xnl2c, r=Centrilbors-0/+61
Rollup of 7 pull requests Successful merges: - #64294 (Fix `Stdio::piped` example code and lint) - #64670 (Cleanup syntax::ext::build) - #64674 (Propagate `types.err` in locals further to avoid spurious knock-down errors) - #64676 (Parse assoc type bounds in generic params and provide custom diagnostic) - #64677 (remove outdated comment) - #64679 (Infer consts more consistently) - #64688 (Clarify the "since" tidy check) Failed merges: r? @ghost
2019-09-23Rollup merge of #64679 - skinny121:const-infer, r=varkorMazdak Farrokhzad-0/+29
Infer consts more consistently Moved some duplicated logic in `TypeRelation` methods into `super_combined_consts`. Before some `TypeRelation`s like `Lub` wasn't using `replace_if_possible`, meaning some inference types were staying around longer than they should be. Fixes https://github.com/rust-lang/rust/issues/64519 r? @varkor
2019-09-23Rollup merge of #64676 - estebank:assoc-type-bound-in-generic, r=petrochenkovMazdak Farrokhzad-0/+19
Parse assoc type bounds in generic params and provide custom diagnostic Fix #26271.
2019-09-23Rollup merge of #64674 - estebank:knock-down-the-wall, r=CentrilMazdak Farrokhzad-0/+13
Propagate `types.err` in locals further to avoid spurious knock-down errors Fix #33575, fix #44504.
2019-09-22fix nll testsEsteban Küber-29/+26
2019-09-22ignore-x86 instead of ignore-muslEsteban Küber-11/+11
2019-09-22hack to avoid incorrect suggestionEsteban Küber-8/+2
2019-09-22Point at type param when it's cause of unfulfilled obligationEsteban Küber-93/+99
2019-09-22Fix rebaseEsteban Küber-5/+2
2019-09-22ignore musl target in tests to avoid issues with output differencesEsteban Küber-28/+50
2019-09-22review commentsEsteban Küber-10/+10
2019-09-22Point at correct span for parenthesized typesEsteban Küber-84/+84
2019-09-22On obligation errors point at the unfulfilled binding when possibleEsteban Küber-496/+517
2019-09-22Auto merge of #64669 - estebank:unreachable, r=Centrilbors-331/+185
Use span label instead of note in unreachable lint Fix #64636.
2019-09-22Infer consts consistently. Moved some logic into super_combined_consts,ben-0/+29
also removed some duplicated logic from TypeRelation methods.
2019-09-21review comments: wordingEsteban Küber-2/+2
2019-09-21review commentsEsteban Küber-1/+1
2019-09-21Parse assoc type bounds in generic params and provide custom diagnosticEsteban Küber-0/+19
2019-09-21review commentsEsteban Küber-2/+2
2019-09-21Propagate `types.err` in locals further to avoid spurious knock-down errorsEsteban Küber-0/+13
2019-09-21Do not trigger unreachable lint in async body and Use span labelsEsteban Küber-331/+185