about summary refs log tree commit diff
path: root/src/test
AgeCommit message (Collapse)AuthorLines
2019-11-14TAIT: adjust testsMazdak Farrokhzad-29/+202
2019-11-14TAIT: --bless some span changes for the betterMazdak Farrokhzad-20/+20
2019-11-14Auto merge of #66403 - JohnTitor:rollup-7obuivl, r=JohnTitorbors-103/+178
Rollup of 9 pull requests Successful merges: - #66253 (Improve errors after re rebalance coherence) - #66264 (fix an ICE in macro's diagnostic message) - #66349 (expand source_util macros with def-site context) - #66351 (Tweak non-char/numeric in range pattern diagnostic) - #66360 (Fix link to Exten in Vec::set_len) - #66361 (parser: don't use `unreachable!()` in `fn unexpected`.) - #66363 (Improve error message in make_tests) - #66369 (compiletest: Obtain timestamps for common inputs only once) - #66372 (Fix broken links in Ipv4Addr::is_benchmarking docs) Failed merges: r? @ghost
2019-11-14Rollup merge of #66361 - Centril:66357, r=pnkfelixYuki Okushi-0/+30
parser: don't use `unreachable!()` in `fn unexpected`. Fixes #66357 r? @estebank
2019-11-14Rollup merge of #66351 - JohnTitor:tweak-range-err-msg, r=CentrilYuki Okushi-77/+62
Tweak non-char/numeric in range pattern diagnostic Fixes #66283 r? @estebank
2019-11-14Rollup merge of #66264 - guanqun:fix-mbe-missing-close-delim, r=estebankYuki Okushi-3/+37
fix an ICE in macro's diagnostic message This has two small fixes: 1. for the left brace, we don't need `<space>{`, simply `{` is enough. 2. for the right brace, it tries to peel off one character even when the close delim is missing. Without this fix, it would crash in some cases. (as shown in the new test case) r? @estebank
2019-11-14Rollup merge of #66253 - ↵Yuki Okushi-23/+49
ohadravid:improve-errors-after-re-rebalance-coherence, r=estebank Improve errors after re rebalance coherence Following #65247, I noticed that some error messages should be updated to reflect the changes of `re_rebalance_coherence` (also there was a [note](https://rust-lang.github.io/rfcs/2451-re-rebalancing-coherence.html#teaching-users) in the RFC about it). First, error message `E0210` was updated to match the RFC, and I also tried to improve a little the error when the "order" of types is problematic. For code like this: ``` #![feature(re_rebalance_coherence)] // Now stable struct Wrap<T>(T); impl<T> From<Wrap<T>> for T { fn from(x: Wrap<T>) -> T { x.0 } } ``` The old error was: ``` error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct<T>`) --> src/lib.rs:5:6 | 5 | impl<T> From<Wrap<T>> for T { | ^ type parameter `T` must be used as the type parameter for some local type | = note: only traits defined in the current crate can be implemented for a type parameter ``` and the new error is: ``` error[E0210]: type parameter `T` must be covered by another type when it appears before the first local type (`Wrap<T>`) --> main.rs:66:6 | 66 | impl<T> From<Wrap<T>> for T { | ^ type parameter `T` must be covered by another type when it appears before the first local type (`Wrap<T>`) | = note: implementing a foreign trait is only possible if at least one of the types for which is it implemented is local, and no uncovered type parameters appear before that first local type = note: in this case, 'before' refers to the following order: `impl<..> ForeignTrait<T1, ..., Tn> for T0`, where `T0` is the first and `Tn` is the last ``` I tried to point at the uncovered `T`, but couldn't get something which was reliable (but I'll be happy to try if someone points me in the right direction). r? @estebank cc @nikomatsakis Fixes #65247
2019-11-14Auto merge of #66233 - cjgillot:constkind, r=oli-obkbors-3/+3
Split ConstValue into two enums Hello, Issue #59210 appeared abandoned, so I gave it a go. Some further cleanup and refactoring may be mandated. I did not test beyond `x.py check`, since my home computer dies compiling librustc. Fixes #59210
2019-11-13Auto merge of #66211 - kinnison:kinnison/fix-66159, r=GuillaumeGomezbors-0/+12
Fix ICE when documentation includes intra-doc-link When collecting intra-doc-links we could trigger the loading of extra crates into the crate store due to name resolution finding crates referred to in documentation but not in code. This might be due to configuration differences or simply referring to something else. This would cause an ICE because the newly loaded crate metadata existed in a crate store associated with the rustdoc global context, but the resolver had its own crate store cloned just before the documentation processing began and as such it could try and look up crates in a store which lacked them. In this PR, I add support for `--extern-private` to the `rustdoc` tool so that it is supported for `compiletest` to then pass the crates in; and then I fix the issue by forcing the resolver to look over all the crates before we then lower the input ready for processing into documentation. The first commit (the `--extern-private`) could be replaced with a commit which adds support for `--extern` to `compiletest` if preferred, though I think that adding `--extern-private` to `rustdoc` is more useful anyway since it makes the CLI a little more like `rustc`'s which might help reduce surprise for someone running it by hand or in their own test code. The PR is meant to fix #66159 though it may also fix #65840. cc @GuillaumeGomez
2019-11-13Bless miri unleashed test now that errors are mandatoryDylan MacKenzie-7/+13
2019-11-13Bless less verbose error messagesDylan MacKenzie-168/+68
The MIR const-checker errors for if/match/loop are now delay span bugs, so nothing will be emitted unless the HIR checker misses something.
2019-11-13Bless back-compat breakagesDylan MacKenzie-10/+45
This PR BREAKS CODE THAT WAS ACCEPTED ON STABLE. It's arguably a bug that this was accepted in the first place, but here we are. See #62272 for more info.
2019-11-13Bless const tests with improved diagnosticsDylan MacKenzie-243/+442
2019-11-13Extend const-loop and const-if to handle more casesDylan MacKenzie-21/+71
This makes sure that our HIR visitor is visiting as many const-items as possible.
2019-11-13Remove if/loop tests from min_const_fnDylan MacKenzie-4/+0
These errors will be triggered before the MIR const-checker runs, causing all other errors to be silenced. They are now checked in the `const-{if,loop}` tests.
2019-11-13Rollup merge of #66331 - JohnTitor:add-tests, r=CentrilYuki Okushi-0/+228
Add some tests for fixed ICEs Closes #30904 (fixed between nightly-2019-07-14 and nightly-2019-07-31) Closes #40231 (example 1 is fixed in 1.32.0, example 2 is fixed in 1.38.0) Closes #52432 (fixed in rustc 1.40.0-beta.1 (76b40532a 2019-11-05)) Closes #63279 (fixed in rustc 1.40.0-nightly (246be7e1a 2019-10-25)) r? @Centril
2019-11-13Rollup merge of #66297 - vakaras:edit-queries, r=oli-obkYuki Okushi-0/+1
Add a callback that allows compiler consumers to override queries. This pull request adds an additional callback that allows compiler consumers such as Prusti and MIRAI to override queries. My hope is that in this way it will be possible to get access to the internal compiler information (e.g. borrow checker) without major changes to the compiler. This pull request is work in progress because I am still testing if I can get the information which I need. cc @nikomatsakis r? @oli-obk
2019-11-13Rollup merge of #66186 - GuillaumeGomez:long-err-explanation-E0623, r=Dylan-DPCYuki Okushi-8/+78
Add long error explanation for E0623 Part of #61137. r? @Dylan-DPC
2019-11-13Rollup merge of #66166 - GuillaumeGomez:rename-rustdoc-to-doc, r=QuietMisdreavusYuki Okushi-7/+7
rename cfg(rustdoc) into cfg(doc) Needed by https://github.com/rust-lang/rust/pull/61351 r? @QuietMisdreavus
2019-11-13parser: don't use `unreachable!()` in `fn unexpected`.Mazdak Farrokhzad-0/+30
2019-11-13Tweak non-char/numeric in range pattern diagnosticYuki Okushi-77/+62
2019-11-12Bless mir-dump test.Camille GILLOT-1/+1
2019-11-12Bless symbol-names.Camille GILLOT-2/+2
2019-11-12Auto merge of #65608 - matthewjasper:mir-eval-order, r=pnkfelixbors-17/+201
Fix MIR lowering evaluation order and soundness bug * Fixes a soundness issue with built-in index operations * Ensures correct evaluation order of assignment expressions where the RHS is a FRU or is a use of a local of reference type. * Removes an unnecessary symbol to string conversion closes #65909 closes #65910
2019-11-13Add test for issue-63279Yuki Okushi-0/+22
2019-11-13Add test for issue-52432Yuki Okushi-0/+38
2019-11-13Add test for issue-40231Yuki Okushi-0/+108
2019-11-13Add test for issue-30904Yuki Okushi-0/+60
2019-11-12Auto merge of #66323 - JohnTitor:rollup-jl8xdk4, r=JohnTitorbors-6/+27
Rollup of 11 pull requests Successful merges: - #65965 (Clean up librustc_typeck error_codes file) - #66230 (remove vestigial comments referring to defunct numeric trait hierarchy) - #66241 (bump openssl version) - #66257 (Drop long-section-names linker workaround for windows-gnu) - #66263 (make the error message more readable) - #66267 (Add rustdoc doc) - #66276 (Move lock into CodeStats) - #66278 (Fix error message about exported symbols from proc-macro crates) - #66280 (Fix HashSet::union performance) - #66299 (support issue = "none" in unstable attributes ) - #66309 (Tiny cleanup to size assertions) Failed merges: r? @ghost
2019-11-12Rollup merge of #66299 - rossmacarthur:fix-41260-avoid-issue-0, r=varkorYuki Okushi-0/+21
support issue = "none" in unstable attributes This works towards fixing #41260. This PR allows the use of `issue = "none"` in unstable attributes and makes changes to internally store the issue number as an `Option<NonZeroU32>`. For example: ```rust #[unstable(feature = "unstable_test_feature", issue = "none")] fn unstable_issue_none() {} ``` It was not made optional because feedback seen here #60860 suggested that people might forget the issue field if it was optional. I could not remove the current uses of `issue = "0"` (of which there are a lot) because the stage 0 compiler expects the old syntax. Once this is available in the stage 0 compiler we can replace all uses of `"0"` with `"none"` and no longer allow `"0"`. This is my first time contributing, so I'm not sure what the protocol is with two-part things like this, so some guidance would be appreciated. r? @varkor
2019-11-12Rollup merge of #66278 - LukasKalbertodt:fix-proc-macro-error, r=CentrilYuki Okushi-6/+6
Fix error message about exported symbols from proc-macro crates Someone forgot to update the error message after `#[proc_macro]` and `#[proc_macro_attribute]` were stabilized.
2019-11-12Auto merge of #66129 - Nadrieril:refactor-slice-pat-usefulness, r=varkorbors-12/+275
Refactor slice pattern usefulness checking As a follow up to https://github.com/rust-lang/rust/pull/65874, this PR changes how variable-length slice patterns are handled in usefulness checking. The objectives are: cleaning up that code to make it easier to understand, and paving the way to handling fixed-length slices more cleverly too, for https://github.com/rust-lang/rust/issues/53820. Before this, variable-length slice patterns were eagerly expanded into a union of fixed-length slices. Now they have their own special constructor, which allows expanding them a bit more lazily. As a nice side-effect, this improves diagnostics. This PR shows a slight performance improvement, mostly due to https://github.com/rust-lang/rust/pull/66129/commits/149792b6080f40875c0072aae378a0eb31d23df0. This will probably have to be reverted in some way when we implement or-patterns.
2019-11-11Evaluate borrow and struct expressions in `into`Matthew Jasper-6/+73
This fixes some ordering problems around assignment expressions.
2019-11-11Fix soundness issue with index bounds checksMatthew Jasper-11/+128
An expression like `x[1][{ x = y; 2}]` would perform the bounds check for the inner index operation before evaluating the outer index. This would allow out of bounds memory accesses.
2019-11-11Add a callback that allows compiler consumers to override queries.Vytautas Astrauskas-0/+1
2019-11-11support issue = "none" in unstable attributesRoss MacArthur-0/+21
- Use `Option<NonZeroU32>` to represent issue numbers.
2019-11-11fix an ICE in macro's diagnostic messageGuanqun Lu-3/+37
2019-11-11Auto merge of #66213 - tmiasko:mandatory-error-warn, r=petrochenkovbors-414/+453
Make error and warning annotations mandatory in UI tests This change makes error and warning annotations mandatory in UI tests. The only exception are tests that use error patterns to match compiler output and don't have any annotations. Fixes #55596.
2019-11-11Fix error message about exported symbols from proc-macro cratesLukas Kalbertodt-6/+6
Someone forgot to update the error message after `#[proc_macro]` and `#[proc_macro_attribute]` were stabilized.
2019-11-11Auto merge of #66250 - oli-obk:no_fields_in_empty_unions, r=eddybbors-0/+15
Undo an assert causing an ICE until we fix the underlying problem r? @eddyb fixes #65462
2019-11-10Make error and warning annotations mandatory in UI testsTomasz Miąsko-324/+369
This change makes error and warning annotations mandatory in UI tests. The only exception are tests that use error patterns to match compiler output and don't have any annotations.
2019-11-10Add warning annotations to rustdoc-ui testsTomasz Miąsko-46/+67
2019-11-10Add warning annotations to ignore-stage1 ui-fulldeps testsTomasz Miąsko-44/+17
2019-11-10Auto merge of #66070 - petrochenkov:regattr, r=matthewjasperbors-30/+271
Support registering inert attributes and attribute tools using crate-level attributes And remove `#[feature(custom_attribute)]`. (`rustc_plugin::Registry::register_attribute` is not removed yet, I'll do it in a follow up PR.) ```rust #![register_attr(my_attr)] #![register_tool(my_tool)] #[my_attr] // OK #[my_tool::anything] // OK fn main() {} ``` --- Some tools (`rustfmt` and `clippy`) used in tool attributes are hardcoded in the compiler. We need some way to introduce them without hardcoding as well. This PR introduces a way to do it with a crate level attribute. The previous attempt to introduce them through command line (https://github.com/rust-lang/rust/pull/57921) met some resistance. This probably needs to go through an RFC before stabilization. However, I'd prefer to land *this* PR without an RFC to able to remove `#[feature(custom_attribute)]` and `Registry::register_attribute` while also providing a replacement. --- `register_attr` is a direct replacement for `#![feature(custom_attribute)]` (https://github.com/rust-lang/rust/issues/29642), except it doesn't rely on implicit fallback from unresolved attributes to custom attributes (which was always hacky and is the primary reason for the removal of `custom_attribute`) and requires registering the attribute explicitly. It's not clear whether it should go through stabilization or not. It's quite possible that all the uses should migrate to `#![register_tool]` (https://github.com/rust-lang/rust/issues/66079) instead. --- Details: - The naming is `register_attr`/`register_tool` rather than some `register_attributes` (plural, no abbreviation) for consistency with already existing attributes like `cfg_attr`, or `feature`, etc. --- Previous attempt: https://github.com/rust-lang/rust/pull/57921 cc https://github.com/rust-lang/rust/issues/44690 Tracking issues: #66079 (`register_tool`), #66080 (`register_attr`) Closes https://github.com/rust-lang/rust/issues/29642
2019-11-10Improve coherence errors for wrong type orderOhad Ravid-23/+49
2019-11-10Auto merge of #65324 - Centril:organize-syntax, r=petrochenkovbors-27/+39
Split libsyntax apart In this PR the general idea is to separate the AST, parser, and friends by a more data / logic structure (tho not fully realized!) by separating out the parser and macro expansion code from libsyntax. Specifically have now three crates instead of one (libsyntax): - libsyntax: - concrete syntax tree (`syntax::ast`) - definition of tokens and token-streams (`syntax::{token, tokenstream}`) -- used by `syntax::ast` - visitors (`syntax::visit`, `syntax::mut_visit`) - shared definitions between `libsyntax_expand` - feature gating (`syntax::feature_gate`) -- we could possibly move this out to its own crater later. - attribute and meta item utilities, including used-marking (`syntax::attr`) - pretty printer (`syntax::print`) -- this should possibly be moved out later. For now I've reduced down the dependencies to a single essential one which could be broken via `ParseSess`. This entails that e.g. `Debug` impls for `Path` cannot reference the pretty printer. - definition of `ParseSess` (`syntax::sess`) -- this is used by `syntax::{attr, print, feature_gate}` and is a common definition used by the parser and other things like librustc. - the `syntax::source_map` -- this includes definitions used by `syntax::ast` and other things but could ostensibly be moved `syntax_pos` since that is more related to this module. - a smattering of misc utilities not sufficiently important to itemize -- some of these could be moved to where they are used (often a single place) but I wanted to limit the scope of this PR. - librustc_parse: - parser (`rustc_parse::parser`) -- reading a file and such are defined in the crate root tho. - lexer (`rustc_parse::lexer`) - validation of meta grammar (post-expansion) in (`rustc_parse::validate_attr`) - libsyntax_expand -- this defines the infra for macro expansion and conditional compilation but this is not libsyntax_ext; we might want to merge them later but currently libsyntax_expand is depended on by librustc_metadata which libsyntax_ext is not. - conditional compilation (`syntax_expand::config`) -- moved from `syntax::config` to here - the bulk of this crate is made up of the old `syntax::ext` r? @estebank
2019-11-10Undo an assert causing an ICE until we fix the problem properlyOliver Scherer-0/+15
2019-11-10move syntax::parse -> librustc_parseMazdak Farrokhzad-5/+8
also move MACRO_ARGUMENTS -> librustc_parse
2019-11-10Auto merge of #66259 - JohnTitor:rollup-x9nk1e2, r=JohnTitorbors-4/+58
Rollup of 7 pull requests Successful merges: - #65719 (Refactor sync::Once) - #65831 (Don't cast directly from &[T; N] to *const T) - #66048 (Correct error in documentation for Ipv4Addr method) - #66058 (Correct deprecated `is_global` IPv6 documentation) - #66216 ([mir-opt] Handle return place in ConstProp and improve SimplifyLocals pass) - #66217 (invalid_value lint: use diagnostic items) - #66235 (rustc_metadata: don't let LLVM confuse rmeta blobs for COFF object files.) Failed merges: r? @ghost
2019-11-10move config.rs to libsyntax_expandMazdak Farrokhzad-14/+23