| Age | Commit message (Collapse) | Author | Lines |
|
- Handle empty `cfg_attr` attribute
- Reword empty `derive` attribute error
- Use consistend error message: "malformed `attrname` attribute input"
- Provide suggestions when possible
- Move note/help to label/suggestion
- Use consistent wording "ill-formed" -> "malformed"
- Move diagnostic logic out of parser
|
|
|
|
|
|
|
|
|
|
- Add detail on origin of current parser when reaching EOF and stop
saying "found <eof>" and point at the end of macro calls
- Handle empty `cfg_attr` attribute
- Reword empty `derive` attribute error
|
|
Remove `ObsoleteInPlace`
The in place syntax has been deprecated for over a year. As it is, this is accumulated cruft: the error messages are unlikely to be helpful any more and it conflicts with some useful syntax (e.g. const generics in some instances).
It may be that removing `Token::LArrow` is backwards-incompatible. We should do a crater run to check.
cc @eddyb
|
|
r=pnkfelix
Borrowck error reporting cleanup
* Don't show variables created by desugarings in borrowck errors
* Move "conflict error" reporting to it's own module, so that `error_reporting` contains only common error reporting methods.
* Remove unused `ScopeTree` parameter.
r? @pnkfelix
|
|
|
|
tweak discriminant on non-nullary enum diagnostic
Adds notes pointing at the non-nullary variants, and uses "custom
discriminant" language to be consistent with the Reference.
Fixes #61039.
r? @estebank
|
|
Adds notes pointing at the non-nullary variants, and uses "custom
discriminant" language to be consistent with the Reference.
|
|
syntax: Continue refactoring literals
A follow up to https://github.com/rust-lang/rust/pull/60679.
https://github.com/rust-lang/rust/commit/a2fd002bd5a91ba7997057724b72b9dac8fae550: Similarly to `EscapeError`, literal parsing now produces a `LitError`.
This way we can get rid of `diag: Option<(Span, &Handler)>` in interfaces while leaving attr/mod alone.
https://github.com/rust-lang/rust/commit/d9516d11208456d4a17fe68a34c1d0a00334e62c: Gathers all components of a literal token in a single struct.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Rollup of 7 pull requests
Successful merges:
- #60981 (Bump compiler-builtins to 0.1.15)
- #61014 (Make -Zemit-artifact-notifications also emit the artifact type)
- #61043 (Disable LLVM/debug assertions in gnu-full-bootstrap)
- #61046 (Fix ICE with inconsistent macro matchers)
- #61055 (Solaris CI: Build with dilos2 stable)
- #61057 (Revert "Add implementations of last in terms of next_back on a bunch of DoubleEndedIterators.")
- #61073 (librustc_errors: Remove unused annotation style `OldSchoolNoteText`)
Failed merges:
r? @ghost
|
|
Fix ICE with inconsistent macro matchers
Fixes #61033
r? @petrochenkov
|
|
Make -Zemit-artifact-notifications also emit the artifact type
This is easier for tooling to handle than trying to reverse-engineer the type from the filename extension. The field name and value is intended to reflect the `--emit` command-line option.
Related issues https://github.com/rust-lang/rust/issues/60988 https://github.com/rust-lang/rust/issues/58465
cc @alexcrichton
|
|
Add match arm scopes and other scope fixes
* Add drop and lint scopes for match arms.
* Lint attributes are now respected on match arms.
* Make sure we emit a StorageDead if we diverge when initializing a temporary.
* Adjust MIR pretty printing of scopes for locals.
* Don't generate duplicate lint scopes for `let statements`.
* Add some previously missing fake borrows for matches.
closes #46525
cc @rust-lang/compiler
|
|
Simplify use of keyword symbols
They mirror non-keyword symbols now (see https://github.com/rust-lang/rust/pull/60630).
`keywords::MyKeyword.name()` -> `kw::MyKeyword`
`keywords::MyKeyword.ident()` -> `Ident::with_empty_ctxt(kw::MyKeyword)` (not common)
`keywords::Invalid.ident()` -> `Ident::invalid()` (more common)
Keywords are simply `Symbol` constants now, the `Keyword` struct is eliminated.
This means `kw::MyKeyword` can now be used in `match` in particular.
|
|
|
|
|
|
|
|
|
|
is FFI safe
This allows types like Option<NonZeroU8> to be used in FFI without triggering the improper_ctypes lint. This works by changing the is_repr_nullable_ptr function to consider an enum E to be FFI-safe if:
- E has no explicit #[repr(...)].
- It only has two variants.
- One of those variants is empty (meaning it has no fields).
- The other variant has only one field.
- That field is one of the following:
- &T
- &mut T
- extern "C" fn
- core::num::NonZero*
- core::ptr::NonNull<T>
- #[repr(transparent)] struct wrapper around one of the types in this list.
- The size of E and its field are both known and are both the same size (implying E is participating in the nonnull optimization).
|
|
Ban multi-trait objects via trait aliases
Obviously, multi-trait objects are not normally supported, so they should not be supported via trait aliases.
This has been factored out from the previous PR https://github.com/rust-lang/rust/pull/55994 (see point 1).
r? @Centril
CC @nikomatsakis
------------------
### RELNOTES:
We now allow `dyn Send + fmt::Debug` with equivalent semantics to `dyn fmt::Debug + Send`.
That is, the order of the mentioned traits does not matter wrt. principal/not-principal traits.
This is a small change that might deserve a mention in the blog post because it is a language change but most likely not.
See https://github.com/rust-lang/rust/blob/ce2ee305f9165c037ecddddb5792588a15ff6c37/src/test/ui/traits/wf-trait-object-reverse-order.rs.
// @Centril
|
|
r=michaelwoerister
Add stream_to_parser_with_base_dir
This PR adds `stream_to_parser_with_base_dir`, which creates a parser from a token stream and a base directory.
Context: I would like to parse `cfg_if!` macro and get a list of modules defined inside it from rustfmt so that rustfmt can format those modules (cc https://github.com/rust-lang/rustfmt/issues/3253). To do so, I need to create a parser from `TokenStream` and set the directory of `Parser` to the same directory as the parent directory of a file which contains `cfg_if!` invocation. AFAIK there is no way to achieve this, and hence this PR.
Alternatively, I could change the visibility of `Parser.directory` from `crate` to `pub` so that the value can be modified after initializing a parser. I don't have a preference over either approach (or others, as long as it works).
|
|
This is easier for tooling to handle than trying to reverse-engineer it from the filename extension.
|
|
|
|
|
|
|
|
|
|
|
|
r=petrochenkov
Move gensym operations from `Symbol` to `Ident`
Gensyms are always at the `Ident` level, and long-term we probably want to record gensym-ness in hygiene data.
r? @petrochenkov
|
|
|
|
rustc: Improve type size assertions
Now they
- Tell what the new size is, when it changes
- Do not require passing an identifier
```
::: src\libsyntax\parse\token.rs:223:1
|
223 | static_assert_size!(Token, 123);
| -------------------------------- in this macro invocation
|
= note: expected type `[(); 123]`
found type `[(); 16]`
```
|
|
Fix incremental compilation of cdylib emitting spurious unused_attributes lint
fixes #60050
|
|
|
|
|
|
|
|
Note that the `is_gensymed` call on `primitive_types` is unnecessary
because that table only contains the name of primitive types (e.g.
`i32`) and never contains gensyms.
|
|
Now they
- Tell what the new size is, when it changes
- Do not require passing an identifier
|
|
r=petrochenkov
Avoid some unnecessary interning
r? @petrochenkov
|
|
Handle more string addition cases with appropriate suggestions
|
|
A lot of these static symbols are pre-interned.
|
|
|
|
|