-
Notifications
You must be signed in to change notification settings - Fork 380
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
10066: ANN: Add support for E0131, E0197, E0203 r=vlad20012 a=kuksag <!-- Hello and thank you for the pull request! We don't have any strict rules about pull requests, but you might check https://github.com/intellij-rust/intellij-rust/blob/master/CONTRIBUTING.md for some hints! Also, please write a short description explaining your change in the following format: `changelog: %description%` This description will help a lot to create release changelog. Drop these lines for internal only changes :) --> changelog: * Add support for E0131 Error code reference: https://doc.rust-lang.org/error_codes/E0131.html There's a feature that might be connected to this error code: rust-lang/rust#29633 * Add support for E0197 Error code reference: https://doc.rust-lang.org/error_codes/E0197.html * Add support for E0203 Error code reference: https://doc.rust-lang.org/error_codes/E0203.html Compiler implementation: https://github.com/rust-lang/rust/blob/master/compiler/rustc_hir_analysis/src/astconv/mod.rs#L877 Co-authored-by: kuksag <georgiy.kuksa@gmail.com>
- Loading branch information
Showing
5 changed files
with
135 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
src/test/kotlin/org/rust/ide/annotator/RsMainWithGenericsTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/* | ||
* Use of this source code is governed by the MIT license that can be | ||
* found in the LICENSE file. | ||
*/ | ||
|
||
package org.rust.ide.annotator | ||
|
||
class RsMainWithGenericsTest: RsAnnotatorTestBase(RsSyntaxErrorsAnnotator::class) { | ||
fun `test E0131 type parameter`() = checkByText(""" | ||
fn main<error descr="`main` function is not allowed to have generic parameters [E0131]"><T></error>() { } | ||
""") | ||
|
||
fun `test E0131 lifetime parameter`() = checkByText(""" | ||
fn main<error descr="`main` function is not allowed to have generic parameters [E0131]"><'a></error>() { } | ||
""") | ||
|
||
|
||
fun `test E0131 const parameter`() = checkByText(""" | ||
fn main<error descr="`main` function is not allowed to have generic parameters [E0131]"><const A: i32></error>() { } | ||
""") | ||
|
||
fun `test E0131 without type parameters`() = checkByText(""" | ||
fn main() { } | ||
""") | ||
} |
24 changes: 24 additions & 0 deletions
24
src/test/kotlin/org/rust/ide/annotator/RsMultipleRelaxedBoundsTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/* | ||
* Use of this source code is governed by the MIT license that can be | ||
* found in the LICENSE file. | ||
*/ | ||
|
||
package org.rust.ide.annotator | ||
|
||
class RsMultipleRelaxedBoundsTest: RsAnnotatorTestBase(RsSyntaxErrorsAnnotator::class) { | ||
fun `test E0203 sample`() = checkByText(""" | ||
struct Bad<<error descr="Type parameter has more than one relaxed default bound, only one is supported [E0203]">T: ?Sized + ?Send</error>>{ | ||
inner: T | ||
} | ||
""") | ||
|
||
fun `test E0203 compiler test -- no-patterns-in-args-macro`() = checkByText(""" | ||
struct S5<<error descr="Type parameter has more than one relaxed default bound, only one is supported [E0203]">T</error>>(*const T) where T: ?Trait<'static> + ?Sized; | ||
""") | ||
|
||
fun `test E0203 where clause`() = checkByText(""" | ||
struct Bad<<error descr="Type parameter has more than one relaxed default bound, only one is supported [E0203]">T: ?Sized</error>> where T: ?Sized { | ||
inner: T | ||
} | ||
""") | ||
} |
19 changes: 19 additions & 0 deletions
19
src/test/kotlin/org/rust/ide/annotator/RsUnsafeInherentImplTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/* | ||
* Use of this source code is governed by the MIT license that can be | ||
* found in the LICENSE file. | ||
*/ | ||
|
||
package org.rust.ide.annotator | ||
|
||
class RsUnsafeInherentImplTest: RsAnnotatorTestBase(RsSyntaxErrorsAnnotator::class) { | ||
fun `test E0197`() = checkByText(""" | ||
struct Foo; | ||
unsafe impl <error descr="Inherent impls cannot be unsafe [E0197]">Foo</error> { } | ||
""") | ||
|
||
fun `test E0197 unsafe with trait`() = checkByText(""" | ||
struct Foo; | ||
unsafe trait Bar { } | ||
unsafe impl Kek for Foo { } | ||
""") | ||
} |