about summary refs log tree commit diff
path: root/src/test
AgeCommit message (Collapse)AuthorLines
2019-11-13parser: don't use `unreachable!()` in `fn unexpected`.Mazdak Farrokhzad-0/+30
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-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-11support issue = "none" in unstable attributesRoss MacArthur-0/+21
- Use `Option<NonZeroU32>` to represent issue numbers.
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-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
2019-11-10Rollup merge of #66235 - eddyb:coff-syrup, r=nagisaYuki Okushi-2/+2
rustc_metadata: don't let LLVM confuse rmeta blobs for COFF object files. This has likely been a silent issue since 1.10 but only caused trouble recently (see https://github.com/rust-lang/rust/issues/65536#issuecomment-552018224), when recent changes to the `rmeta` schema introduced more opportunities for COFF parse errors. To prevent any undesired interactions with old compilers, I've renamed the file inside `rlib`s from `rust.metadata.bin` to `lib.rmeta` (not strongly attached to it, suggestions welcome). Fixes #65536. <hr/> Before: ``` $ llvm-objdump -all-headers build/*/stage1-std/*/release/deps/libcore-*.rmeta build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/release/deps/libcore-6b9e8b5a59b79a1d.rmeta: file format COFF-<unknown arch> architecture: unknown start address: 0x00000000 Sections: Idx Name Size VMA Type SYMBOL TABLE: ``` After: ``` $ llvm-objdump -all-headers build/*/stage1-std/*/release/deps/libcore-*.rmeta llvm-objdump: error: 'build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/release/deps/libcore-6b9e8b5a59b79a1d.rmeta': The file was not recognized as a valid object file ```
2019-11-10Rollup merge of #66216 - wesleywiser:const_prop_codegen_improvements, r=oli-obkYuki Okushi-2/+56
[mir-opt] Handle return place in ConstProp and improve SimplifyLocals pass Temporarily rebased on top of #66074. The top 2 commits are new. r? @oli-obk
2019-11-09Auto merge of #65694 - wesleywiser:uninhabited_enum_variants_pass, r=oli-obkbors-0/+224
[mir-opt] Implement pass to remove branches on uninhabited variants Based on discussion [here](https://github.com/rust-lang/rust/pull/64890#discussion_r333612125), this is a pass to eliminate dead code that is caused by branching on an enum with uninhabited variants. r? @oli-obk
2019-11-09Address review commentsVadim Petrochenkov-2/+114
2019-11-09Remove `#[feature(custom_attribute)]`Vadim Petrochenkov-30/+55
2019-11-09Support registering attributes and attribute tools using crate-level attributesVadim Petrochenkov-0/+104
2019-11-09Auto merge of #66242 - Centril:rollup-h73ztr1, r=Centrilbors-39/+60
Rollup of 6 pull requests Successful merges: - #65949 (Move promotion into its own pass) - #65994 (Point at where clauses where the associated item was restricted) - #66050 (Fix C aggregate-passing ABI on powerpc) - #66134 (Point at formatting descriptor string when it is invalid) - #66172 (Stabilize @file command line arguments) - #66226 (add link to unstable book for asm! macro) Failed merges: r? @ghost
2019-11-09Rollup merge of #66134 - estebank:unknown-formatting-trait, r=nikomatsakisMazdak Farrokhzad-4/+4
Point at formatting descriptor string when it is invalid When a formatting string contains an invalid descriptor, point at it instead of the argument: ``` error: unknown format trait `foo` --> $DIR/ifmt-bad-arg.rs:86:17 | LL | println!("{:foo}", 1); | ^^^ | = note: the only appropriate formatting traits are: - ``, which uses the `Display` trait - `?`, which uses the `Debug` trait - `e`, which uses the `LowerExp` trait - `E`, which uses the `UpperExp` trait - `o`, which uses the `Octal` trait - `p`, which uses the `Pointer` trait - `b`, which uses the `Binary` trait - `x`, which uses the `LowerHex` trait - `X`, which uses the `UpperHex` trait ```
2019-11-09Rollup merge of #65994 - estebank:where-bound, r=nikomatsakisMazdak Farrokhzad-1/+43
Point at where clauses where the associated item was restricted CC #57663. r? @nikomatsakis
2019-11-09Auto merge of #65879 - ohadravid:stabilize-re-rebalance-coherence, ↵bors-1492/+214
r=nikomatsakis Stabilize the `re_rebalance_coherence` feature This PR stabilizes [RFC 2451](https://rust-lang.github.io/rfcs/2451-re-rebalancing-coherence.html), re-rebalance coherence. Changes include removing the attribute from tests which tested both the old and new behavior, moving the feature to `accepted` and removing the old logic. I'll also open a [PR](https://github.com/rust-lang-nursery/reference/pull/703) against the reference, updating it with the content of the RFC. Closes #63599 r? @nikomatsakis
2019-11-08[mir-opt] Handle aggregates in SimplifyLocals passWesley Wiser-5/+2
2019-11-08[mir-opt] Handle const-prop for the return placeWesley Wiser-0/+57
2019-11-09move attr meta grammar to parse::validate_atr + ast_validationMazdak Farrokhzad-12/+12
2019-11-09rustc_metadata: don't let LLVM confuse rmeta blobs for COFF object files.Eduard-Mihai Burtescu-2/+2
2019-11-08Bless tests now that we do promotion if `min_const_fn` failsDylan MacKenzie-28/+7
We bailed out of `QualifyAndPromoteConsts` immediately if the `min_const_fn` checks failed, which sometimes resulted in additional, spurious errors since promotion was skipped. We now do promotion in a completely separate pass, so this is no longer an issue.
2019-11-08Use new `PromoteTemps` for promotionDylan MacKenzie-6/+6
2019-11-08Rollup merge of #66007 - estebank:remove-here, r=CentrilMazdak Farrokhzad-155/+155
Remove "here" from "expected one of X here"
2019-11-08Rollup merge of #65785 - Centril:compat-to-error-2, r=oli-obkMazdak Farrokhzad-394/+161
Transition future compat lints to {ERROR, DENY} - Take 2 Follow up to https://github.com/rust-lang/rust/pull/63247 implementing https://github.com/rust-lang/rust/pull/63247#issuecomment-536295992. - `legacy_ctor_visibility` (ERROR) -- closes #39207 - `legacy_directory_ownership` (ERROR) -- closes #37872 - `safe_extern_static` (ERROR) -- closes #36247 - `parenthesized_params_in_types_and_modules` (ERROR) -- closes #42238 - `duplicate_macro_exports` (ERROR) - `nested_impl_trait` (ERROR) -- closes #59014 - `ill_formed_attribute_input` (DENY) -- transitions #57571 - `patterns_in_fns_without_body` (DENY) -- transitions #35203 r? @varkor cc @petrochenkov
2019-11-08Auto merge of #66066 - ecstatic-morse:remove-promotion-from-qualify-consts, ↵bors-0/+17
r=eddyb Remove promotion candidate gathering and checking from `qualify_consts.rs` This makes promotion candidate gathering and checking the exclusive domain of `promote_consts`, but the `QualifyAndPromoteConsts` pass is still responsible for both const-checking and creating promoted MIR fragments. This should not be merged until the beta branches on Nov. 5. r? @eddyb
2019-11-08Rollup merge of #66049 - RalfJung:missing-spans, r=alexcrichtonYuki Okushi-104/+113
consistent handling of missing sysroot spans Due to https://github.com/rust-lang/rust/issues/53081, sysroot spans (pointing to code in libcore/libstd/...) fails to print on some x86 runners. This consolidates the ignore directives for that and references the relevant issue. I also did that for the generated derive-error-span tests -- but there the script and the tests were not entirely in sync any more since https://github.com/rust-lang/rust/pull/64151. Cc @estebank @varkor
2019-11-08Auto merge of #64882 - ehuss:stabilize-bare-extern, r=eddybbors-4/+67
Stabilize --extern flag without a path. This stabilizes the `--extern` flag without a path, implemented in #54116. This flag is used to add a crate that may be found in the search path to the extern prelude. The intent of stabilizing this now is to change Cargo to emit this flag for `proc_macro` when building a proc-macro crate. This will allow the ability to elide `extern crate proc_macro;` for proc-macros, one of the few places where it is still necessary. It is intended that Cargo may also use this flag for other cases in the future as part of the [std-aware work](https://github.com/rust-lang/wg-cargo-std-aware/). There will likely be some kind of syntax where users may declare dependencies on other crates (such as `alloc`), and Cargo will use this flag so that they may be used like any other crate. At this time there are no short-term plans to use it for anything other than proc-macro. This will not help for non-proc-macro crates that use `proc_macro`, which I believe is not too common? An alternate approach for proc-macro is to use the `meta` crate, but from my inquiries there doesn't appear to be anyone interested in pushing that forward. The `meta` crate also doesn't help with things like `alloc` or `test`. cc #57288
2019-11-07Add test for --extern alloc=librustc.rlibEric Huss-0/+7
2019-11-07Update src/test/ui-fulldeps/pathless-extern-unstable.rs Eric Huss-1/+1
Add ERROR Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com>
2019-11-07Add more --extern tests.Eric Huss-1/+59
2019-11-07Stabilize --extern flag without a path.Eric Huss-3/+1
2019-11-07Rollup merge of #66182 - RalfJung:invalid-value, r=CentrilMazdak Farrokhzad-35/+35
invalid_value lint: fix help text Now that we also warn about `MaybUninit::uninit().assume_init()`, just telling people "use `MaybeUninit`" isn't always sufficient. And anyway this seems like an important enough point to mention it here.
2019-11-07Rollup merge of #66087 - tmiasko:ui-mode, r=CentrilMazdak Farrokhzad-328/+324
Update some build-pass ui tests to use check-pass where applicable Helps with issue https://github.com/rust-lang/rust/issues/62277.
2019-11-07Rollup merge of #65916 - Centril:split-syntax-3, r=davidtwcoMazdak Farrokhzad-3/+4
syntax: move stuff around Part of https://github.com/rust-lang/rust/pull/65324. r? @davidtwco cc @estebank @petrochenkov
2019-11-07Rollup merge of #63793 - oli-obk:🧹, r=dtolnayMazdak Farrokhzad-30/+25
Have tidy ensure that we document all `unsafe` blocks in libcore cc @rust-lang/libs I documented a few and added ignore flags on the other files. We can incrementally document the files, but won't regress any files this way.