about summary refs log tree commit diff
path: root/src/test/compile-fail
AgeCommit message (Collapse)AuthorLines
2017-09-19Adjust dependency-resolution errors to be more consistentSamuel Holland-2/+2
2017-09-19Auto merge of #44026 - QuietMisdreavus:trimmed-std, r=steveklabnikbors-0/+14
hide internal types/traits from std docs via new #[doc(masked)] attribute Fixes #43701 (hopefully for good this time) This PR introduces a new parameter to the `#[doc]` attribute that rustdoc looks for on `extern crate` statements. When it sees `#[doc(masked)]` on such a statement, it hides traits and types from that crate from appearing in either the "Trait Implementations" section of many type pages, or the "Implementors" section of trait pages. This is then applied to the `libc`/`rand`/`compiler_builtins` imports in libstd to prevent those crates from creating broken links in the std docs. Like in #43348, this also introduces a feature gate, `doc_masked`, that controls the use of this parameter. To view the std docs generated with this change, head to https://tonberry.quietmisdreavus.net/std-43701/std/index.html.
2017-09-16Rollup merge of #44590 - oli-obk:allow_unused_mut_on_vars, r=eddybAlex Crichton-0/+8
Get `allow(unused_mut)` to work on `let` bindings fixes #40491
2017-09-16change #![feature(const_fn)] to specific gatesAlex Burka-44/+5
2017-09-16`--cap-lints allow` switches off `can_emit_warnings`Zack M. Davis-0/+22
This boolean field on the error `Handler` is toggled to silence warnings when `-A warnings` is passed. (This is actually a separate mechanism from the global lint level—whether there's some redundancy to be factored away here is an important question, but not one we concern ourselves with in this commit.) But the same rationale applies for `--cap-lints allow`. In particular, this makes the "soft" feature-gate warning introduced in 8492ad24 (which is not a lint, but just calls `struct_span_warn`) not pollute the builds of dependent crates. Thanks to @kennytm for pointing out the potential of `can_emit_warnings` for this purpose. Resolves #44213.
2017-09-15Get `allow(unused_mut)` to work on `let` bindingsOliver Schneider-0/+8
fixes #40491
2017-09-13honor #[rustc_const_unstable] attributesAlex Burka-2/+52
2017-09-13Auto merge of #44456 - eddyb:stable-drop-const, r=nikomatsakisbors-80/+7
Stabilize drop_types_in_const. Closes #33156, stabilizing the new, revised, rules, and improving the error message. r? @nikomatsakis cc @SergioBenitez
2017-09-12Auto merge of #44275 - eddyb:deferred-ctfe, r=nikomatsakisbors-11/+35
Evaluate fixed-length array length expressions lazily. This is in preparation for polymorphic array lengths (aka `[T; T::A]`) and const generics. We need deferred const-evaluation to break cycles when array types show up in positions which require knowing the array type to typeck the array length, e.g. the array type is in a `where` clause. The final step - actually passing bounds in scope to array length expressions from the parent - is not done because it still produces cycles when *normalizing* `ParamEnv`s, and @nikomatsakis' in-progress lazy normalization work is needed to deal with that uniformly. However, the changes here are still useful to unlock work on const generics, which @EpicatSupercell manifested interest in, and I might be mentoring them for that, but we need this baseline first. r? @nikomatsakis cc @oli-obk
2017-09-11Auto merge of #44442 - Aaron1011:promote-static-ref, r=eddybbors-0/+16
Fix regression in promotion of rvalues referencing a static This commit makes librustc_passes::consts::CheckCrateVisitor properly mark expressions as promotable if they reference a static, as it's perfectly fine for one static to reference another. It fixes a regression that prevented a temporary rvalue from referencing a static if it was itself declared within a static. Prior to commit https://github.com/rust-lang/rust/commit/b8c05fe90bc, `region::ScopeTree` would only register a 'terminating scope' for function bodies. Thus, while rvalues in a static that referenced a static would be marked unpromotable, the lack of enclosing scope would cause mem_categorization::MemCategorizationContext::cat_rvalue_node to compute a 'temporary scope' of `ReStatic`. Since this had the same effect as explicitly selecting a scope of `ReStatic` due to the rvalue being marked by CheckCrateVisitor as promotable, no issue occurred. However, commit https://github.com/rust-lang/rust/commit/b8c05fe90bc made ScopeTree unconditionally register a 'terminating scope' Since mem_categorization would now compute a non-static 'temporary scope', the aforementioned rvalues would be erroneously marked as living for too short a time. By fixing the behavior of CheckCrateVisitor, this commit avoids changing mem_categorization's behavior, while ensuring that temporary values in statics are still allowed to reference other statics. Fixes issue #44373
2017-09-11rustc: evaluate fixed-length array length expressions lazily.Eduard-Mihai Burtescu-11/+35
2017-09-10Auto merge of #44079 - gaurikholkar:named_conf, r=nikomatsakisbors-20/+16
Extend E0623 for LateBound and EarlyBound Regions This is a fix for #43882 ``` fn foo<'a,'b>(x: &mut Vec<&'a u8>, y: &'b u8) { x.push(y); } ``` now gives ``` error[E0623]: lifetime mismatch --> $DIR/ex3-both-anon-regions-latebound-regions.rs:12:12 | 11 | fn foo<'a,'b>(x: &mut Vec<&'a u8>, y: &'b u8) { | ------ ------ these two types are declared with different lifetimes... 12 | x.push(y); | ^ ...but data from `y` flows into `x` here ``` cc @nikomatsakis @arielb1 Please ignore the second commit. It will be merged in a separate PR.
2017-09-10Rollup merge of #44464 - Dushistov:master, r=alexcrichtonGuillaume Gomez-0/+16
add test for #41229 Closes #41229
2017-09-10Rollup merge of #44332 - tirr-c:issue-44021, r=petrochenkovGuillaume Gomez-0/+16
Expect pipe symbol after closure parameter list Fixes #44021. --- Originally, the parser just called `bump` to discard following token after parsing closure parameter list, because it assumes `|` is following. However, the following code breaks the assumption: ```rust struct MyStruct; impl MyStruct { fn f() {|x, y} } ``` Here, the parameter list is `x, y` and the following token is `}`. The parser discards `}`, and then we have a curly bracket mismatch. Indeed, this code has a syntax error. On current nightly, the compiler emits an syntax error, but with incorrect message and span, followed by an ICE. ``` error: expected expression, found `}` --> 44021.rs:4:1 | 4 | } | ^ error: internal compiler error: unexpected panic ``` Even worse, on current stable(1.20.0), the compiler falls into an infinite loop. This pull request fixes this problem. Now the compiler emits correct error message and span, and does not ICE. ``` error: expected one of `:`, `@`, or `|`, found `}` --> 44021.rs:3:20 | 3 | fn foo() {|x, y} | ^ expected one of `:`, `@`, or `|` here ```
2017-09-10Rollup merge of #44262 - alexcrichton:repr-128-gate, r=nikomatsakisGuillaume Gomez-0/+17
rustc: Separately feature gate repr(i128) Brought up during the discussion of #35118, the support for this is still somewhat buggy and so stabilization likely wants to be considered independently of the type itself.
2017-09-09add test for #41229Evgeniy A. Dushistov-0/+16
Closes #41229
2017-09-09Don't promote references to statics that occur in non-static locationsAaron Hill-0/+16
2017-09-09Stabilize drop_types_in_const.Eduard-Mihai Burtescu-80/+7
2017-09-09Auto merge of #44212 - eddyb:drop-const, r=nikomatsakisbors-3/+10
Allow Drop types in const's too, with #![feature(drop_types_in_const)]. Implements the remaining amendment, see #33156. cc @SergioBenitez r? @nikomatsakis
2017-09-09adding E0623 for LateBound regionsgaurikholkar-20/+16
2017-09-08Auto merge of #44142 - alexcrichton:dllimport-query, r=nikomatsakisbors-12/+28
Migrate a slew of metadata methods to queries This PR intends to make more progress on #41417, knocking off some low-hanging fruit. Closes #44190 cc #44137
2017-09-07Auto merge of #43931 - eddyb:const-local-key, r=alexcrichtonbors-1/+1
Make the LocalKey facade of thread_local! inlineable cross-crate. Fixes (almost*) #25088 by changing the `LocalKey` `static` `thread_local!` generates to a `const`. This can be done because a `LocalKey` value holds no actual TLS data, only function pointers to get at said data, and it could even be made `Copy` without any negative consequences. The recent stabilization of rvalue promotion to `'static` allows doing this without changing the API. r? @alexcrichton *almost because we can't yet inline `__getit` because it breaks on MSVC, see https://github.com/rust-lang/rust/pull/43931#issuecomment-323534214
2017-09-06Rollup merge of #44317 - Dushistov:master, r=arielb1Mark Simulacrum-0/+13
Add test for #22706 Closes #22706
2017-09-05add feature gate doc_masked and testsQuietMisdreavus-0/+14
2017-09-05Fix misdetection of upstream intercrate ambiguity.Masaki Hara-2/+2
2017-09-05Add downstream tests for intercrate ambiguity hints.Masaki Hara-0/+64
2017-09-05Print more detailed trait-ref for intercrate ambiguity.Masaki Hara-4/+4
2017-09-05Add tests for intercrate ambiguity hints.Masaki Hara-1/+88
2017-09-05rustc: Move stability functionality into queriesAlex Crichton-12/+22
This commit primarily removes the `stability` field from `TyCtxt` as well as its internal mutable state, instead using a query to build the stability index as well as primarily using queries for other related lookups. Like previous commits the calculation of the stability index is wrapped in a `with_ignore` node to avoid regressing the current tests, and otherwise this commit also introduces #44232 but somewhat intentionally so.
2017-09-05rustc: Remove lang item methods from CrateStoreAlex Crichton-0/+2
Given the previous commit, these are now trivially representable as queries!
2017-09-05rustc: Remove a number of mutable fields in cstoreAlex Crichton-0/+4
This commit started by moving methods from `CrateStore` to queries, but it ended up necessitating some deeper refactorings to move more items in general to queries. Before this commit the *resolver* would walk over the AST and process foreign modules (`extern { .. }` blocks) and collect `#[link]` annotations. It would then also process the command line `-l` directives and such. This information was then stored as precalculated lists in the `CrateStore` object for iterating over later. After this, commit, however, this pass no longer happens during resolution but now instead happens through queries. A query for the linked libraries of a crate will crawl the crate for `extern` blocks and then process the linkage annotations at that time.
2017-09-05Expect pipe symbol after closure parameter listsWonwoo Choi-0/+16
2017-09-05Auto merge of #44248 - oli-obk:spans, r=jseyfriedbors-0/+5
Produce expansion info for more builtin macros r? @jseyfried fixes #43268
2017-09-04Add test for #22706Evgeniy A. Dushistov-0/+13
Closes #22706
2017-09-04Produce expansion info for more builtin macrosOliver Schneider-0/+5
2017-09-04Make the LocalKey facade of thread_local! inlineable cross-crate.Eduard-Mihai Burtescu-1/+1
2017-09-03Auto merge of #44261 - alexcrichton:u128-ffi-unsafe, r=eddybbors-1/+3
rustc: Flag {i,u}128 as unsafe for FFI These don't appear to have a stable ABI as noted in #41799 and the work in compiler-builtins definitely seems to be confirming it!
2017-09-03implement improved on_unimplemented directivesAriel Ben-Yehuda-1/+1
2017-09-02Allow Drop types in const's too, with #![feature(drop_types_in_const)].Eduard-Mihai Burtescu-3/+10
2017-09-01rustc: Flag {i,u}128 as unsafe for FFIAlex Crichton-1/+3
These don't appear to have a stable ABI as noted in #41799 and the work in compiler-builtins definitely seems to be confirming it!
2017-09-01rustc: Separately feature gate repr(i128)Alex Crichton-0/+17
Brought up during the discussion of #35118, the support for this is still somewhat buggy and so stabilization likely wants to be considered independently of the type itself.
2017-09-01Implement RFC 1925Matt Ickstadt-0/+36
2017-08-30Auto merge of #43932 - eddyb:const-scoping, r=nikomatsakisbors-1/+28
Forward-compatibly deny drops in constants if they *could* actually run. This is part of #40036, specifically the checks for user-defined destructor invocations on locals which *may not* have been moved away, the motivating example being: ```rust const FOO: i32 = (HasDrop {...}, 0).1; ``` The evaluation of constant MIR will continue to create `'static` slots for more locals than is necessary (if `Storage{Live,Dead}` statements are ignored), but it shouldn't be misusable. r? @nikomatsakis
2017-08-30Auto merge of #43880 - arielb1:noninvasive-probe, r=nikomatsakisbors-15/+0
Remove the trait selection impl in method::probe This removes the hacky trait selection reimplementation in `method::probe`, which occasionally comes and causes problems. There are 2 issues I've found with this approach: 1. The older implementation sometimes had a "guess" type from an impl, which allowed subtyping to work. This is why I needed to make a change in `libtest`: there's an `impl<A> Clone for fn(A)` and we're calling `<for<'a> fn(&'a T) as Clone>::clone`. The older implementation would do a subtyping between the impl type and the trait type, so it would do the check for `<fn(A) as Clone>::clone`, and confirmation would continue with the subtyping. The newer implementation directly passes `<for<'a> fn(&'a T) as Clone>::clone` to selection, which fails. I'm not sure how big of a problem that would be in reality, especially after #43690 would remove the `Clone` problem, but I still want a crater run to avoid breaking the world. 2. The older implementation "looked into" impls to display error messages. I'm not sure that's an advantage - it looked exactly 1 level deep. r? @eddyb
2017-08-29remove the hacky selection impl in `method::probe`Ariel Ben-Yehuda-15/+0
2017-08-29Auto merge of #44111 - zackmdavis:feature_attr_error_span, r=nikomatsakisbors-12/+10
feature error span on attribute for fn_must_use, SIMD/align reprs, macro reëxport There were several feature-gated attributes for which the feature-not-available error spans would point to the item annotated with the gated attribute, when it would make more sense for the span to point to the attribute itself: if the attribute is removed, the function/struct/_&c._ likely still makes sense and the program will compile. (Note that we decline to make the analogous change for the `main`, `start`, and `plugin_registrar` features, for in those cases it makes sense for the span to implicate the entire function, of which there is little hope of using without the gated attribute.) ![feature_attr_error_span](https://user-images.githubusercontent.com/1076988/29746531-fd700bfe-8a91-11e7-9c5b-6f5324083887.png)
2017-08-28feature error span on attr. for fn_must_use, SIMD/align, macro reëxportZack M. Davis-12/+10
There were several feature-gated attributes for which the feature-not-available error spans would point to the item annotated with the gated attribute, when it would make more sense for the span to point to the attribute itself: if the attribute is removed, the function/struct/&c. likely still makes sense and the program will compile. (Note that we decline to make the analogous change for the `main`, `start`, and `plugin_registrar` features, for in those cases it makes sense for the span to implicate the entire function, of which there is little hope of using without the gated attribute.)
2017-08-28rustc_mir: conservatively deny non-noop drops in constant contexts.Eduard-Mihai Burtescu-1/+28
2017-08-28Merge branch 'master' of https://github.com/rust-lang/rust into genJohn Kåre Alsaker-5/+60
2017-08-27Address review comments, second turnTatsuyuki Ishi-1/+13