about summary refs log tree commit diff
path: root/src/test
AgeCommit message (Collapse)AuthorLines
2019-11-21Rollup merge of #65730 - csmoe:return-lifetime, r=nikomatsakisMazdak Farrokhzad-8/+64
Suggest to add lifetime constraint at explicit ouput of functions Closes #62097
2019-11-21never_type: test interaction with auto traitsMazdak Farrokhzad-0/+16
2019-11-21Gate fallback via `#![feature(never_type_fallback)]`.Mazdak Farrokhzad-16/+47
2019-11-21Remove `#![feature(never_type)]` from tests.Mazdak Farrokhzad-277/+130
Also remove `never_type` the feature-gate test.
2019-11-20Rollup merge of #66573 - ↵Mazdak Farrokhzad-0/+1
pnkfelix:issue-66568-ignore-reproducible-build-2-on-macos, r=alexcrichton Ignore run-make reproducible-build-2 on Mac Ignore run-make reproducible-build-2 on Mac (we already ignore it on Windows). Until we can dedicate resources to fixing this properly, I think we are best off just ignoring this test on platforms/contexts where it does not matter as much. cc #66568
2019-11-20Rollup merge of #66535 - estebank:issue-62480, r=matthewjasperMazdak Farrokhzad-0/+18
Avoid ICE when `break`ing to an unreachable label Fix #62480.
2019-11-20Rollup merge of #66060 - traxys:test_65401, r=michaelwoeristerMazdak Farrokhzad-29/+37
Making ICEs and test them in incremental This adds: - A way to make the compiler ICE - A way to check for ICE in `cfail` tests with `should-ice` - A regression test for issue #65401 I am not sure the attribute added `should-ice` is the best for this job
2019-11-20Auto merge of #66571 - Centril:rollup-41tn2fw, r=Centrilbors-29/+100
Rollup of 8 pull requests Successful merges: - #65665 (Update Source Code Pro and include italics) - #66478 (rustc_plugin: Remove the compatibility shim) - #66497 (Fix #53820) - #66526 (Add more context to `async fn` trait error) - #66532 (Generate DWARF address ranges for faster lookups) - #66546 (Remove duplicate function) - #66548 ([RISCV] Disable Atomics on all Non-A RISC-V targets) - #66553 (remove HermitCore leftovers from sys/unix) Failed merges: r? @ghost
2019-11-20Ignore run-make reproducible-build-2 on Mac (we already ignore it on Windows).Felix S. Klock II-0/+1
Until we can dedicate resources to fixing this properly, I think we are best off just ignoring this test on platforms/contexts where it does not matter as much.
2019-11-20Rollup merge of #66526 - estebank:async-fn-trait-information, r=CentrilMazdak Farrokhzad-1/+33
Add more context to `async fn` trait error Follow up to #65937. Fix #65899.
2019-11-20Rollup merge of #66497 - Nadrieril:fix-53820, r=varkorMazdak Farrokhzad-28/+67
Fix #53820 This fixes ICE #53820 by being more clever when matching large arrays with slice patterns. In particular, it avoids treating large arrays like large tuples, and instead reuses the `VarLenSlice` constructor behaviour to only consider as little values as needed. As a side-effect, such matches also get improved diagnostics, by reporting `[true, ..]` missing instead of `[true, _, _, _, _, _, _, _]`.
2019-11-20Auto merge of #66392 - estebank:trait-alias-ice, r=eddybbors-0/+29
Do not ICE on trait aliases with missing obligations Fix #65673.
2019-11-20Auto merge of #66104 - yodaldevoid:generic-arg-disambiguation, r=petrochenkovbors-93/+73
Generic arg disambiguation Using the tactic suggested by @petrochenkov in https://github.com/rust-lang/rust/issues/60804#issuecomment-516769465 and on [zulip](https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/generic.20argument.20disambiguation), this change checks type arguments to see if they are really incorrectly-parsed const arguments. it should be noted that `segments.len() == 1 && segments[0].arg.is_none()` was reduced to `segments.len() == 1` as suggested by @petrochenkov in [zulip](https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/generic.20argument.20disambiguation/near/177848002). This change allowed a few more existing tests to have their braces removed. There are a couple of "problems" with these changes that I should note. First, there was a regression in the error messages found in "src/test/ui/privacy-ns1.rs" and "src/test/ui/privacy-ns1.rs". Second, some braces were unable to be removed from "src/test/ui/const-generics/fn-const-param-infer.rs". Those on line 24 caused the statement to stop equating when removed, and those on line 20 cause a statement that should not equate to produce no error when removed. I have not looked further into any of these issues yet, though I would be willing to look into them before landing this. I simply wanted to get some other eyes on this before going further. Fixes #60804 cc @varkor @jplatte
2019-11-19Rollup merge of #66529 - petrochenkov:reshelp2, r=davidtwcoMazdak Farrokhzad-39/+31
resolve: Give derive helpers highest priority during resolution So they just shadow everything else and don't create ambiguity errors. This matches the old pre-#64694 behavior most closely. --- The change doesn't apply to this "compatibility" case ```rust #[trait_helper] // The helper attribute is used before it introduced. // Sadly, compiles on stable, supported via hacks. // I plan to make a compatibility warning for this. #[derive(Trait)] struct S; ``` , such attributes still create ambiguities, but #64694 didn't change anything for this case. Fixes https://github.com/rust-lang/rust/issues/66508 Fixes https://github.com/rust-lang/rust/issues/66525
2019-11-19Rollup merge of #66461 - clemencetbk:master, r=GuillaumeGomezMazdak Farrokhzad-0/+2
Add explanation message for E0641 Part of #61137
2019-11-19Rollup merge of #66431 - Aaron1011:fix/opaque-type-infer, r=varkorMazdak Farrokhzad-62/+93
Fix 'type annotations needed' error with opaque types Related: #66426 This commit adds handling for opaque types during inference variable fallback. Type variables generated from the instantiation of opaque types now fallback to the opaque type itself. Normally, the type variable for an instantiated opaque type is either unified with the concrete type, or with the opaque type itself (e.g when a function returns an opaque type by calling another function). However, it's possible for the type variable to be left completely unconstrained. This can occur in code like this: ```rust pub type Foo = impl Copy; fn produce() -> Option<Foo> { None } ``` Here, we'll instantatiate the `Foo` in `Option<Foo>` to a fresh type variable, but we will never unify it with anything due to the fact that we return a `None`. This results in the error message: ``` type annotations needed: cannot resolve `_: std::marker::Copy ``` pointing at `pub type Foo = impl Copy`. This message is not only confusing, it's incorrect. When an opaque type inference variable is completely unconstrained, we can always fall back to using the opaque type itself. This effectively turns that particular use of the opaque type into a non-defining use, even if it appears in a defining scope.
2019-11-19Rollup merge of #66239 - estebank:suggest-async-closure-call, r=CentrilMazdak Farrokhzad-3/+42
Suggest calling async closure when needed When using an async closure as a value in a place that expects a future, suggest calling the closure. Fix #65923.
2019-11-19Rollup merge of #66155 - GuillaumeGomez:long-err-explanation-E0594, r=Dylan-DPCMazdak Farrokhzad-21/+64
Add long error explanation for E0594 Part of #61137. r? @Dylan-DPC
2019-11-19Auto merge of #66206 - PotHix:master, r=estebankbors-5/+5
Suggest `#[repr(C)]` instead of `#[repr(C, packed, ...)]` The code was previously suggesting `#[repr(C, packed, ...)]` for incorrect uses of `repr` (e.g. `#[repr = "C"]`). This change suggests the usage of `#[repr(C)]` instead. r? @estebank Ref: #61286.
2019-11-19Auto merge of #66074 - wesleywiser:test_run_const_prop, r=oli-obkbors-10/+10
[mir-opt] Turn on the `ConstProp` pass by default perf.rlo shows that running the `ConstProp` pass results in across-the-board wins regardless of debug or opt complilation mode. As a result, we're turning it on to get the compile time benefits.
2019-11-18Avoid ICE when `break`ing to an unreachable labelEsteban Küber-0/+18
2019-11-18Add error code documentationEsteban Küber-1/+3
2019-11-18test: Update tests with fallout of changesGabriel Smith-74/+54
The error messages of the two tests effected degraded in quality. The errors no longer suggest types in other modules as they now assume that the arguments are const args, not type args.
2019-11-18test: const-generics: Update tests removing unrequired bracesGabriel Smith-19/+19
Braces were left in cases where generic args were in the generic const paths.
2019-11-18Auto merge of #58281 - mark-i-m:synthesis, r=estebankbors-0/+773
Add outlives suggestions for some lifetime errors This PR implements suggestion diagnostics for some lifetime mismatch errors. When the borrow checker finds that some lifetime 'a doesn't outlive some other lifetime 'b that it should outlive, then in addition to the current lifetime error, we also emit a suggestion for how to fix the problem by adding a bound: - If a and b are normal named regions, suggest to add the bound `'a: 'b` - If b is static, suggest to replace a with static - If b also needs to outlive a, they must be the same, so suggest unifying them We start with a simpler implementation that avoids diagnostic regression or implementation complexity: - We only makes suggestions for lifetimes the user can already name (eg not closure regions or elided regions) - For now, we only emit a help note, not an actually suggestion because it is significantly easier. Finally, there is one hack: it seems that implicit regions in async fn are given the name '_ incorrectly. To avoid suggesting '_: 'x, we simply filter out such lifetimes by name. For more info, see this internals thread: https://internals.rust-lang.org/t/mechanical-suggestions-for-some-borrow-checker-errors/9049/3 TL;DR Make suggestions to add a `where 'a: 'b` constraint for some lifetime errors. Details are in the paper linked from the internals thread above. r? @estebank TODO - [x] Clean up code - [x] Only make idiomatic suggestions - [x] don't suggest naming `&'a self` - [x] rather than `'a: 'static`, suggest replacing `'a` with `'static` - [x] rather than `'a: 'b, 'b: 'a`, suggest replacing `'a` with `'b` or vice versa - [x] Performance (maybe need a perf run when this is closer to the finish line?) - perf run was clean... - EDIT: perf run seems to only check non-error performance... How do we check that error performance didn't regress? - [x] Needs ui tests - [x] Integrate the `help` message into the main lifetime `error`
2019-11-19resolve: Give derive helpers highest priority during resolutionVadim Petrochenkov-39/+31
2019-11-18Reword help and add testEsteban Küber-0/+30
2019-11-18Auto merge of #54733 - GuillaumeGomez:stabilize-rustdoc-theme, ↵bors-1/+15
r=ollie27,Dylan-DPC Stabilize rustdoc theme options Closes #54730 This PR stabilizes the `--themes` (now `--theme`) and `--theme-checker` (now `--check-theme`) options, for allowing users to add custom themes to their documentation. Rustdoc includes two themes by default: `light` and `dark`. Using the `--theme` option, you can give rustdoc a CSS file to include as an extra theme for that render. Themes are named after the CSS file used, so using `--theme /path/to/your/custom-theme.css` will add a theme called `custom-theme` to the documentation. Even though the CLI flag to add a theme is getting stabilized, there's no guarantee that a theme file will always have the same effect on documentation generated with future versions of rustdoc. To aid in ensuring that a theme will work, the flag `--check-theme` is also available, which compares the CSS rules defined by a custom theme against the ones used in the `light` theme. If the `light` theme defines a CSS rule that the custom theme does not, rustdoc will report an error. (Rustdoc also performs this check for themes given to `--theme`, but only reports a warning when a difference is found.)
2019-11-18Update test outputAaron Hill-57/+45
2019-11-18Add explanation of unconstrained opaque typeAaron Hill-2/+8
2019-11-18Fix 'type annotations needed' error with opaque typesAaron Hill-5/+42
Related: #66426 This commit adds handling for opaque types during inference variable fallback. Type variables generated from the instantiatino of opaque types now fallback to the opque type itself. Normally, the type variable for an instantiated opaque type is either unified with the concrete type, or with the opaque type itself (e.g when a function returns an opaque type by calling another function). However, it's possible for the type variable to be left completely unconstrained. This can occur in code like this: ```rust pub type Foo = impl Copy; fn produce() -> Option<Foo> { None } ``` Here, we'll instantatiate the `Foo` in `Option<Foo>` to a fresh type variable, but we will never unify it with anything due to the fact that we return a `None`. This results in the error message: `type annotations needed: cannot resolve `_: std::marker::Copy`` pointing at `pub type Foo = impl Copy`. This message is not only confusing, it's incorrect. When an opaque type inference variable is completely unconstrained, we can always fall back to using the opaque type itself. This effectively turns that particular use of the opaque type into a non-defining use, even if it appears in a defining scope.
2019-11-18Update ui testsGuillaume Gomez-21/+64
2019-11-18Fix Makefile themes checkGuillaume Gomez-1/+2
2019-11-18Remove redundant html checkGuillaume Gomez-1/+0
2019-11-18Rename rustdoc options --themes and --check-themes to --theme and --check-themeGuillaume Gomez-1/+1
2019-11-18add test for rustdoc's --themes flagQuietMisdreavus-0/+14
2019-11-18Update src/test/ui/pattern/issue-53820-slice-pattern-large-array.rsNadrieril Feneanar-0/+3
Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com>
2019-11-18Auto merge of #66396 - smmalis37:pythontest, r=alexcrichtonbors-1/+1
Make a test compatible across python versions. Progress on #65063 This PR allows this test to work on both python2 and python3, ~~and it also allows `./x.py test` to fully complete on my system without python2 installed at all.~~
2019-11-18Auto merge of #66238 - ehuss:stabilize-rustdoc-edition, r=GuillaumeGomezbors-1/+1
rustdoc: Stabilize `edition` annotation. The rustdoc `edition` annotation is currently ignored on stable. This means that the tests will be ignored, unless there is a `rust` annotation, then it will use the global edition. I suspect this was just an oversight during the edition stabilization, but I don't know. Example: ```rust /// ```edition2018 /// // This code block was ignored on stable. /// ``` /// ```rust,edition2018 /// // This code block would use whatever edition is passed on the command line. /// ``` ``` AFAIK, it is not possible to write a test that verifies stable behavior, as all tests appear to set RUSTC_BOOTSTRAP which forces all tests to run as "nightly", even on a stable release. Closes #65980
2019-11-18Auto merge of #65456 - estebank:trait-bound-borrow, r=matthewjasperbors-17/+34
Suggest borrowing when it would satisfy an unmet trait bound When there are multiple implementors for the same trait that is present in an unmet binding, modify the E0277 error to refer to the parent obligation and verify whether borrowing the argument being passed in would satisfy the unmet bound. If it would, suggest it. Fix #56368.
2019-11-17review commentsEsteban Küber-1/+1
2019-11-17Do not ICE on trait aliases with missing obligationsEsteban Küber-0/+29
2019-11-17Auto merge of #66385 - ecstatic-morse:check-only-pass2, r=eddybbors-60/+22
Make dataflow-based const qualification the canonical one For over a month, dataflow-based const qualification has been running in parallel with `qualify_consts` to check the bodies of `const` and `static`s. This PR removes the old qualification pass completely in favor of the dataflow-based one. **edit:** This PR also stops checking `QUALIF_ERROR_BIT` during promotion. This check appears to no longer serve a purpose now that the CTFE engine is more robust. As a side-effect, this resolves #66167. r? @eddyb
2019-11-17Small improvement to exhaustiveness diagnosticsNadrieril-6/+6
2019-11-17Rollup merge of #66471 - Alexendoo:test-issue-63116, r=CentrilYuki Okushi-0/+27
Add test for issue 63116 Closes #63116
2019-11-17Rollup merge of #66469 - CosineP:fix/field-lint, r=petrochenkovYuki Okushi-20/+20
Use "field is never read" instead of "field is never used" this is my first PR here so please let me know if i am doing it wrong closes #64465 i will be referencing this with a book PR that updates the same language
2019-11-17Rollup merge of #66456 - Centril:driver-codes, r=Mark-SimulacrumYuki Okushi-1/+2
Move `DIAGNOSTICS` usage to `rustc_driver` Remove `rustc_interface`'s dependency on `rustc_error_codes` and centralize all usages of `DIAGNOSTICS` in `rustc_driver`. Once we remove all references to `rustc_error_codes` in all other crates but `rustc_driver`, this should allow for incremental recompilation of the compiler to be smoother when tweaking error codes. This works towards https://github.com/rust-lang/rust/issues/66210#issuecomment-551862528. (May include traces of minor drive-by cleanup.) r? @Mark-Simulacrum
2019-11-17Rollup merge of #66381 - Centril:66340, r=petrochenkovYuki Okushi-0/+19
find_deprecation: deprecation attr may be ill-formed meta. Fixes #66340. r? @petrochenkov cc @pnkfelix
2019-11-17Rollup merge of #66344 - petrochenkov:noregattr, r=matthewjasperYuki Okushi-71/+7
rustc_plugin: Remove `Registry::register_attribute` Legacy plugins cannot register inert attributes anymore. The preferred replacement is to use `register_tool` ([tracking issue](https://github.com/rust-lang/rust/issues/66079)). ```rust #![register_tool(servo)] #[servo::must_root] struct S; ``` The more direct replacement is `register_attribute` ([tracking issue](https://github.com/rust-lang/rust/issues/66080)) ```rust #![register_attr(must_root)] #[must_root] struct S; ``` , but it requires registering each attribute individually rather than registering the tool once, and is more likely to be removed rather than stabilized.
2019-11-17Rollup merge of #66271 - petrochenkov:abism, r=CentrilYuki Okushi-23/+69
syntax: Keep string literals in ABIs and `asm!` more precisely As a result we don't lose spans when `extern` functions or blocks are passed to proc macros, and also escape all string literals consistently. Continuation of https://github.com/rust-lang/rust/pull/60679, which did a similar thing with all literals besides those in ABIs and `asm!`. TODO: Add tests. Fixes https://github.com/rust-lang/rust/issues/60493 Fixes https://github.com/rust-lang/rust/issues/64561 r? @Centril