summary refs log tree commit diff
path: root/src/test/ui
AgeCommit message (Collapse)AuthorLines
2019-09-21Regression tests for fn ptr and `#[structural_match]` as discussed in #63479.Felix S. Klock II-0/+171
2019-09-13Turn `soft_unstable` into a future-compatibility lintVadim Petrochenkov-0/+3
2019-09-13Support "soft" feature-gating using a lintVadim Petrochenkov-0/+14
Use it for feature-gating `#[bench]`
2019-09-13pprust: Do not print spaces before some tokensVadim Petrochenkov-5/+5
2019-09-13Permit unwinding through FFI by defaultMark Rousskov-0/+2
See #58794 for context.
2019-09-02expand: Do not do questionable span adjustment before eagerly expanding an ↵Vadim Petrochenkov-12/+3
expression Maybe it made sense when it was introduced, but now it's doing something incorrect.
2019-09-02expand: Keep the correct current expansion ID for eager expansionsVadim Petrochenkov-0/+6
Solve the problem of `ParentScope` entries for eager expansions not exising in the resolver map by creating them on demand.
2019-09-02Add a regression test for issue #63460Vadim Petrochenkov-0/+22
2019-09-02Add a test for an opaque macro eagerly expanding its argumentsVadim Petrochenkov-0/+26
2019-08-21review comment: remove unecessary error in testEsteban Küber-12/+4
2019-08-21Do not ICE when synthesizing spans falling inside unicode charsEsteban Küber-0/+22
2019-08-12Auto merge of #63483 - RalfJung:invalid-value, r=Centrilbors-55/+183
Improve invalid_value lint message The lint now explains which type is involved and why it cannot be initialized this way. It also points at the innermost struct/enum field that has an offending type, if any. See https://github.com/erlepereira/x11-rs/issues/99#issuecomment-520311911 for how this helps in some real-world code hitting this lint.
2019-08-12more informative error message from invalid_value lintRalf Jung-55/+183
2019-08-12Rollup merge of #63474 - adamAndMath:master, r=CentrilMazdak Farrokhzad-0/+74
Add tests for issue #53598 and #57700 Closes #53598 and #57700
2019-08-12Rollup merge of #63473 - adrian-budau:master, r=CentrilMazdak Farrokhzad-0/+38
Regression test for #56870 Closes #56870.
2019-08-12Rollup merge of #63406 - ↵Mazdak Farrokhzad-5/+113
jakubadamw:resolve-inconsistent-names-suggest-qualified-path, r=petrochenkov Suggest using a qualified path in patterns with inconsistent bindings A program like the following one: ```rust enum E { A, B, C } fn f(x: E) -> bool { match x { A | B => false, C => true } } ``` is rejected by the compiler due to `E` variant paths not being in scope. In this case `A`, `B` are resolved as pattern bindings and consequently the pattern is considered invalid as the inner or-patterns do not bind to the same set of identifiers. This is expected but the compiler errors that follow could be surprising or confusing to some users. This commit adds a help note explaining that if the user desired to match against variants or consts, they should use a qualified path. The help note is restricted to cases where the identifier starts with an upper-case sequence so as to reduce the false negatives. Since this happens during resolution, there's no clean way to check what it is the patterns match against. The syntactic criterium, however, is in line with the convention that's assumed by the `non-camel-case-types` lint. Fixes #50831.
2019-08-11Move tests into type-alias-impl-traitAdam-0/+0
2019-08-11Add test for issue 53598 and 57700Adam-0/+74
2019-08-11Regression test for #56870Adrian Budau-0/+38
2019-08-11Rollup merge of #63433 - RalfJung:miri-call, r=oli-obkMark Rousskov-6/+55
Miri shouldn't look at types r? @oli-obk Fixes https://github.com/rust-lang/rust/issues/62137
2019-08-11Rollup merge of #63346 - RalfJung:zeroed-lint, r=eddybMark Rousskov-1/+228
Lint on some incorrect uses of mem::zeroed / mem::uninitialized Cc https://github.com/rust-lang/rust/issues/62825 and https://internals.rust-lang.org/t/make-mem-uninitialized-and-mem-zeroed-panic-for-some-types-where-0-is-a-niche/10605 This does not yet handle `NonNull`/`NonZero*`, but it is a start. I also improved some doc issues I hit on the way, and added a useful helper to `TyS`. EDIT: I added the relnotes label mostly as a proposal -- I think this is worth mentioning, but leave the decision up to the release team.
2019-08-11warn for more casesRalf Jung-11/+166
2019-08-11add basic lint testing for misuse of mem::zeroed and mem::uninitializedRalf Jung-1/+73
2019-08-11Auto merge of #63343 - ishitatsuyuki:revert-62150, r=RalfJungbors-0/+13
Back out #62150 Ref: #62825 cc @RalfJung
2019-08-10Apply suggestions from code reviewJakub Adam Wieczorek-3/+3
Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com>
2019-08-10Suggest using a qualified path in patterns with inconsistent bindingsJakub Adam Wieczorek-5/+113
A program like the following one: ```rust enum E { A, B, C } fn f(x: E) -> bool { match x { A | B => false, C => true } } ``` is rejected by the compiler due to `E` variant paths not being in scope. In this case `A`, `B` are resolved as pattern bindings and consequently the pattern is considered invalid as the inner or-patterns do not bind to the same set of identifiers. This is expected but the compiler errors that follow could be surprising or confusing to some users. This commit adds a help note explaining that if the user desired to match against variants or consts, they should use a qualified path. The note is restricted to cases where the identifier starts with an upper-case sequence so as to reduce the false negatives. Since this happens during resolution, there's no clean way to check what the patterns match against. The syntactic criterium, however, is in line with the convention that's assumed by the `non-camel-case-types` lint.
2019-08-10diagnostics: Describe crate root modules in `DefKind::Mod` as "crate"Vadim Petrochenkov-37/+37
2019-08-10Revert "Rollup merge of #62150 - alex:mem-uninit-refactor, r=RalfJung"Tatsuyuki Ishi-0/+13
This reverts commit 1d45156866b54c3fc36edfdfcdd8149ad9cb5711, reversing changes made to 0f92eb8a4a7d8715381f5b5d748d22315f6ff9c7.
2019-08-10fix testRalf Jung-6/+55
2019-08-10resolve: Address FIXME from the previous commitVadim Petrochenkov-4/+4
Make the `is_import` flag in `ScopeSet` independent from namespace Fix rebase
2019-08-10Fix calls to resolver from rustdoc and HIR loweringVadim Petrochenkov-1/+1
Cleanup some surrounding code. Support resolution of intra doc links in unnamed block scopes. (Paths from rustdoc now use early resolution and no longer need results of late resolution like all the built ribs.) Fix one test hitting file path limits on Windows.
2019-08-10resolve: Move late resolution into a separate visitorVadim Petrochenkov-20/+81
Move `Resolver` fields specific to late resolution to the new visitor. The `current_module` field from `Resolver` is replaced with two `current_module`s in `LateResolutionVisitor` and `BuildReducedGraphVisitor`. Outside of those visitors `current_module` is replaced by passing `parent_scope` to more functions and using the parent module from it. Visibility resolution no longer have access to later resolution methods and has to use early resolution, so its diagnostics in case of errors regress slightly.
2019-08-10Rollup merge of #63423 - estebank:priv-tuple, r=zackmdavisMazdak Farrokhzad-0/+116
Mention that tuple structs are private if any of their fields are CC #39703
2019-08-10Rollup merge of #63419 - RalfJung:typeid, r=alexcrichtonMazdak Farrokhzad-4/+14
check against more collisions for TypeId of fn pointer Cc https://github.com/rust-lang/rfcs/pull/2738#issuecomment-519923318
2019-08-10Rollup merge of #63399 - estebank:vec-in-pat, r=CentrilMazdak Farrokhzad-1/+33
More explicit diagnostic when using a `vec![]` in a pattern ``` error: unexpected `(` after qualified path --> $DIR/vec-macro-in-pattern.rs:3:14 | LL | Some(vec![x]) => (), | ^^^^^^^ | | | unexpected `(` after qualified path | in this macro invocation | use a slice pattern here instead | = help: for more information, see https://doc.rust-lang.org/edition-guide/rust-2018/slice-patterns.html = note: this warning originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) ``` Fix #61933.
2019-08-10Rollup merge of #63394 - jackh726:issue-36804, r=jonas-schievinkMazdak Farrokhzad-0/+31
Add test for issue 36804 I slightly reduced the repro that ICEs on nightly-2017-01-20. Closes #36804
2019-08-10Rollup merge of #63337 - estebank:break-ee0308, r=CentrilMazdak Farrokhzad-58/+515
Tweak mismatched types error - Change expected/found for type mismatches in `break` - Be more accurate when talking about diverging match arms - Tweak wording of function without a return value - Suggest calling bare functions when their return value can be coerced to the expected type - Give more parsing errors when encountering `foo(_, _, _)` Fix #51767, fix #62677, fix #63136, cc #37384, cc #35241, cc #51669.
2019-08-10Give built-in macros stable addresses in the standard libraryVadim Petrochenkov-5/+163
2019-08-09Mention that tuple structs are private if their fields areEsteban Küber-0/+116
2019-08-09check against more collisions for TypeId of fn pointerRalf Jung-4/+14
2019-08-09review comments: use structured suggestionEsteban Küber-6/+16
2019-08-09More explicit diagnostic when using a `vec![]` in a patternEsteban Küber-1/+23
``` error: unexpected `(` after qualified path --> $DIR/vec-macro-in-pattern.rs:3:14 | LL | Some(vec![x]) => (), | ^^^^^^^ | | | unexpected `(` after qualified path | in this macro invocation | use a slice pattern here instead | = help: for more information, see https://doc.rust-lang.org/edition-guide/rust-2018/slice-patterns.html = note: this warning originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) ```
2019-08-09fix testsEsteban Küber-3/+3
2019-08-09review comments: typo and rewordingEsteban Küber-27/+27
2019-08-09review comment: review wording or missing return errorEsteban Küber-20/+20
2019-08-09Extend suggestion support for traits and foreign itemsEsteban Küber-16/+137
2019-08-09Differentiate between tuple structs and tuple variantsEsteban Küber-11/+42
2019-08-09Tweak wording of fn without explicit returnEsteban Küber-20/+20
2019-08-09Recover parser from `foo(_, _)`Esteban Küber-2/+66
2019-08-09When suggesting fn call use an appropriate number of placeholder argumentsEsteban Küber-4/+117