| Age | Commit message (Collapse) | Author | Lines |
|
|
|
CTFE: exposing pointers and calling extern fn is just impossible
The remaining "needs RFC" errors are just needlessly confusing, I think -- time to get rid of that error variant. They are anyway only reachable with miri-unleashed (if at all).
r? `@oli-obk`
|
|
Do not report too many expr field candidates
When considering "this expressions' field has a {field/method}" suggestions:
1. Don't report methods that are out of scope
2. Use `span_suggestions` instead of reporting each field candidate, which caps the number of suggestions to 4
4. Blacklist some common traits like `Clone` and `Deref`
Fixes #100894
|
|
modified: compiler/rustc_passes/src/liveness.rs
new file: src/test/ui/type/issue-100584.rs
new file: src/test/ui/type/issue-100584.stderr
|
|
If we don't skip these tests, they will fail in CI when `python3 ../x.py
--stage 2 test --host= --target arm-linux-androideabi` runs. The failure
is:
auxiliary/libsigpipe_utils.so: error: undefined reference to 'signal'
|
|
The `*-ptr` is rather confusing, and we have the full information for
properly displaying the information.
|
|
This reverts commit 326646074940222d602f3683d0559088690830f4.
This is the revert against master, the beta revert was already done in #100538.
|
|
Before, the MIR validator used RevealAll in its ParamEnv for type
checking. This could cause false negatives in some cases due to
RevealAll ParamEnvs not always use all predicates as expected here.
Since some MIR passes like inlining use RevealAll as well, keep using
it in the MIR validator too, but when it fails usign RevealAll, also
try the check without it, to stop false negatives.
|
|
|
|
Separate CountIsStar from CountIsParam in rustc_parse_format.
`rustc_parse_format`'s parser would result in the exact same output for `{:.*}` and `{:.0$}`, making it hard for diagnostics to handle these cases properly.
This splits those cases by adding a new `CountIsStar` enum variant.
This fixes #100995
Prerequisite for https://github.com/rust-lang/rust/pull/100996
|
|
extra sanity check against consts pointing to mutable memory
This should be both unreachable and redundant (since we already ensure that validation only reads from read-only memory, when validating consts), but I feel like we cannot be paranoid enough here, and also if this ever fails it'll be a nicer error than the "cannot read from mutable memory" error.
|
|
Improve const mismatch `FulfillmentError`
Fixes #100414
|
|
Adds and removes some `visit_*` methods accordingly, improving
coverage, and avoiding some double counting. Brings it in line with the
AST stats collector.
|
|
This is based on `-Zprint-type-sizes` which does the same thing. It
makes the output provenance clearer, and helps with post-processing.
E.g. if you have `-Zhir-stats` output from numerous compiler invocations
you can now easily extract the pre-expansion stats separately from the
post-expansion stats.
|
|
This makes it possible to instruct libstd to never touch the signal
handler for `SIGPIPE`, which makes programs pipeable by default (e.g.
with `./your-program | head -n 1`) without `ErrorKind::BrokenPipe`
errors.
|
|
|
|
just impossible
|
|
Signed-off-by: Yuki Okushi <jtitor@2k36.org>
|
|
|
|
Use smaller span for suggestions
|
|
no alignment check during interning
This should fix https://github.com/rust-lang/rust/issues/101034
r? `@oli-obk`
Unfortunately we don't have a self-contained testcase for this problem. I am not sure how it can be triggered...
|
|
Provide structured suggestion for `hashmap[idx] = val`
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- use the simpler minimum working example from the review
- add an alterate "fix" that helps make the cause of the error more
clear
- attempt to add an improved description of what is going on
|
|
no unnormalized types for implied bounds outside borrowck
fixes #100910 - introduced in https://github.com/rust-lang/rust/pull/100676 - by only considering normalized types for wf.
r? types
|
|
|
|
Rollup of 11 pull requests
Successful merges:
- #96240 (Stabilize `const_ptr_offset_from`.)
- #99784 (Make forward compatibility lint deprecated_cfg_attr_crate_type_name deny by default)
- #100811 (Fix wrong compiletest filters on Windows)
- #100924 (Smaller improvements of tidy and the unicode generator)
- #100953 (Update documentation for `write!` and `writeln!`)
- #101018 (rustdoc: omit start/end tags for empty item description blocks)
- #101044 (rustdoc: remove unused CSS for `hidden-by-*-hider`)
- #101046 (rustdoc: remove incorrect CSS selector `.impl-items table td`)
- #101057 (Merge implementations of HIR fn_decl and fn_sig.)
- #101062 (rustdoc: remove empty extern_crates and type="text/javascript" on script)
- #101063 (Merge duplicated CSS rules)
Failed merges:
- #101055 (Use smaller span for suggestions)
r? `@ghost`
`@rustbot` modify labels: rollup
|
|
Make forward compatibility lint deprecated_cfg_attr_crate_type_name deny by default
Turns the forward compatibility lint added by #83744 to deprecate `cfg_attr` usage with `#![crate_type]` and `#![crate_name]` attributes into deny by default. Copying the example from #83744:
```Rust
#![crate_type = "lib"] // remains working
#![cfg_attr(foo, crate_type = "bin")] // will stop working
```
Over 8 months have passed since #83744 was merged so I'd say this gives ample time for people to have been warned, so we can make the warning stronger. No usage was found via grep.app except for one, which was in an unmaintained code base that didn't seem to be used in the open source eco system. The crater run conducted in #83744 also didn't show up anything.
cc #91632 - tracking issue for the lint
|
|
r=Mark-Simulacrum
Stabilize `const_ptr_offset_from`.
Stabilization has been completed [here](https://github.com/rust-lang/rust/issues/92980#issuecomment-1065644848) with a FCP.
Closes #92980.
|
|
|
|
Implementation of import_name_type
Fixes #96534 by implementing https://github.com/rust-lang/compiler-team/issues/525
Symbols that are exported or imported from a binary on 32bit x86 Windows can be named in four separate ways, corresponding to the [import name types](https://docs.microsoft.com/en-us/windows/win32/debug/pe-format#import-name-type) from the PE-COFF spec. The exporting and importing binaries must use the same name encoding, otherwise mismatches can lead to link failures due to "missing symbols" or to 0xc0000139 (`STATUS_ENTRYPOINT_NOT_FOUND`) errors when the executable/library is loaded. For details, see the comments on the raw-dylib feature's https://github.com/rust-lang/rust/issues/58713. To generate the correct import libraries for these DLLs, therefore, rustc must know the import name type for each `extern` function, and there is currently no way for users to provide this information.
This change adds a new `MetaNameValueStr` key to the `#[link]` attribute called `import_name_type`, and which accepts one of three values: `decorated`, `noprefix`, and `undecorated`.
A single DLL is likely to export all its functions using the same import type name, hence `import_name_type` is a parameter of `#[link]` rather than being its own attribute that is applied per-function. It is possible to have a single DLL that exports different functions using different import name types, but users could express such cases by providing multiple export blocks for the same DLL, each with a different import name type.
Note: there is a fourth import name type defined in the PE-COFF spec, `IMPORT_ORDINAL`. This case is already handled by the `#[link_ordinal]` attribute. While it could be merged into `import_type_name`, that would not make sense as `#[link_ordinal]` provides per-function information (namely the ordinal itself).
Design decisions (these match the MCP linked above):
* For GNU, `decorated` matches the PE Spec and MSVC rather than the default behavior of `dlltool` (i.e., there will be a leading `_` for `stdcall`).
* If `import_name_type` is not present, we will keep our current behavior of matching the environment (MSVC vs GNU) default for decorating.
* Using `import_name_type` on architectures other than 32bit x86 will result in an error.
* Using `import_name_type` with link kinds other than `"raw-dylib"` will result in an error.
|
|
This reverts commit 33212bf7f527798a8cfa2bbb38781742f4ca718a.
|
|
Rollup of 9 pull requests
Successful merges:
- #100724 (Migrate ast lowering to session diagnostic)
- #100735 (Migrate `rustc_ty_utils` to `SessionDiagnostic`)
- #100738 (Diagnostics migr const eval)
- #100744 (Migrate rustc_mir_dataflow to diagnostic structs)
- #100776 (Migrate `rustc_lint` errors to `SessionDiagnostic`)
- #100817 (sugg: suggest the usage of boolean value when there is a typo in the keyword)
- #100836 (Migrate `rustc_attr` crate diagnostics)
- #100890 (Migrate rustc_driver to SessionDiagnostic)
- #100900 (on `region_errors.rs`)
Failed merges:
- #100831 (Migrate `symbol_mangling` module to new diagnostics structs)
r? `@ghost`
`@rustbot` modify labels: rollup
|
|
sugg: suggest the usage of boolean value when there is a typo in the keyword
Fixes https://github.com/rust-lang/rust/issues/100686
This adds a new suggestion when there is a well-known typo
With the following program
```rust
fn main() {
let x = True;
}
```
Now we have the following suggestion
```
error[E0425]: cannot find value `True` in this scope
--> test.rs:2:13
|
2 | let x = True;
| ^^^^ not found in this scope
|
help: you may want to use a bool value instead
|
2 | let x = true;
| ~~~~
error: aborting due to previous error
```
Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
|
|
interpret: remove support for uninitialized scalars
With Miri no longer supporting `-Zmiri-allow-uninit-numbers`, we no longer need to support storing uninit data in a `Scalar`. We anyway already only use this representation for types with *initialized* `Scalar` layout (and we have to, due to partial initialization), so let's get rid of the `ScalarMaybeUninit` type entirely.
I tried to stage this into meaningful commits, but the one that changes `read_immediate` to always trigger UB on uninit is the largest chunk of the PR and I don't see how it could be subdivided.
Fixes https://github.com/rust-lang/miri/issues/2187
r? `@oli-obk`
|
|
|
|
|
|
initialized Scalar
|
|
|
|
session: stabilize split debuginfo on linux
Stabilize the `-Csplit-debuginfo` flag...
- ...on Linux for all values of the flag. Split DWARF has been implemented for a few months, hasn't had any bug reports and has had some promising benchmarking for incremental debug build performance.
- ..on other platforms for the default value. It doesn't make any sense that `-Csplit-debuginfo=packed` is unstable on Windows MSVC when that's the default behaviour, but keep the other values unstable.
|
|
|
|
Shrink `thir::Expr`
r? `@cjgillot`
|