| Age | Commit message (Collapse) | Author | Lines |
|
edit and fix bad spacing of inner-attribute-not-allowed note
This multiline string literal was missing a backslash, leaving an awkward
newline and 35 spaces in the middle of the message.
But while we're here, the existing message seems kind of long in comparison to
similar notes: to cut it down, we excise the mentions of doc comments, which
seems sensible because we know that this erroneous attribute is not a doc
comment (notice the `is_sugared_doc: false` at the end of the function; if it
had been a doc comment, that error would get set in the `token::DocComment`
match branch of `parse_outer_attributes`).
|
|
leodasvacas:document-that-call-can-be-adt-constructor, r=estebank
Document that call expressions also represent ADT constructors.
This is a rather obscure part of the language.
|
|
|
|
|
|
|
|
This multiline string literal was missing a backslash, leaving an awkward
newline and 35 spaces in the middle of the message.
But while we're here, the existing message seems kind of long in comparison to
similar notes: to cut it down, we excise the mentions of doc comments, which
seems sensible because we know that this erroneous attribute is not a doc
comment (notice the `is_sugared_doc: false` at the end of the function; if it
had been a doc comment, that error would get set in the `token::DocComment`
match branch of `parse_outer_attributes`).
|
|
|
|
Fix a quadradic duplication in json for multi-suggestions
r? @petrochenkov
|
|
Implement RFC 1861: Extern types
A few notes :
- Type parameters are not supported. This was an unresolved question from the RFC. It is not clear how useful this feature is, and how variance should be treated. This can be added in a future PR.
- `size_of_val` / `align_of_val` can be called with extern types, and respectively return 0 and 1. This differs from the RFC, which specified that they should panic, but after discussion with @eddyb on IRC this seems like a better solution.
If/when a `DynSized` trait is added, this will be disallowed statically.
- Auto traits are not implemented by default, since the contents of extern types is unknown. This means extern types are `!Sync`, `!Send` and `!Freeze`. This seems like the correct behaviour to me.
Manual `unsafe impl Sync for Foo` is still possible.
- This PR allows extern type to be used as the tail of a struct, as described by the RFC :
```rust
extern {
type OpaqueTail;
}
#[repr(C)]
struct FfiStruct {
data: u8,
more_data: u32,
tail: OpaqueTail,
}
```
However this is undesirable, as the alignment of `tail` is unknown (the current PR assumes an alignment of 1). Unfortunately we can't prevent it in the general case as the tail could be a type parameter :
```rust
#[repr(C)]
struct FfiStruct<T: ?Sized> {
data: u8,
more_data: u32,
tail: T,
}
```
Adding a `DynSized` trait would solve this as well, by requiring tail fields to be bound by it.
- Despite being unsized, pointers to extern types are thin and can be casted from/to integers. However it is not possible to write a `null<T>() -> *const T` function which works with extern types, as I've explained here : https://github.com/rust-lang/rust/issues/43467#issuecomment-321678621
- Trait objects cannot be built from extern types. I intend to support it eventually, although how this interacts with `DynSized`/`size_of_val` is still unclear.
- The definition of `c_void` is unmodified
|
|
Improve diagnostics when list of tokens has incorrect separators
Make `parse_seq_to_before_tokens` more resilient to error conditions. Where possible it is better if it can consume up to the final bracket before returning. This change improves the diagnostics in a couple of situations:
```
struct S(pub () ()); // omitted separator
use std::{foo. bar}; // used a similar but wrong separator
```
Fixes #44339
r? @petrochenkov
|
|
|
|
This is a rather obscure part of the language.
|
|
Visit attribute tokens in `DefCollector` and `BuildReducedGraphVisitor`
Fixes #44851.
|
|
|
|
Add short error message-format
Fixes #42653.
|
|
|
|
|
|
|
|
r=nikomatsakis
`crate` shorthand visibility modifier
cc #45388.
r? @nikomatsakis
|
|
Move Generics from MethodSig to TraitItem and ImplItem
As part of `rust-impl-period/WG-compiler-traits`, we want to "lift" `Generics` from `MethodSig` into `TraitItem` and `ImplItem`. This is in preparation for adding associated type generics. (https://github.com/rust-lang/rust/issues/44265#issuecomment-331172238)
Currently this change is only made in the AST. In the future, it may also impact the HIR. (Still discussing)
To understand this PR, it's probably best to start from the changes to `ast.rs` and then work your way to the other files to understand the far reaching effects of this change.
r? @nikomatsakis
|
|
|
|
With regrets, this breaks rustfmt and rls.
This is in the matter of #45388.
|
|
|
|
code suggestions for non-shorthand field pattern, no-mangle lints
continuing in the spirit of #44942

r? @estebank
|
|
|
|
|
|
support generics in each variant of TraitItem and ImplItem
|
|
We also edit the lint description to clarify that this is different from
the struct field init shorthand.
|
|
While an inner attribute here is in fact erroneous, that error ("inner
attribute is not permitted in this context") successfully gets set earlier;
this further admonition is nonsensical.
Resolves #45296.
|
|
|
|
Better error message for comma after base struct
#41834
This adds a better error for commas after the base struct:
```
let foo = Foo {
one: 111,
..Foo::default(), // This comma is a syntax error
};
```
The current error is a generic `expected one of ...` which isn't beginner-friendly. My error looks like this:
```
error: cannot use a comma after the base struct
--> tmp/example.rs:26:9
|
26 | ..Foo::default(),
| ^^^^^^^^^^^^^^^^- help: remove this comma
|
= note: the base struct expansion must always be the last field
```
I even added a note for people who don't know why this isn't allowed.
|
|
Better compile error output when using arguments instead of types
Following @estebank sugestion on issue https://github.com/rust-lang/rust/issues/18945#issuecomment-331251436
|
|
` (U+0060) should be the "grave" accent, not "Greek" accent.
|
|
output message is shown in another 'help:' block
line with +100 columns formatted
test adjusted
|
|
`let x = { ..default(), } // This comma is an error`
|
|
Improve diagnostics for `x as usize << y`
|
|
Add a semicolon to span for ast::Local
|
|
See the [RFC] and [tracking issue].
[tracking issue]: https://github.com/rust-lang/rust/issues/42640
[RFC]: https://github.com/rust-lang/rfcs/blob/491e0af/text/2005-match-ergonomics.md
|
|
|
|
address some FIXME whose associated issues were marked as closed
part of #44366
|
|
add the issue number to doc_masked's feature gate
Whoops, missed this in the original `#[doc(masked)]` PR.
|
|
fix ItemKind::DefaultImpl doc comment
Upgrade comment to doc comment.
...Is this actually used? If so, why does the `Impl` variant right below have a `Defaultness`?
|
|
Don't use remapped path when loading modules and include files
Fixes bug reported in https://github.com/rust-lang/rust/issues/41555#issuecomment-327866056.
cc @michaelwoerister
|
|
|
|
|
|
|
|
Upgrade comment to doc comment.
|
|
Also, fix the deprecation message for the late no-debug feature.
|
|
|
|
remove FIXME(#13101) since `assert_receiver_is_total_eq` stays.
remove FIXME(#19649) now that stability markers render.
remove FIXME(#13642) now the benchmarks were moved.
remove FIXME(#6220) now that floating points can be formatted.
remove FIXME(#18248) and write tests for `Rc<str>` and `Rc<[u8]>`
remove reference to irelevent issues in FIXME(#1697, #2178...)
update FIXME(#5516) to point to getopts issue 7
update FIXME(#7771) to point to RFC 628
update FIXME(#19839) to point to issue 26925
|