about summary refs log tree commit diff
path: root/src/test/ui
AgeCommit message (Collapse)AuthorLines
2018-06-27Fix the error of selecting obligation by not running the borrow checker.Vytautas Astrauskas-6/+31
2018-06-27Move regression test from `compile-fail/` to `ui/` test directory.Felix S. Klock II-0/+36
2018-06-27Implement `#[macro_export(local_inner_macros)]`Vadim Petrochenkov-0/+91
2018-06-27Auto merge of #51773 - oli-obk:cleanup_impl_trait, r=nikomatsakisbors-105/+18
Don't inspect the generated existential type items r? @nikomatsakis My debugging led me to the `hir::ItemExistential(..)` checks, which are entirely unnecessary because we never use the items directly. The issue was that items were iterated over in a random order (due to hashmaps), so if you checked the `ItemExistential` before the function that has the actual return `impl Trait`, you'd run into those ICEs you encountered.
2018-06-26inclusive range syntax lint (`...` → `..=`)Zack M. Davis-2/+84
Our implementation ends up changing the `PatKind::Range` variant in the AST to take a `Spanned<RangeEnd>` instead of just a `RangeEnd`, because the alternative would be to try to infer the span of the range operator from the spans of the start and end subexpressions, which is both hideous and nontrivial to get right (whereas getting the change to the AST right was a simple game of type tennis). This is concerning #51043.
2018-06-26migrate codebase to `..=` inclusive range patternsZack M. Davis-20/+20
These were stabilized in March 2018's #47813, and are the Preferred Way to Do It going forward (q.v. #51043).
2018-06-26Don't inspect the generated existential type itemsOliver Schneider-105/+18
2018-06-26Rollup merge of #51789 - estebank:issue-50577, r=oli-obkPietro Albini-0/+28
Don't ICE when performing `lower_pattern_unadjusted` on a `TyError` Fix #50577. CC #51696. r? @oli-obk
2018-06-26Rollup merge of #51747 - varkor:export_name-null-character, r=estebankPietro Albini-1/+24
Add error for using null characters in #[export_name] Fixes #51741.
2018-06-26Rollup merge of #51731 - varkor:closure-array-break-length, r=estebankPietro Albini-0/+39
Fix ICEs when using continue as an array length inside closures (inside loop conditions) Fixes #51707. Fixes #51708. r? @estebank
2018-06-26Rollup merge of #51104 - zackmdavis:dynamo, r=nikomatsakisPietro Albini-84/+84
add `dyn ` to display of dynamic (trait) types ~~I'm not sure we want the `dyn` in the E0277 "trait bound [...] is not satisfied" messages ("bound" sounds like a different thing in contrast to the names of specific trait-object types like `Box<dyn Trait>`), but I'm finding the code I would need to change that hard to follow—the [display object seems to](https://github.com/rust-lang/rust/blob/f0805a4421449bd6fe3096d63820fbebe2bfcd1d/src/librustc/traits/error_reporting.rs#L600) be a [`Predicate::Trait`](https://github.com/rust-lang/rust/blob/f0805a4421449bd6fe3096d63820fbebe2bfcd1d/src/librustc/ty/mod.rs#L962) variant, whose [`Display` implementation](https://github.com/rust-lang/rust/blob/f0805a4421449bd6fe3096d63820fbebe2bfcd1d/src/librustc/util/ppaux.rs#L1309) calls `.print` on its `PolyTraitPredicate` member, [which is a type alias](https://github.com/rust-lang/rust/blob/f0805a4421449bd6fe3096d63820fbebe2bfcd1d/src/librustc/ty/mod.rs#L1112) for `ty::Binder<TraitPredicate<'tcx>>`, whose [`Display` implementation](https://github.com/rust-lang/rust/blob/f0805a4421449bd6fe3096d63820fbebe2bfcd1d/src/librustc/util/ppaux.rs#L975-L985) ... _&c._— so maybe it's time to pull-request this and see what reviewers think.~~ Resolves #49277 (?). r? @nikomatsakis
2018-06-26Auto merge of #50966 - leodasvacas:self-in-where-clauses-is-not-object-safe, ↵bors-0/+46
r=nikomatsakis `Self` in where clauses may not be object safe Needs crater, virtually certain to cause regressions. In #50781 it was discovered that our object safety rules are not sound because we allow `Self` in where clauses without restrain. This PR is a direct fix to the rules so that we disallow methods with unsound where clauses. This currently uses hard error to measure impact, but we will want to downgrade it to a future compat error. Part of #50781. r? @nikomatsakis
2018-06-25Don't ICE when performing `lower_pattern_unadjusted` on a `TyError`Esteban Küber-0/+28
2018-06-25Auto merge of #51750 - zackmdavis:superstructure, r=oli-obkbors-11/+171
three diagnostics upgrades * reword `...` expression syntax error to not imply that you should use it in patterns either (#51043) and make it a structured suggestion * shorten the top-line message for the trivial-casts lint by tucking the advisory sentence into a help note * structured suggestion for pattern-named-the-same-as-variant warning r? @oli-obk
2018-06-25Fill in tracking issue for WHERE_CLAUSES_OBJECT_SAFETY future compat lintleonardo.yvens-1/+1
2018-06-25Make where clause object safety be a warn-by-default lintleonardo.yvens-8/+16
2018-06-25`Self` in where clauses may not be object safeleonardo.yvens-0/+38
This is virtually certain to cause regressions, needs crater. In #50781 it was discovered that our object safety rules are not sound because we allow `Self` in where clauses without restrain. This PR is a direct fix to the rules so that we disallow methods with unsound where clauses. This currently uses hard error to measure impact, but we will want to downgrade it to a future compat error. Fixes #50781. r? @nikomatsakis
2018-06-25Auto merge of #51335 - mark-i-m:allocator, r=oli-obkbors-0/+48
Prohibit `global_allocator` in submodules Background: #44113 is caused by weird interactions with hygiene. Hygiene is hard. After a lot of playing around, we decided that the best path forward would be to prohibit `global_allocator`s from being in submodules for now. When somebody gets it working, we can re-enable it. This PR contains the following - Some hygiene "fixes" -- things I suspect are the correct thing to do that will make life easier in the future. This includes using call_site hygiene for the generated module and passing the correct crate name to the expansion config. - Comments and minor formatting fixes - Some debugging code - Code to prohibit `global_allocator` in submodules - Test checking that the proper error occurs. cc #44113 #49320 #51241 r? @alexcrichton
2018-06-25Auto merge of #51688 - spastorino:error-note-field-after-move, r=nikomatsakisbors-9/+41
Fix erroneous error note when using field after move Closes #51512 r? @nikomatsakis
2018-06-24actually fix testmark-1/+1
2018-06-24fix testmark-4/+7
2018-06-24Prohibit global_allocator in submodules for nowMark Mansi-1/+9
- we need to figure out hygiene first - change the test to check that the prohibition works with a good error msg - leaves some comments and debugging code - leaves some of our supposed fixes
2018-06-24Attempt to fix hygiene for global_allocatorMark Mansi-0/+37
2018-06-23in which the trivial-casts word to the wise is tucked into a help noteZack M. Davis-0/+95
The top level message shouldn't be too long; the replaced-by-coercion/temporary-variable advice can live in a note. Also, don't mention type ascription when it's not actually available as a real thing. (The current state of discussion on the type ascription tracking issue #23416 makes one rather suspect it will never be a stable thing in its current form, but that's not for us to adjudicate in this commit.) While we're here, yank out the differentiating parts of the numeric/other conditional and only have one codepath emitting the diagnostic.
2018-06-23structured suggestion and rewording for `...` expression syntax errorZack M. Davis-0/+30
Now that `..=` inclusive ranges are stabilized, people probably shouldn't be using `...` even in patterns, even if it's still legal there (see #51043). To avoid drawing attention to `...` being a real thing, let's reword this message to just say "unexpected token" rather "cannot be used in expressions".
2018-06-23use structured suggestion for pattern-named-the-same-as-variant warningZack M. Davis-11/+46
2018-06-23add `dyn` to display of dynamic (trait) type namesZack M. Davis-84/+84
The `dyn Trait` syntax was stabilized in 199ee327. Resolves #49277.
2018-06-24Add backticks to E0558varkor-1/+1
2018-06-23Add error for using null characters in export_namevarkor-0/+23
2018-06-23Fix error code numbersGuillaume Gomez-5/+5
2018-06-23Add a test for breakvarkor-1/+9
2018-06-23Fix an ICE with continue inside a closure inside a loop conditionvarkor-2/+11
2018-06-23Fix an ICE with `continue` as an array lengthvarkor-0/+22
2018-06-23Auto merge of #51723 - estebank:abolish-ice, r=oli-obkbors-0/+34
Accept `TyError` in `analyze_closure` to avoid ICE Fix #51714.
2018-06-23Auto merge of #51580 - cramertj:async-await, r=eddybbors-14/+195
async/await This PR implements `async`/`await` syntax for `async fn` in Rust 2015 and `async` closures and `async` blocks in Rust 2018 (tracking issue: https://github.com/rust-lang/rust/issues/50547). Limitations: non-`move` async closures with arguments are currently not supported, nor are `async fn` with multiple different input lifetimes. These limitations are not fundamental and will be removed in the future, however I'd like to go ahead and get this PR merged so we can start experimenting with this in combination with futures 0.3. Based on https://github.com/rust-lang/rust/pull/51414. cc @petrochenkov for parsing changes. r? @eddyb
2018-06-23Auto merge of #51696 - estebank:fuzzy-ice-ice, r=oli-obkbors-0/+28
Accept `TyError` in patterns to avoid ICE on bad input Fix #50585.
2018-06-23Auto merge of #51697 - estebank:once-used-lifetime-label, r=oli-obkbors-8/+30
Add label to lint for lifetimes used once ``` error: lifetime parameter `'a` only used once --> $DIR/fn-types.rs:19:10 | LL | a: for<'a> fn(&'a u32), //~ ERROR `'a` only used once | ^^ -- ...is used only here | | | this lifetime... ```
2018-06-22Accept `TyError` in `analyze_closure` to avoid ICEEsteban Küber-0/+34
2018-06-22Fix erroneous error note when using field after moveSantiago Pastorino-9/+41
2018-06-22Review nits and updatesTaylor Cramer-5/+5
Move future_from_generator out of raw Update await to use $crate Renumber errors
2018-06-22Auto merge of #51670 - estebank:issue-51634, r=oli-obkbors-3/+69
Don't suggest incorrect syntax Fix #51634.
2018-06-22Issue #50974: Fix compilation error and testLamb-1/+1
2018-06-22Issue #50974: Adding issue number in the testLamb-1/+3
2018-06-22Issue #50974: Adding testsLamb-0/+38
2018-06-22Auto merge of #51686 - ↵bors-0/+42
nikomatsakis:issue-51415-borrowck-match-default-bindings-bug, r=eddyb yet another "old borrowck" bug around match default bindings We were getting the type of the parameter from its pattern, but that didn't include adjustments. I did a `ripgrep` around and this seemed to be the only affected case. The reason this didn't show up as an ICE earlier is that mem-categorization is lenient with respect to weird discrepancies. I am going to add more delay-span-bug calls shortly around that (I'll push onto the PR). This example is an ICE, but I presume that there is a way to make a soundness example out of this -- it basically ignores borrows occuring inside match-default-bindings in a closure, though only if the implicit deref is at the top-level. It happens though that this occurs frequently in iterators, which often give a `&T` parameter. Fixes #51415 Fixes #49534 r? @eddyb
2018-06-21Explicitly ban async in trait implsTaylor Cramer-4/+4
This wouldn't compile before because the return type wouldn't match, but now it's properly an error.
2018-06-21Async methodsTaylor Cramer-1/+1
2018-06-21async await desugaring and testsTaylor Cramer-10/+191
2018-06-22Auto merge of #51463 - estebank:error-codes, r=nikomatsakisbors-208/+311
Various changes to existing diagnostics * [Add code to `invalid ABI` error, add span label, move list to help to make message shorter](https://github.com/rust-lang/rust/pull/51463/commits/23ae5af274defa9ff884f593e44a2bbcaf814a02): ``` error[E0697]: invalid ABI: found `路濫狼á́́` --> $DIR/unicode.rs:11:8 | LL | extern "路濫狼á́́" fn foo() {} //~ ERROR invalid ABI | ^^^^^^^^^ invalid ABI | = help: valid ABIs: cdecl, stdcall, fastcall, vectorcall, thiscall, aapcs, win64, sysv64, ptx-kernel, msp430-interrupt, x86-interrupt, Rust, C, system, rust-intrinsic, rust-call, platform-intrinsic, unadjusted ``` * [Add code to incorrect `pub` restriction error](https://github.com/rust-lang/rust/pull/51463/commits/e96fdea8a38f39f99f8b9a4000a689187a457e08) * [Add message to `rustc_on_unimplemented` attributes in core to have them set a custom message _and_ label](https://github.com/rust-lang/rust/pull/51463/commits/2cc7e5ed307aee936c20479cfdc7409d6b52a464): ``` error[E0277]: `W` does not have a constant size known at compile-time --> $DIR/unsized-enum2.rs:33:8 | LL | VA(W), | ^ `W` does not have a constant size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `W` = help: consider adding a `where W: std::marker::Sized` bound = note: no field of an enum variant may have a dynamically sized type ``` ``` error[E0277]: `Foo` cannot be sent between threads safely --> $DIR/E0277-2.rs:26:5 | LL | is_send::<Foo>(); | ^^^^^^^^^^^^^^ `Foo` cannot be sent between threads safely | = help: the trait `std::marker::Send` is not implemented for `Foo` ``` ``` error[E0277]: can't compare `{integer}` with `std::string::String` --> $DIR/binops.rs:16:7 | LL | 5 < String::new(); | ^ no implementation for `{integer} < std::string::String` and `{integer} > std::string::String` | = help: the trait `std::cmp::PartialOrd<std::string::String>` is not implemented for `{integer}` ``` ``` error[E0277]: can't compare `{integer}` with `std::result::Result<{integer}, _>` --> $DIR/binops.rs:17:7 | LL | 6 == Ok(1); | ^^ no implementation for `{integer} == std::result::Result<{integer}, _>` | = help: the trait `std::cmp::PartialEq<std::result::Result<{integer}, _>>` is not implemented for `{integer}` ``` ``` error[E0277]: a collection of type `i32` cannot be built from an iterator over elements of type `i32` --> $DIR/type-check-defaults.rs:16:19 | LL | struct WellFormed<Z = Foo<i32, i32>>(Z); | ^ a collection of type `i32` cannot be built from `std::iter::Iterator<Item=i32>` | = help: the trait `std::iter::FromIterator<i32>` is not implemented for `i32` note: required by `Foo` --> $DIR/type-check-defaults.rs:15:1 | LL | struct Foo<T, U: FromIterator<T>>(T, U); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ``` * [Add link to book for `Sized` errors](https://github.com/rust-lang/rust/pull/51463/commits/1244dc7c283323aea1a3457a4458d590a3e160c8): ``` error[E0277]: `std::fmt::Debug + std::marker::Sync + 'static` does not have a constant size known at compile-time --> $DIR/const-unsized.rs:13:29 | LL | const CONST_0: Debug+Sync = *(&0 as &(Debug+Sync)); | ^^^^^^^^^^^^^^^^^^^^^^ `std::fmt::Debug + std::marker::Sync + 'static` does not have a constant size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `std::fmt::Debug + std::marker::Sync + 'static` = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types--sized> = note: constant expressions must have a statically known size ``` * [Point to previous line for single expected token not found](https://github.com/rust-lang/rust/pull/51463/commits/48165168fb0f059d8536cd4a2276b609d4a7f721) (if the current token is in a different line)
2018-06-21Add label to lint for lifetimes used onceEsteban Küber-8/+30