-
Notifications
You must be signed in to change notification settings - Fork 13.4k
typeck: taint if errors found during writeback #113125
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
davidtwco
wants to merge
3
commits into
rust-lang:master
Choose a base branch
from
davidtwco:issue-112824-ctfe-type-mismatch-with-type-error
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+150
−2
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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,6 @@ | ||
fn f(_: B) {} | ||
//~^ ERROR cannot find type `B` in this scope [E0412] | ||
|
||
fn main() { | ||
let _ = [0; f as usize]; | ||
} |
This file contains hidden or 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,14 @@ | ||
error[E0412]: cannot find type `B` in this scope | ||
--> $DIR/issue-112630-1.rs:1:9 | ||
| | ||
LL | fn f(_: B) {} | ||
| ^ not found in this scope | ||
| | ||
help: you might be missing a type parameter | ||
| | ||
LL | fn f<B>(_: B) {} | ||
| +++ | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0412`. |
This file contains hidden or 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,8 @@ | ||
enum Foo { | ||
Bar(B), | ||
//~^ ERROR cannot find type `B` in this scope [E0412] | ||
} | ||
|
||
fn main() { | ||
let _ = [0; Foo::Bar as usize]; | ||
} |
This file contains hidden or 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,14 @@ | ||
error[E0412]: cannot find type `B` in this scope | ||
--> $DIR/issue-112630.rs:2:9 | ||
| | ||
LL | Bar(B), | ||
| ^ not found in this scope | ||
| | ||
help: you might be missing a type parameter | ||
| | ||
LL | enum Foo<B> { | ||
| +++ | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0412`. |
19 changes: 19 additions & 0 deletions
19
tests/ui/consts/issue-112824-type-mismatch-type-error-1.rs
This file contains hidden or 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 @@ | ||
pub struct Opcode(pub u8); | ||
|
||
pub struct Opcode2 { | ||
s: &'a S, | ||
//~^ ERROR cannot find type `S` in this scope [E0412] | ||
//~^^ ERROR use of undeclared lifetime name `'a` [E0261] | ||
} | ||
|
||
impl Opcode2 { | ||
pub const OP2: Opcode2 = Opcode2 { s: Opcode(0x1) }; | ||
} | ||
|
||
pub fn example2(msg_type: Opcode2) -> impl FnMut(&[u8]) { | ||
move |i| match msg_type { | ||
Opcode2::OP2 => unimplemented!(), | ||
} | ||
} | ||
|
||
fn main() {} |
23 changes: 23 additions & 0 deletions
23
tests/ui/consts/issue-112824-type-mismatch-type-error-1.stderr
This file contains hidden or 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,23 @@ | ||
error[E0261]: use of undeclared lifetime name `'a` | ||
--> $DIR/issue-112824-type-mismatch-type-error-1.rs:4:9 | ||
| | ||
LL | pub struct Opcode2 { | ||
| - help: consider introducing lifetime `'a` here: `<'a>` | ||
LL | s: &'a S, | ||
| ^^ undeclared lifetime | ||
|
||
error[E0412]: cannot find type `S` in this scope | ||
--> $DIR/issue-112824-type-mismatch-type-error-1.rs:4:12 | ||
| | ||
LL | s: &'a S, | ||
| ^ not found in this scope | ||
| | ||
help: you might be missing a type parameter | ||
| | ||
LL | pub struct Opcode2<S> { | ||
| +++ | ||
|
||
error: aborting due to 2 previous errors | ||
|
||
Some errors have detailed explanations: E0261, E0412. | ||
For more information about an error, try `rustc --explain E0261`. |
This file contains hidden or 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,17 @@ | ||
pub struct Opcode(pub u8); | ||
|
||
pub struct Opcode2(&'a S); | ||
//~^ ERROR cannot find type `S` in this scope [E0412] | ||
//~^^ ERROR use of undeclared lifetime name `'a` [E0261] | ||
|
||
impl Opcode2 { | ||
pub const OP2: Opcode2 = Opcode2(Opcode(0x1)); | ||
} | ||
|
||
pub fn example2(msg_type: Opcode2) -> impl FnMut(&[u8]) { | ||
move |i| match msg_type { | ||
Opcode2::OP2 => unimplemented!(), | ||
} | ||
} | ||
|
||
fn main() {} |
23 changes: 23 additions & 0 deletions
23
tests/ui/consts/issue-112824-type-mismatch-type-error.stderr
This file contains hidden or 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,23 @@ | ||
error[E0261]: use of undeclared lifetime name `'a` | ||
--> $DIR/issue-112824-type-mismatch-type-error.rs:3:21 | ||
| | ||
LL | pub struct Opcode2(&'a S); | ||
| - ^^ undeclared lifetime | ||
| | | ||
| help: consider introducing lifetime `'a` here: `<'a>` | ||
|
||
error[E0412]: cannot find type `S` in this scope | ||
--> $DIR/issue-112824-type-mismatch-type-error.rs:3:24 | ||
| | ||
LL | pub struct Opcode2(&'a S); | ||
| ^ not found in this scope | ||
| | ||
help: you might be missing a type parameter | ||
| | ||
LL | pub struct Opcode2<S>(&'a S); | ||
| +++ | ||
|
||
error: aborting due to 2 previous errors | ||
|
||
Some errors have detailed explanations: E0261, E0412. | ||
For more information about an error, try `rustc --explain E0261`. |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.