| Age | Commit message (Collapse) | Author | Lines |
|
Use Ancestory to check default fn in const impl instead of comparing idents
Fixes https://rust-lang.zulipchat.com/#narrow/stream/146212-t-compiler.2Fconst-eval/topic/Const.20trait.20impl.20inside.20macro
|
|
|
|
Add enum_intrinsics_non_enums lint
There is a clippy lint to prevent calling [`mem::discriminant`](https://doc.rust-lang.org/std/mem/fn.discriminant.html) with a non-enum type. I think the lint is worthy of being included in rustc, given that `discriminant::<T>()` where `T` is a non-enum has an unspecified return value, and there are no valid use cases where you'd actually want this.
I've also made the lint check [variant_count](https://doc.rust-lang.org/core/mem/fn.variant_count.html) (#73662).
closes #83899
|
|
Add #[must_use] to alloc constructors
Added `#[must_use]`. to the various forms of `new`, `pin`, and `with_capacity` in the `alloc` crate. No extra explanations given as I couldn't think of anything useful to add.
I figure this deserves extra scrutiny compared to the other PRs I've done so far. In particular:
* The 4 `pin`/`pin_in` methods I touched. Are there legitimate use cases for pinning and not using the result? Pinning's a difficult concept I'm not very comfortable with.
* `Box`'s constructors. Do people ever create boxes just for the side effects... allocating or zeroing out memory?
Parent issue: #89692
r? ``@joshtriplett``
|
|
|
|
Create more accurate debuginfo for vtables.
Before this PR all vtables would have the same name (`"vtable"`) in debuginfo. Now they get an unambiguous name that identifies the implementing type and the trait that is being implemented.
This is only one of several possible improvements:
- This PR describes vtables as arrays of `*const u8` pointers. It would nice to describe them as structs where function pointer is represented by a field with a name indicative of the method it maps to. However, this requires coming up with a naming scheme that avoids clashes between methods with the same name (which is possible if the vtable contains multiple traits).
- The PR does not update the debuginfo we generate for the vtable-pointer field in a fat `dyn` pointer. Right now there does not seem to be an easy way of getting ahold of a vtable-layout without also knowing the concrete self-type of a trait object.
r? `@wesleywiser`
|
|
Rollup of 6 pull requests
Successful merges:
- #89579 (Add regression test for issue 80108)
- #89632 (Fix docblock code display on mobile)
- #89691 (Move `DebuggerCommands` and `check_debugger_output` to a separate module)
- #89707 (Apply clippy suggestions for std)
- #89722 (Fix spelling: Cannonical -> Canonical)
- #89736 (Remove unused CSS rule)
Failed merges:
r? `@ghost`
`@rustbot` modify labels: rollup
|
|
Fix docblock code display on mobile
Fixes https://github.com/rust-lang/rust/issues/89618.
Before:

After:

r? `@jsha`
|
|
Add regression test for issue 80108
Closes #80108
|
|
Cleanup src/test/ui/{simd,simd-intrinsic}
Initial motivation was to simplify a huge macro expansion using a tuple, since we can just use an array in `#[repr(simd)]` now for the same result. But also, several tests were going unnoticed during development of SIMD intrinsics because people kept looking in the wrong directory, and many are basically run-pass vs. build-fail versions of the same tests, so let's keep them close together and simplify their names, so they're easier to sift through.
|
|
|
|
Rollup of 11 pull requests
Successful merges:
- #88374 (Fix documentation in Cell)
- #88713 (Improve docs for int_log)
- #89428 (Feature gate the non_exhaustive_omitted_patterns lint)
- #89438 (docs: `std::hash::Hash` should ensure prefix-free data)
- #89520 (Don't rebuild GUI test crates every time you run test src/test/rustdoc-gui)
- #89705 (Cfg hide no_global_oom_handling and no_fp_fmt_parse)
- #89713 (Fix ABNF of inline asm options)
- #89718 (Add #[must_use] to is_condition tests)
- #89719 (Add #[must_use] to char escape methods)
- #89720 (Add #[must_use] to math and bit manipulation methods)
- #89735 (Stabilize proc_macro::is_available)
Failed merges:
r? `@ghost`
`@rustbot` modify labels: rollup
|
|
r=petrochenkov
Stabilize proc_macro::is_available
Tracking issue: https://github.com/rust-lang/rust/issues/71436
The FCP for the stabilization of `proc_macro::is_available` has completed.
|
|
Feature gate the non_exhaustive_omitted_patterns lint
Fixes https://github.com/rust-lang/rust/issues/89374
Add the machinery to gate the new `non_exhaustive_omitted_patterns` lint.
relates to https://github.com/rust-lang/rust/pull/89105 and https://github.com/rust-lang/rust/pull/89423
|
|
Show detailed expected/found types in error message when trait paths are the same
Fixes #65230.
### Issue solved by this PR
```rust
trait T {
type U;
fn f(&self) -> Self::U;
}
struct X<'a>(&'a mut i32);
impl<'a> T for X<'a> {
type U = &'a i32;
fn f(&self) -> Self::U {
self.0
}
}
fn main() {}
```
Compiler generates the following note:
```
note: ...so that the types are compatible
--> test.rs:10:28
|
10 | fn f(&self) -> Self::U {
| ____________________________^
11 | | self.0
12 | | }
| |_____^
= note: expected `T`
found `T`
```
This note is not useful since the expected type and the found type are the same.
### How this PR solve the issue
When the expected type and the found type are exactly the same in string representation, the note falls back to the detailed string representation of trait ref:
```
note: ...so that the types are compatible
--> test.rs:10:28
|
10 | fn f(&self) -> Self::U {
| ____________________________^
11 | | self.0
12 | | }
| |_____^
= note: expected `<X<'a> as T>`
found `<X<'_> as T>`
```
So that a user can notice what was different between the expected one and the found one.
|
|
|
|
|
|
|
|
because previous test does not cause the expected error message when
`-Z borrowck=mir`.
|
|
Refactor fingerprint reconstruction
This PR replaces can_reconstruct_query_key with fingerprint_style, which returns the style of the fingerprint for that query. This allows us to avoid trying to extract a DefId (or equivalent) from keys which *are* reconstructible because they're () but not as DefIds.
This is done with the goal of fixing -Zdump-dep-graph, which seems to have broken a while ago (I didn't try to bisect). Currently even on a `fn main() {}` file it'll ICE (you need to also pass -Zquery-dep-graph for it to work at all), and this patch indirectly fixes the cause of that ICE. This also adds a test for it continuing to work.
|
|
|
|
Fix min LLVM version for bpf-types test
The test requires https://reviews.llvm.org/D102118 which was released in LLVM 13.
Closes #89689
|
|
make #[target_feature] work with `asm` register classes
Fixes #89289
|
|
rustc_driver: Enable the `WARN` log level by default
This commit changes the `tracing_subscriber` initialization in
`rustc_driver` so that the `WARN` verbosity level is enabled by default
when the `RUSTC_LOG` env variable is empty. If the `RUSTC_LOG` env
variable is set, the filter string in the environment variable is
honored, instead.
Fixes #76824
Closes #89623
cc ``@eddyb,`` ``@oli-obk``
|
|
Closes #89689
|
|
Actually add the feature to the lints ui test
Add tracking issue to the feature declaration
Rename feature gate to non_exhaustive_omitted_patterns_lint
Add more omitted_patterns lint feature gate
|
|
Remove special-casing of never primitive in rustdoc-json-types
Fixes https://github.com/rust-lang/rust/issues/89349
r? `@GuillaumeGomez`
|
|
Make rustdoc not highlight `->` and `=>` as operators
It was marking them up as `<span class="op">=</span><span class="op">></span>`,
which is bloaty and wrong (at least, I think `<=` and `=>` should probably be different colors, since they're so different and yet made from the same symbols).
Before:

After:

|
|
Don't normalize xform_ret_ty during method candidate assembly
Fixes https://github.com/rust-lang/rust/issues/85671
Normalizing the return type of a method candidate together with the expected receiver type of the method can lead to valid method candidates being rejected during probing. Specifically in the example of the fixed issue we have a `self_ty` of the form `&A<&[Coef]>` whereas the `impl_ty` of the method would be `&A<_>`, if we normalize the projection in the return type we unify the inference variable with `Cont`, which will lead us to reject the candidate in the sup type check in `consider_probe`. Since we don't actually need the normalized return type during candidate assembly, we postpone the normalization until we consider candidates in `consider_probe`.
|
|
Signed-off-by: Eliza Weisman <eliza@buoyant.io>
|
|
same
|
|
|
|
Prevent error reporting from outputting a recursion error if it finds an ambiguous trait impl during suggestions
Closes #89275
This fixes the compiler reporting a recursion error during another already in progress error by trying to make a conversion method suggestion and encounters ambiguous trait implementations that can convert a the original type into a type that can then be recursively converted into itself via another method in the trait.
Updated OverflowError struct to be an enum so I could differentiate between passes - it's no longer a ZST but I don't think that should be a problem as they only generate when there's an error in compiling code anyway
|
|
Turn vtable_allocation() into a query
This PR removes the untracked vtable-const-allocation cache from the `tcx` and turns the `vtable_allocation()` method into a query.
The change is pretty straightforward and should be backportable without too much effort.
Fixes https://github.com/rust-lang/rust/issues/89598.
|
|
|
|
Before this commit all vtables would have the same name "vtable" in
debuginfo. Now they get a name that identifies the implementing type
and the trait that is being implemented.
|
|
Use correct edition for panic in [debug_]assert!().
See https://github.com/rust-lang/rust/issues/88638#issuecomment-915472783
|
|
Correct decoding of foreign expansions during incr. comp.
Fixes https://github.com/rust-lang/rust/issues/74946
The original issue was due to a wrong assertion in `expn_hash_to_expn_id`.
The secondary issue was due to a mismatch between the encoding and decoding paths for expansions that are created after the TyCtxt is created.
|
|
Implement `#[link_ordinal(n)]`
Allows the use of `#[link_ordinal(n)]` with `#[link(kind = "raw-dylib")]`, allowing Rust to link against DLLs that export symbols by ordinal rather than by name. As long as the ordinal matches, the name of the function in Rust is not required to match the name of the corresponding function in the exporting DLL.
Part of #58713.
|
|
|
|
|
|
Rollup of 7 pull requests
Successful merges:
- #89298 (Issue 89193 - Fix ICE when using `usize` and `isize` with SIMD gathers )
- #89461 (Add `deref_into_dyn_supertrait` lint.)
- #89477 (Move items related to computing diffs to a separate file)
- #89559 (RustWrapper: adapt for LLVM API change)
- #89585 (Emit item no type error even if type inference fails)
- #89596 (Make cfg imply doc(cfg))
- #89615 (Add InferCtxt::with_opaque_type_inference to get_body_with_borrowck_facts)
Failed merges:
r? `@ghost`
`@rustbot` modify labels: rollup
|
|
Make cfg imply doc(cfg)
This is a reopening of #79341, rebased and modified a bit (we made a lot of refactoring in rustdoc's types so they needed to be reflected in this PR as well):
* `hidden_cfg` is now in the `Cache` instead of `DocContext` because `cfg` information isn't stored anymore on `clean::Attributes` type but instead computed on-demand, so we need this information in later parts of rustdoc.
* I removed the `bool_to_options` feature (which makes the code a bit simpler to read for `SingleExt` trait implementation.
* I updated the version for the feature.
There is only one thing I couldn't figure out: [this comment](https://github.com/rust-lang/rust/pull/79341#discussion_r561855624)
> I think I'll likely scrap the whole `SingleExt` extension trait as the diagnostics for 0 and >1 items should be different.
How/why should they differ?
EDIT: this part has been solved, the current code was fine, just needed a little simplification.
cc `@Nemo157`
r? `@jyn514`
Original PR description:
This is only active when the `doc_cfg` feature is active.
The implicit cfg can be overridden via `#[doc(cfg(...))]`, so e.g. to hide a `#[cfg]` you can use something like:
```rust
#[cfg(unix)]
#[doc(cfg(all()))]
pub struct Unix;
```
By adding `#![doc(cfg_hide(foobar))]` to the crate attributes the cfg `#[cfg(foobar)]` (and _only_ that _exact_ cfg) will not be implicitly treated as a `doc(cfg)` to render a message in the documentation.
|
|
Emit item no type error even if type inference fails
Fix #89574
The stashed error should be emitted regardless whether ty references error or not.
|
|
Add `deref_into_dyn_supertrait` lint.
Initial implementation of #89460. Resolves #89190.
Maybe also worth a beta backport if necessary.
r? `@nikomatsakis`
|
|
Issue 89193 - Fix ICE when using `usize` and `isize` with SIMD gathers
closes #89193
r? `@workingjubilee`
|
|
Introduce `tcx.get_diagnostic_name`
Introduces a "reverse lookup" for diagnostic items. This is mainly intended for `@rust-lang/clippy` which often does a long series of `is_diagnostic_item` calls for the same `DefId`.
r? `@oli-obk`
|
|
|
|
Array `.len()` MIR optimization pass
This pass kind-of works back the `[T; N].len()` call that at the moment is first coerced as `&[T; N]` -> `&[T]` and then uses `&[T].len()`. Depends on #86383
|
|
|