about summary refs log tree commit diff
path: root/src/test/ui/span
AgeCommit message (Collapse)AuthorLines
2018-01-17Rollup merge of #47471 - estebank:point-to-method-e0283, r=pnkfelixGuillaume Gomez-1/+5
On E0283, point at method with the requirements On required type annotation diagnostic error, point at method with the requirements if the span is available. CC #45453.
2018-01-15On E0283, point at method with the requirementsEsteban Küber-1/+5
On required type annotation diagnostic error, point at method with the requirements if the span is available.
2018-01-15Add error code for unstable feature errorsGuillaume Gomez-4/+4
2018-01-14syntax: Rewrite parsing of implsVadim Petrochenkov-0/+53
Properly parse impls for the never type `!` Recover from missing `for` in `impl Trait for Type` Prohibit inherent default impls and default impls of auto traits Change wording in more diagnostics to use "auto traits" Some minor code cleanups in the parser
2018-01-06type error method suggestions use whitelisted identity-like conversionsZack M. Davis-6/+4
Previously, on a type mismatch (and if this wasn't preëmpted by a higher-priority suggestion), we would look for argumentless methods returning the expected type, and list them in a `help` note. This had two major shortcomings. Firstly, a lot of the suggestions didn't really make sense (if you used a &str where a String was expected, `.to_ascii_uppercase()` is probably not the solution you were hoping for). Secondly, we weren't generating suggestions from the most useful traits! We address the first problem with an internal `#[rustc_conversion_suggestion]` attribute meant to mark methods that keep the "same value" in the relevant sense, just converting the type. We address the second problem by making `FnCtxt.probe_for_return_type` pass the `ProbeScope::AllTraits` to `probe_op`: this would seem to be safe because grep reveals no other callers of `probe_for_return_type`. Also, structured suggestions are preferred (because they're pretty, but also for RLS and friends). Also also, we make the E0055 autoderef recursion limit error use the one-time-diagnostics set, because we can potentially hit the limit a lot during probing. (Without this, test/ui/did_you_mean/recursion_limit_deref.rs would report "aborting due to 51 errors"). Unfortunately, the trait probing is still not all one would hope for: at a minimum, we don't know how to rule out `into()` in cases where it wouldn't actually work, and we don't know how to rule in `.to_owned()` where it would. Issues #46459 and #46460 have been filed and are ref'd in a FIXME. This is hoped to resolve #42929, #44672, and #45777.
2018-01-03Auto merge of #47127 - EdSchouten:cloudabi-tests, r=kennytmbors-2/+4
First cut at getting some part of the test suite working for CloudABI I am currently working on creating a Docker container for automated CI for CloudABI. Here are some of the trivial changes that need to land to make tests pass.
2018-01-03Only bump error count when we are sure that the diagnostic is not a repetition.Rafael Fernández López-1/+1
This ensures that if we emit the same diagnostic twice, the error count will match the real number of errors shown to the user. Fixes #42106
2018-01-02Correct for changes in line numbers in expected stderr output.Ed Schouten-2/+2
Due to the disable-cloudabi tags being added to the source files, the expected output of the compiler is altered slightly.
2018-01-02Add 'ignore-cloudabi' to tests that don't and won't build on CloudABI.Ed Schouten-0/+2
It looks like many of these tests are already disabled on emscripten, which also doesn't seem to support environment variables and subprocess spawning. Just add a similar tag for CloudABI. While there, sort some of the lists of operating systems alphabetically.
2017-12-31Reword trying to operate in immutable fieldsEsteban Küber-2/+2
The previous message ("cannot assign/mutably borrow immutable field") when trying to modify a field of an immutable binding gave the (incorrect) impression that fields can be mutable independently of their ADT's binding. Slightly reword the message to read "cannot assign/mutably borrow field of immutable binding".
2017-12-21Rollup merge of #46860 - estebank:candidate-def-sp, r=petrochenkovGuillaume Gomez-14/+10
Use def span for associated function suggestions
2017-12-19Use def span for associated function suggestionsEsteban Küber-14/+10
2017-12-19Point at def span in "missing in impl" errorEsteban Küber-52/+21
2017-12-18Tweak "unecessary unsafe block" error spansEsteban Küber-65/+22
2017-12-15Same change to point at borrow for mir errorsEsteban Küber-38/+39
2017-12-14Point at var in short lived borrowsEsteban Küber-359/+404
2017-12-14Remove NOTE/HELP annotations from UI testsVadim Petrochenkov-206/+118
2017-12-14Auto merge of #46633 - estebank:arg-mismatch, r=arielb1bors-15/+15
Point at whole method call instead of args To avoid confusion in cases where the code is ```rust fn foo() {} / foo( | bar() | ^^^ current diagnostics point here for arg count mismatch | ); |_^ new diagnostic span points here ``` as this leads to confusion making people think that the diagnostic is talking about `bar`'s arg count, not `foo`'s. Point at `fn`s definition on arg mismatch, just like we do for closures. Re #42855, Fix #45633.
2017-12-10Point at whole method call instead of argsEsteban Küber-15/+15
To avoid confusion in cases where the code is ```rust fn foo() {} / foo( | bar() | ^^^ current diagnostics point here for arg count mismatch | ); |_^ new diagnostic span points here ``` as this leads to confusion making people think that the diagnostic is talking about `bar`'s arg count, not `foo`'s. Point at `fn`s definition on arg mismatch, just like we do for closures.
2017-12-10Update ui tests' line numbers.Tommy Ip-9/+9
2017-12-10Add must-compile-successfully comment to appropriate ui tests.Tommy Ip-0/+4
2017-12-01Use suggestions instead of notes ref mismatchesEsteban Küber-5/+9
On type mismatch errors, use a suggestion when encountering minimal differences in type differences due to refs, instead of a note.
2017-11-29Rollup merge of #46287 - SimonSapin:stable-constness, r=aturonkennytm-3/+3
Stabilize const-calling existing const-fns in std Fixes #46038
2017-11-26Stabilize const-calling existing const-fns in stdSimon Sapin-3/+3
Fixes #46038
2017-11-26mention nightly in -Z external-macro-backtrace noteAlex Burka-4/+4
2017-11-24Merge cfail and ui tests into ui testsOliver Schneider-297/+314
2017-11-23Auto merge of #46024 - estebank:no-variant, r=petrochenkovbors-0/+3
Use the proper term when using non-existing variant When using a non-existing variant, function or associated item, refer to the proper term, instead of defaulting to "associated item" in diagnostics. Fix #28972. ``` error[E0599]: no variant named `Quux` found for type `Foo` in the current scope --> file.rs:7:9 | 7 | Foo::Quux(..) =>(), | ^^^^^^^^^^^^^ ```
2017-11-21Auto merge of #45879 - nikomatsakis:nll-kill-cyclic-closures, r=arielb1bors-3/+0
move closure kind, signature into `ClosureSubsts` Instead of using side-tables, store the closure-kind and signature in the substitutions themselves. This has two key effects: - It means that the closure's type changes as inference finds out more things, which is very nice. - As a result, it avoids the need for the `freshen_closure_like` code (though we still use it for generators). - It avoids cyclic closures calls. - These were never meant to be supported, precisely because they make a lot of the fancy inference that we do much more complicated. However, due to an oversight, it was previously possible -- if challenging -- to create a setup where a closure *directly* called itself (see e.g. #21410). We have to see what the effect of this change is, though. Needs a crater run. Marking as [WIP] until that has been assessed. r? @arielb1
2017-11-21Auto merge of #45701 - cramertj:impl-trait-this-time, r=eddybbors-24/+0
impl Trait Lifetime Handling This PR implements the updated strategy for handling `impl Trait` lifetimes, as described in [RFC 1951](https://github.com/rust-lang/rfcs/blob/master/text/1951-expand-impl-trait.md) (cc #42183). With this PR, the `impl Trait` desugaring works as follows: ```rust fn foo<T, 'a, 'b, 'c>(...) -> impl Foo<'a, 'b> { ... } // desugars to exists type MyFoo<ParentT, 'parent_a, 'parent_b, 'parent_c, 'a, 'b>: Foo<'a, 'b>; fn foo<T, 'a, 'b, 'c>(...) -> MyFoo<T, 'static, 'static, 'static, 'a, 'b> { ... } ``` All of the in-scope (parent) generics are listed as parent generics of the anonymous type, with parent regions being replaced by `'static`. Parent regions referenced in the `impl Trait` return type are duplicated into the anonymous type's generics and mapped appropriately. One case came up that wasn't specified in the RFC: it's possible to write a return type that contains multiple regions, neither of which outlives the other. In that case, it's not clear what the required lifetime of the output type should be, so we generate an error. There's one remaining FIXME in one of the tests: `-> impl Foo<'a, 'b> + 'c` should be able to outlive both `'a` and `'b`, but not `'c`. Currently, it can't outlive any of them. @nikomatsakis and I have discussed this, and there are some complex interactions here if we ever allow `impl<'a, 'b> SomeTrait for AnonType<'a, 'b> { ... }`, so the plan is to hold off on this until we've got a better idea of what the interactions are here. cc #34511. Fixes #44727.
2017-11-20address review commentsAlex Burka-4/+4
2017-11-19use -Z flag instead of env varAlex Burka-4/+4
2017-11-19update UI testsAlex Burka-4/+4
2017-11-18give better error messages when a cycle arisesNiko Matsakis-3/+0
2017-11-17Fix impl Trait Lifetime HandlingTaylor Cramer-24/+0
After this change, impl Trait existentials are desugared to a new `abstract type` definition paired with a set of lifetimes to apply. In-scope generics are included as parents of the `abstract type` generics. Parent regions are replaced with static, and parent regions referenced in the `impl Trait` type are duplicated at the end of the `abstract type`'s generics.
2017-11-16Remove left over dead code from suggestion diagnostic refactoringOliver Schneider-6/+0
2017-11-15Point to ADT definition when not finding variant, method, assoc typeEsteban Küber-0/+3
2017-11-12Auto merge of #45870 - mikeyhew:arbitrary_self_types, r=arielb1bors-4/+4
Implement arbitrary_self_types r? @arielb1 cc @nikomatsakis Partial implementation of #44874. Supports trait and struct methods with arbitrary self types, as long as the type derefs (transitively) to `Self`. Doesn't support raw-pointer `self` yet. Methods with non-standard self types (i.e. anything other than `&self, &mut self, and Box<Self>`) are not object safe, because dynamic dispatch hasn't been implemented for them yet. I believe this is also a (partial) fix for #27941.
2017-11-10Auto merge of #45785 - arielb1:unsafe-fixes, r=eddybbors-8/+8
fixes to MIR effectck r? @eddyb beta-nominating because regression (MIR effectck is new)
2017-11-09Don't emit the feature error if it's an invalid self typeMichael Hewson-10/+1
2017-11-08update ui test to new error messageMichael Hewson-5/+14
2017-11-07Update invalid inline arg test.Michael Woerister-1/+3
2017-11-06collect unused unsafe codeAriel Ben-Yehuda-8/+8
FIXME: de-uglify
2017-10-31rustc_typeck: use subtyping on the LHS of binops.Eduard-Mihai Burtescu-1/+1
2017-10-25Update ui tests for error message deduplication.Michael Woerister-6/+0
2017-10-13Pass the full span for method callsGeoffry Song-13/+49
2017-09-29Auto merge of #44847 - estebank:unused-signature, r=nikomatsakisbors-0/+76
Point at signature on unused lint ``` warning: struct is never used: `Struct` --> $DIR/unused-warning-point-at-signature.rs:22:1 | 22 | struct Struct { | ^^^^^^^^^^^^^ ``` Fix #33961.
2017-09-25Point at signature on unused lintEsteban Küber-0/+76
2017-09-21suggest an outer attribute when `#![derive(...)]` (predictably) failsZack M. Davis-1/+1
2017-09-21only set non-ADT derive error once per attribute, not per traitZack M. Davis-0/+24
A slight eccentricity of this change is that now non-ADT-derive errors prevent derive-macro-not-found errors from surfacing (see changes to the gating-of-derive compile-fail tests). Resolves #43927.
2017-09-21Auto merge of #44215 - oli-obk:import_sugg, r=nrcbors-1/+1
don't suggest placing `use` statements into expanded code r? @nrc fixes #44210 ```rust #[derive(Debug)] struct Foo; type X = Path; ``` will try to place `use std::path::Path;` between `#[derive(Debug)]` and `struct Foo;` I am not sure how to obtain a span before the first attribute, because derive attributes are removed during expansion. It would be trivial to detect this case and place the `use` after the item, but that would be somewhat weird I think.