You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A-runtimeArea: std's runtime and "pre-main" init for handling backtraces, unwinds, stack overflowsC-cleanupCategory: PRs that clean code up or issues documenting cleanup.E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.
Simplify librustc_errors
This is part 2 of the error crate refactor, starting with #34403.
In this refactor, I focused on slimming down the error crate to fewer moving parts. As such, I've removed quite a few parts and replaced the with simpler, straight-line code. Specifically, this PR:
* Removes BasicEmitter
* Remove emit from emitter, leaving emit_struct
* Renames emit_struct to emit
* Removes CoreEmitter and focuses on a single Emitter
* Implements the latest changes to error format RFC (#1644)
* Removes (now-unused) code in emitter.rs and snippet.rs
* Moves more tests to the UI tester, removing some duplicate tests in the process
There is probably more that could be done with some additional refactoring, but this felt like it was getting to a good state.
r? @alexcrichton cc: @Manishearth (as there may be breaking changes in stuff I removed/changed)
flip1995
pushed a commit
to flip1995/rust
that referenced
this issue
Dec 29, 2022
Null fn lints
Adds lints to check for code, that assumes nullable `fn()`.
### Lint examples:
`transmute_null_to_fn`:
```rust
error: transmuting a known null pointer into a function pointer
--> $DIR/transmute_null_to_fn.rs:9:23
|
LL | let _: fn() = std::mem::transmute(std::ptr::null::<()>());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this transmute results in undefined behavior
|
= help: try wrapping your function pointer type in `Option<T>` instead, and using `None` as a null pointer value
```
`fn_null_check`:
```rust
error: function pointer assumed to be nullable, even though it isn't
--> $DIR/fn_null_check.rs:13:8
|
LL | if (fn_ptr as *mut ()).is_null() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: try wrapping your function pointer type in `Option<T>` instead, and using `is_none` to check for null pointer value
```
Closesrust-lang#1644
---
changelog: Improvement: [`transmuting_null`]: Now detects `const` pointers to all types
[rust-lang#10099](rust-lang/rust-clippy#10099)
changelog: New lint: [`transmute_null_to_fn`]
[rust-lang#10099](rust-lang/rust-clippy#10099)
changelog: New lint: [`fn_null_check`]
[rust-lang#10099](rust-lang/rust-clippy#10099)
<!-- changelog_checked (This is just a flag for me, please don't add it manually) -->
celinval
pushed a commit
to celinval/rust-dev
that referenced
this issue
Jun 4, 2024
A-runtimeArea: std's runtime and "pre-main" init for handling backtraces, unwinds, stack overflowsC-cleanupCategory: PRs that clean code up or issues documenting cleanup.E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.
We define
alignof()
in the runtime butalignof
is a C++11 keyword. Rename this and remove the -Wno-c++11-compat flag from the clang build flags.The text was updated successfully, but these errors were encountered: