Uh oh!
There was an error while loading. Please reload this page.
Delay interning errors to after validation - #122684
Conversation
rustbot
commented
Mar 18, 2024
Some changes occurred to the CTFE / Miri engine cc @rust-lang/miri |
RalfJung
left a comment
There was a problem hiding this comment.
Thanks for trying this! IMO it looks promising.
it's not much simpler than the other PR, because now we need to handle nested statics generated by interning.
It seems a lot simpler to me, now we can entirely avoid that extra "patch mutability" stage?
I'm still not sure whether validation should truly also be responsible for handling pointers that can't be "seen" by the type system; this needs a full recursive traversal after all -- a traversal that interning already performs. It's also conceptually no longer about "validating a value".
The alternative would be for interning to return a Result<(), DelayedInternError> and for the queries to do something like
let intern_res = intern();validate()?;ifletErr(intern_err) = intern_res {
intern_err.emit();}DelayedInternError could have a panicking drop to make sure we catch cases where emit is forgotten.
We can still have validation opportunistically check for dangling pointers to get nice errors (in raw pointers, and maybe inside unions by just scanning the provenance map) -- but we'd not have to do a full second recursive traversal of everything reachable by such hidden pointers.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
| error: encountered mutable pointer in final value of static | ||
| --> $DIR/static-no-inner-mut.rs:13:1 | ||
| | ^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>.v: encountered `UnsafeCell` in read-only memory |
There was a problem hiding this comment.
The obvious reaction to this will be "so why is that memory read-only"...
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
c7b86c3 to
8f21f22Compareoli-obk
commented
Mar 19, 2024
I removed all the untyped validation and will create a separate PR for it |
592f674 to
7517bebCompareRalfJung
commented
Mar 19, 2024
Ah, good idea, thanks. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
| .type_of(did) | ||
| .no_bound_vars() | ||
| .expect("statics should not have generic parameters") | ||
| .is_freeze(*self.ecx.tcx, ty::ParamEnv::reveal_all()) => |
There was a problem hiding this comment.
I know this is pre-existing, but... why is reveal_all okay here? Shouldn't this be ecx.param_env()?
There was a problem hiding this comment.
We're asking for information about a static item's type. If anything we should get the param env of the static (but we know that is just ParamEnv::reveal_all() anyway.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
bors
commented
Mar 26, 2024
☔ The latest upstream changes (presumably #111769) made this pull request unmergeable. Please resolve the merge conflicts. |
RalfJung
commented
Mar 26, 2024
@rustbot author |
7517beb to
6290e5fCompareoli-obk
commented
Mar 26, 2024
The new state is effectively a full rewrite. So I rebased, split it up into two commits and force pushed. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
RalfJung
commented
Apr 1, 2024
@rustbot author |
oli-obk
commented
Apr 2, 2024
@rustbot ready |
bors
commented
Apr 3, 2024
☔ The latest upstream changes (presumably #123385) made this pull request unmergeable. Please resolve the merge conflicts. |
35bea5a to
2d936b4CompareUh oh!
There was an error while loading. Please reload this page.
RalfJung
commented
Apr 7, 2024
@rustbot author |
oli-obk
commented
Apr 8, 2024
No worries. I got enough stuff to do 😆 |
Uh oh!
There was an error while loading. Please reload this page.
This comment has been minimized.
This comment has been minimized.
586145a to
acb817aCompare
This comment has been minimized.
This comment has been minimized.
acb817a to
a3d987fCompareRalfJung
commented
Apr 16, 2024
All my comments are resolved, r=me with or without some commit squashing. |
validation produces much higher quality errors and already handles most of the cases
a3d987f to
126dcc6Compareoli-obk
commented
Apr 17, 2024
@bors r=RalfJung |
bors
commented
Apr 17, 2024
…after_validaiton, r=RalfJung Delay interning errors to after validation fixesrust-lang#122398fixesrust-lang#122548 This improves diagnostics since validation errors are usually more helpful compared with interning errors that just make broad statements about the entire constant r? `@RalfJung`
bors
commented
Apr 18, 2024
bors
commented
Apr 18, 2024
☀️ Test successful - checks-actions |
rust-timer
commented
Apr 18, 2024
Finished benchmarking commit (5260893): comparison URL. Overall result: ❌ regressions - no action needed@rustbot label: -perf-regression Instruction countThis is a highly reliable metric that was used to determine the overall result at the top of this comment.
Max RSS (memory usage)This benchmark run did not return any relevant results for this metric. CyclesResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 676.169s -> 679.408s (0.48%) |
fixes#122398
fixes#122548
This improves diagnostics since validation errors are usually more helpful compared with interning errors that just make broad statements about the entire constant
r? @RalfJung