| Age | Commit message (Collapse) | Author | Lines |
|
rustdoc: apply `pre-wrap` CSS to code-wrapped links
This is common syntax used for intra-doc links, so fixing it should help with doc formatting.
|
|
r=wesleywiser
fold instead of obliterating args
Fixes #105608
we call `const_eval_resolve` on the following constant:
```
def: playground::{impl#0}::and::{constant#0},
substs: [
ConstKind::Unevaluated {
def: playground::{impl#0}::and::{constant#0},
substs: [
ConstKind::Value(0x0),
_,
]
}
_,
],
```
when expanded out to `ConstKind::Expr` there are no infer vars so we attempt to evaluate it after replacing infer vars with garbage, however the current logic for replacing with garbage replaces _the whole arg containing the infer var_ rather than just the infer var. This means that after garbage replacement has occured we attempt to evaluate:
```
def: playground::{impl#0}::and::{constant#0},
substs: [
PLACEHOLDER,
PLACEHOLDER,
],
```
Which then leads to ctfe being unable to evaluate the const. With this PR we attempt to evaluate:
```
def: playground::{impl#0}::and::{constant#0},
substs: [
ConstKind::Unevaluated {
def: playground::{impl#0}::and::{constant#0},
substs: [
ConstKind::Value(0x0),
PLACEHOLDER,
]
}
PLACEHOLDER,
],
```
which ctfe _can_ handle.
I am not entirely sure why this function is supposed to replace params with placeholders rather than just inference vars :thinking:
|
|
r=compiler-errors
Suggest dereferencing receiver arguments properly
Fixes #105429
|
|
Suggest `collect`ing into `Vec<_>`
Fix #105510.
|
|
Suggest impl in the scenario of typo with fn
Fixes #105366
|
|
Illegal sized bounds: only suggest mutability change if needed
In a scenario like
```rust
struct Type;
pub trait Trait {
fn function(&mut self)
where
Self: Sized;
}
impl Trait for Type {
fn function(&mut self) {}
}
fn main() {
(&mut Type as &mut dyn Trait).function();
}
```
the problem is Sized, not the mutability of self. Thus don't emit the "you need &T instead of &mut T" note, or the other way around, as all it does is just invert the mutability of whatever was supplied.
Fixes #103622.
|
|
Refine when invalid prefix case error arises
Fix cases where the "invalid base prefix for number literal" error arises with suffixes that look erroneously capitalized but which are actually invalid.
|
|
|
|
|
|
|
|
|
|
Properly handle postfix inc/dec in standalone and subexpr scenarios
Fixes #104867
r? `@estebank`
|
|
Combine `ty::Projection` and `ty::Opaque` into `ty::Alias`
Implements https://github.com/rust-lang/types-team/issues/79.
This PR consolidates `ty::Projection` and `ty::Opaque` into a single `ty::Alias`, with an `AliasKind` and `AliasTy` type (renamed from `ty::ProjectionTy`, which is the inner data of `ty::Projection`) defined as so:
```
enum AliasKind {
Projection,
Opaque,
}
struct AliasTy<'tcx> {
def_id: DefId,
substs: SubstsRef<'tcx>,
}
```
Since we don't have access to `TyCtxt` in type flags computation, and because repeatedly calling `DefKind` on the def-id is expensive, these two types are distinguished with `ty::AliasKind`, conveniently glob-imported into `ty::{Projection, Opaque}`. For example:
```diff
match ty.kind() {
- ty::Opaque(..) =>
+ ty::Alias(ty::Opaque, ..) => {}
_ => {}
}
```
This PR also consolidates match arms that treated `ty::Opaque` and `ty::Projection` identically.
r? `@ghost`
|
|
detect the pattern at the general site parse_impl_ty()
this will fix #102598
|
|
|
|
Rollup of 7 pull requests
Successful merges:
- #105147 (Allow unsafe through inline const)
- #105438 (Move some codegen-y methods from `rustc_hir_analysis::collect` -> `rustc_codegen_ssa`)
- #105464 (Support #[track_caller] on async closures)
- #105476 (Change pattern borrowing suggestions to be verbose and remove invalid suggestion)
- #105500 (Make some diagnostics not depend on the source of what they reference being available)
- #105628 (Small doc fixes)
- #105659 (Don't require owned data in `MaybeStorageLive`)
Failed merges:
r? `@ghost`
`@rustbot` modify labels: rollup
|
|
|
|
Make some diagnostics not depend on the source of what they reference being available
r? `@estebank`
follow up to https://github.com/rust-lang/rust/pull/104449
|
|
Change pattern borrowing suggestions to be verbose and remove invalid suggestion
Synthesize a more accurate span and use verbose suggestion output to
make the message clearer.
Do not suggest borrowing binding in pattern in let else. Fix #104838.
|
|
Support #[track_caller] on async closures
Follow up on #105180
r? ```@compiler-errors```
cc ```@cjgillot```
|
|
Allow unsafe through inline const
Handle similar to closures.
Address https://github.com/rust-lang/rust/pull/104087#issuecomment-1324173328
Note that this PR does not fix the issue for `unsafe { [0; function_requiring_unsafe()] }`. This is fundamentally unfixable for MIR unsafeck IMO.
This PR also does not fix unsafety checking for inline const in pattern position. It actually breaks it, allowing unsafe functions to be used in inline const in pattern position without unsafe blocks. Inline const in pattern position is not visible in MIR so ignored by MIR unsafety checking (currently it is also not checked by borrow checker, which is the reason why it's considered an incomplete feature).
`@rustbot` label: +T-lang +F-inline_const
|
|
fix a stderr
|
|
|
|
|
|
Remove previously existing fallback that tried to give a good turbofish
suggestion, `need_type_info` is already good enough.
Special case `::<Vec<_>` suggestion for `Iterator::collect`.
|
|
|
|
|
|
|
|
|
|
Fix #104838.
|
|
Synthesize a more accurate span and use verbose suggestion output to
make the message clearer.
|
|
|
|
This is common syntax used for intra-doc links, so fixing it should help
with doc formatting.
|
|
|
|
It's not about "uninit" anymore but about "filling with 0x01 bytes" so
the name should at least try to reflect that.
|
|
|
|
|
|
|
|
|
|
If we have a call such as `foo(&mut buf)` and after reference
collapsing the type is inferred as `&T` where-as the required type is
`&mut T`, don't suggest `foo(&mut mut buf)`. This is wrong syntactically
and the issue lies elsewhere, not in the borrow.
Fixes #105645
|
|
|
|
|
|
|
|
|
|
|
|
|
|
relying on the span making it obvious
|
|
available
|
|
Fast-path some binder relations
A simpler approach than #104598
Fixes #104583
r? types
|
|
Fix cases where the "invalid base prefix for number literal" error arises with
suffixes that look erroneously capitalized but which are in fact invalid.
|