| Age | Commit message (Collapse) | Author | Lines |
|
|
|
Reword trying to operate in immutable fields
The previous message ("cannot assign/mutably borrow immutable field")
when trying to modify a field of an immutable binding gave the
(incorrect) impression that fields can be mutable independently of their
ADT's binding. Slightly reword the message to read "cannot
assign/mutably borrow field of immutable binding".
Re #35937.
|
|
Allow lifetimes in macros
This is a resurrection of PR #41927 which was a resurrection of #33135, which is intended to fix #34303.
In short, this allows macros_rules! to use :lifetime as a matcher to match 'lifetimes.
Still to do:
- [x] Feature gate
|
|
Add a tidy check for missing or too many trailing newlines.
I've noticed recently there are lots of review comments requesting to fix trailing newlines. If this is going to be an official style here, it's better to let the CI do this repetitive check.
|
|
The previous message ("cannot assign/mutably borrow immutable field")
when trying to modify a field of an immutable binding gave the
(incorrect) impression that fields can be mutable independently of their
ADT's binding. Slightly reword the message to read "cannot
assign/mutably borrow field of immutable binding".
|
|
Resolves #47073.
|
|
|
|
|
|
|
|
Pass correct span when lowering grouped imports
Solves incorrect diagnostics for unused or deprecated imports. Closes #46576.
Deprecated imports had an existing test which asserted the incorrect span.
That test has been corrected as part of this commit.
|
|
Implements RFC 1937: `?` in `main`
This is the first part of the RFC 1937 that supports new
`Termination` trait in the rust `main` function.
Thanks @nikomatsakis, @arielb1 and all other people in the gitter channel for all your help!
The support for doctest and `#[test]` is still missing, bu as @nikomatsakis said, smaller pull requests are better :)
|
|
Use def span for non-ascii ident feature gate error
|
|
Solves incorrect diagnostics for unused or deprecated imports. Closes #46576.
Deprecated imports had an existing test which asserted the incorrect span.
That test has been corrected as part of this commit.
|
|
"incompatible arm" diagnostic span tweak
Use span label instead of span note for single line spans in
"incompatible arm" diagnostic.
|
|
This avoids bringing in unwind machinery.
|
|
Update check::cast::pointer_kind logic to new rustc
Make the match exhaustive, adding handling for anonymous types and
tuple coercions on the way.
Also, exit early when type errors are detected, to avoid error cascades
and the like.
Fixes #33690.
Fixes #46365.
Fixes #46880.
|
|
Use span label instead of span note for single line spans in
"incompatible arm" diagnostic.
|
|
MIR borrowck: no "move occurs because `X` is not Copy` error
Fixes #46631.
r? @arielb1
|
|
Convert warning about `*const _` to a future-compat lint
#46664 was merged before I could convert the soft warning about method lookup on `*const _` into a future-compatibility lint. This PR makes that change.
fixes #46837
tracking issue for the future-compatibility lint: #46906
r? @arielb1
|
|
These can happen if prior errors disable defaulting.
Fixes #43825.
|
|
Make the match exhaustive, adding handling for anonymous types and
tuple coercions on the way.
Also, exit early when type errors are detected, to avoid error cascades
and the like.
|
|
Closure type error ui tweak
Do not point at the same span on all notes/help messages, and instead
show them without a span.
|
|
Point at `while true` span instead of entire block
|
|
Followup for #46112.
Sorting by crate-num should ensure that we favor `std::foo::bar` over
`any_other_crate::foo::bar`.
Interestingly, *this* change had a much larger impact on our internal
test suite than PR #46708 (which was my original fix to #46112).
|
|
|
|
|
|
|
|
Do not emit type errors on recovered blocks
When a parse error occurs on a block, the parser will recover and create
a block with the statements collected until that point. Now a flag
stating that a recovery has been performed in this block is propagated
so that the type checker knows that the type of the block (which will be
identified as `()`) shouldn't be checked against the expectation to
reduce the amount of irrelevant diagnostic errors shown to the user.
Fix #44579.
|
|
When a parse error occurs on a block, the parser will recover and create
a block with the statements collected until that point. Now a flag
stating that a recovery has been performed in this block is propagated
so that the type checker knows that the type of the block (which will be
identified as `()`) shouldn't be checked against the expectation to
reduce the amount of irrelevant diagnostic errors shown to the user.
|
|
Generics refactoring (groundwork for const generics)
These changes were suggested by @eddyb.
After this change, the `Generics` contain one `Vec` of an enum for the generic parameters, rather than two separate `Vec`s for lifetime and type parameters. Type params and const params will need to be in a shared `Vec` to preserve their ordering, and moving lifetimes into the same `Vec` should simplify the code that processes `Generics`.
|
|
The Generics now contain one Vec of an enum for the generic parameters,
rather than two separate Vec's for lifetime and type parameters.
Additionally, places that previously used Vec<LifetimeDef> now use
Vec<GenericParam> instead.
|
|
Use def span for associated function suggestions
|
|
syntax: Follow-up to the incorrect qpath recovery PR
cc https://github.com/rust-lang/rust/pull/46788
Add tests checking that "priority" of qpath recovery is higher than priority of unary and binary operators
Fix regressed parsing of paths with fn-like generic arguments
r? @estebank
|
|
Implement non-mod.rs mod statements
Fixes https://github.com/rust-lang/rust/issues/45385, cc https://github.com/rust-lang/rust/issues/44660
This will fail tidy right now because it doesn't recognize my UI tests as feature-gate tests. However, I'm not sure if compile-fail will work out either because compile-fail usually requires there to be error patterns in the top-level file, which isn't possible with this feature. What's the recommended way to handle this?
|
|
|
|
and binary operators
|
|
The "match exact bits of CFG" approach was fragile and uninformative.
|
|
Also, keep reporting AST-based region errors that are not occuring in
a fn body.
|
|
|
|
|
|
|
|
|
|
Closes #45988
|
|
We now add the suitable `impl Trait` constraints.
|
|
|
|
The type isn't a good idea because we want to treat constants
uniformly, regardless of what type of value they produce.
|
|
|
|
Point at def span in "missing in impl" error
|
|
r=petrochenkov
Remove a token after closing delimiter from the span of macro in type position
e.g.
```rust
let x = y: foo!();
```
The span for `foo!()` includes `;`.
cc https://github.com/rust-lang-nursery/rustfmt/issues/2290.
|
|
nll part 5
Next round of changes from the nll-master branch.
Extensions:
- we now propagate ty-region-outlives constraints out of closures and into their creator when necessary
- we fix a few ICEs that can occur by doing liveness analysis (and the resulting normalization) during type-checking
- we handle the implicit region bound that assumes that each type `T` outlives the fn body
- we handle normalization of inputs/outputs in fn signatures
Not included in this PR (will come next):
- handling `impl Trait`
- tracking causal information
- extended errors
r? @arielb1
|