-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Validate before reporting interning errors.
validation produces much higher quality errors and already handles most of the cases
- Loading branch information
Showing
18 changed files
with
253 additions
and
513 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
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
15 changes: 10 additions & 5 deletions
15
tests/ui/consts/const-eval/heap/dealloc_intrinsic_dangling.stderr
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
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
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 |
---|---|---|
@@ -1,8 +1,14 @@ | ||
error: encountered dangling pointer in final value of constant | ||
--> $DIR/dangling-alloc-id-ice.rs:8:1 | ||
error[E0080]: it is undefined behavior to use this value | ||
--> $DIR/dangling-alloc-id-ice.rs:12:1 | ||
| | ||
LL | const FOO: &() = { | ||
| ^^^^^^^^^^^^^^ | ||
| ^^^^^^^^^^^^^^ constructing invalid value: encountered a dangling reference (use-after-free) | ||
| | ||
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. | ||
= note: the raw bytes of the constant (size: $SIZE, align: $ALIGN) { | ||
HEX_DUMP | ||
} | ||
|
||
error: aborting due to 1 previous error | ||
|
||
For more information about this error, try `rustc --explain E0080`. |
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 |
---|---|---|
@@ -1,8 +1,29 @@ | ||
const FOO: *const u32 = { //~ ERROR encountered dangling pointer in final value of constant | ||
const FOO: *const u32 = { | ||
//~^ ERROR encountered dangling pointer in final value of constant | ||
let x = 42; | ||
&x | ||
}; | ||
|
||
fn main() { | ||
let x = FOO; | ||
union Union { | ||
ptr: *const u32, | ||
} | ||
|
||
const BAR: Union = { | ||
//~^ ERROR encountered dangling pointer in final value of constant | ||
let x = 42; | ||
Union { ptr: &x } | ||
}; | ||
|
||
const BAZ: Union = { | ||
//~^ ERROR encountered dangling pointer in final value of constant | ||
let x = 42_u32; | ||
Union { ptr: &(&x as *const u32) as *const *const u32 as _ } | ||
}; | ||
|
||
const FOOMP: *const u32 = { | ||
//~^ ERROR encountered dangling pointer in final value of constant | ||
let x = 42_u32; | ||
&(&x as *const u32) as *const *const u32 as _ | ||
}; | ||
|
||
fn main() {} |
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
Oops, something went wrong.