Commit Graph

244 Commits

Author SHA1 Message Date
csmoe 64f61c7888 remove indexed_vec re-export from rustc_data_structures 2019-09-29 16:48:31 +00:00
Eduard-Mihai Burtescu a88d181a02 rustc: rely on c_variadic == true instead of CVarArgs in HIR/Ty fn signatures. 2019-09-28 17:39:00 +03:00
varkor b474867961 Rename `ForeignItem.node` to `ForeignItem.kind` 2019-09-26 18:21:48 +01:00
varkor 7bc94cc3c2 Rename `Item.node` to `Item.kind` 2019-09-26 18:21:48 +01:00
varkor 95f6d72a60 Rename `Expr.node` to `Expr.kind`
For both `ast::Expr` and `hir::Expr`.
2019-09-26 18:21:09 +01:00
varkor e2e0f9af85 Rename `sty` to `kind` 2019-09-25 15:50:04 +01:00
Josh Stone 9f374da467 Exempt extern "Rust" from improper_ctypes
It should be fine for Rust ABIs to involve any Rust type.
2019-09-20 15:39:34 -07:00
varkor 9d712177a3 Refactor "not FFI-safe" diagnostic 2019-09-10 22:29:31 +01:00
varkor 79368db1ce Surround `PhantomData` in backticks 2019-09-10 19:52:35 +01:00
varkor df7e496f85 Forbid opaque types in extern blocks 2019-09-10 18:16:35 +01:00
varkor 740dd4bf05 Add unexpected type to extern type bug message 2019-09-10 15:11:05 +01:00
Caio 6a42b0b28d Merge Variant and Variant_ 2019-08-14 14:47:01 -03:00
Yuki Okushi e2b3543eab Return early to avoid failing assertion 2019-08-08 13:38:23 +09:00
ljedrz 37d7e1f22a rename hir::map::local_def_id_from_hir_id to local_def_id 2019-07-04 12:53:12 +02:00
ljedrz d08bd72e97 HIR: rename get_parent_node_by_hir_id to get_parent_node 2019-06-24 09:46:38 +02:00
Julien Cretin b8106b59d2 Fix meta-variable binding errors in macros
The errors are either:
- The meta-variable used in the right-hand side is not bound (or defined) in the
  left-hand side.
- The meta-variable used in the right-hand side does not repeat with the same
  kleene operator as its binder in the left-hand side. Either it does not repeat
  enough, or it uses a different operator somewhere.

This change should have no semantic impact.
2019-06-23 01:30:41 +02:00
ljedrz 73cb9ab526 rename hir::map::get_by_hir_id to get 2019-06-20 12:50:06 +02:00
bors 605ea9d05c Auto merge of #59625 - immunant:copy_variadics_typealias, r=eddyb
Refactor C FFI variadics to more closely match their C counterparts, and add Clone implementation

We had to make some changes to expose `va_copy` and `va_end` directly to users (mainly for C2Rust, but not exclusively):
- redefine the Rust variadic structures to more closely correspond to C: `VaList` now matches `va_list`, and `VaListImpl` matches `__va_list_tag`
- add `Clone` for `VaListImpl`
- add explicit `as_va_list()` conversion function from `VaListImpl` to `VaList`
- add deref coercion from `VaList` to `VaListImpl`
- add support for the `asmjs` target

All these changes were needed for use cases like:
```Rust
let mut ap2 = va_copy(ap);
vprintf(fmt, ap2);
va_end(&mut ap2);
```
2019-06-18 21:50:46 +00:00
Eduard-Mihai Burtescu b25b466a88 rustc: remove 'x: 'y bounds (except from comments/strings). 2019-06-18 18:10:21 +03:00
Andrei Homescu b9ea653aee Expose `VaListImpl` as the Rust equivalent of `__va_list_tag` and implement Clone for it. 2019-06-17 16:04:49 -07:00
ljedrz d996c4d5a3 remove _by_hir_id if there is no NodeId counterpart 2019-06-17 18:57:21 +02:00
Eduard-Mihai Burtescu f3f9d6dfd9 Unify all uses of 'gcx and 'tcx. 2019-06-14 18:58:23 +03:00
Eduard-Mihai Burtescu fff08cb043 Run `rustfmt --file-lines ...` for changes from previous commits. 2019-06-12 13:38:28 +03:00
Eduard-Mihai Burtescu 17cdd356da rustc: replace `TyCtxt<'tcx, 'gcx, 'tcx>` with `TyCtxt<'gcx, 'tcx>`. 2019-06-12 13:38:27 +03:00
Eduard-Mihai Burtescu 2441253508 Fix fallout from `deny(unused_lifetimes)`. 2019-06-12 13:38:27 +03:00
Eduard-Mihai Burtescu 37799a5552 rustc: replace `TyCtxt<'a, 'gcx, 'tcx>` with `TyCtxt<'tcx, 'gcx, 'tcx>`. 2019-06-12 13:38:27 +03:00
bors 5f3656ce9a Auto merge of #61735 - eddyb:must-use-life, r=oli-obk
Add deny(unused_lifetimes) to all the crates that have deny(internal).

@Zoxc brought up, regarding #61722, that we don't force the removal of unused lifetimes.
Turns out that it's not that bad to enable for compiler crates (I wonder why it's not `warn` by default?).

I would've liked to enable `single_use_lifetimes` as well, but https://github.com/rust-lang/rust/issues/53738 makes it unusable for now.

For the `rustfmt` commit, I used https://github.com/rust-lang/rustfmt/issues/1324#issuecomment-482109952, and manually filtered out some noise.

r? @oli-obk cc @rust-lang/compiler
2019-06-11 20:45:17 +00:00
Eduard-Mihai Burtescu 1d720ec27c Run `rustfmt --file-lines ...` for changes from previous commits. 2019-06-11 14:11:59 +03:00
Eduard-Mihai Burtescu 7dc34945e4 rustc_lint: deny(unused_lifetimes). 2019-06-11 14:11:58 +03:00
Michael Bradshaw dac1c6a731 Implement RFC 2645 (transparent enums and unions)
Tracking issue: #60405
2019-06-10 22:07:24 -07:00
Michael Bradshaw a31dc8e3b1 Allow null-pointer-optimized enums in FFI if their underlying representation 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).
2019-05-22 07:24:28 -07:00
Vadim Petrochenkov 751ae5af1a Introduce `hir::Lit` not keeping the original token 2019-05-11 14:24:21 +03:00
varkor 80f90d866b Pull out some functors for readability 2019-04-30 23:37:38 +01:00
varkor 5e709b2910 Refactor is_range_literal 2019-04-30 23:17:58 +01:00
varkor 13962aff37 Include signed integer types in the lint 2019-04-30 22:43:51 +01:00
varkor 0556e4891e Preserve literal suffixes 2019-04-30 22:43:51 +01:00
varkor 218982bef0 Place types inside backticks 2019-04-30 22:43:51 +01:00
varkor 5ec2f5e87e Suggest using an inclusive range for an overflowing endpoint 2019-04-30 22:43:51 +01:00
Tyler Mandry 7c626a67ba Add discr_index to multi-variant layouts
We relax the assumption that the discriminant is always field 0, in
preparations for layouts like generators where this is not going to be
the case.
2019-04-11 17:44:43 -07:00
Mazdak Farrokhzad eb3215e523
Rollup merge of #59669 - Centril:lint-pass-macro, r=oli-obk
Reduce repetition in librustc(_lint) wrt. impl LintPass by using macros

r? @oli-obk
cc @Zoxc
2019-04-04 01:49:12 +02:00
Mazdak Farrokhzad fba110c805 reduce repetition in librustc(_lint) wrt. impl LintPass 2019-04-03 23:37:31 +02:00
flip1995 dd7483c750
Remove TyKind arg from report_bin_hex_error function 2019-04-03 19:18:07 +02:00
flip1995 d2bc99135f
Deny internal lints on librustc_lint 2019-04-03 18:24:22 +02:00
Eduard-Mihai Burtescu 5b7f4e9e21 rustc_target: factor out common fields of non-Single Variants. 2019-03-29 09:33:48 +02:00
ljedrz 77fa041fc1 hir: remove NodeId from Item 2019-03-02 07:48:52 +01:00
ljedrz 3c25193f3f hir: remove NodeId from ForeignItem 2019-03-02 07:48:52 +01:00
Dan Robertson 08bd4ff998
Rename variadic to c_variadic
Function signatures with the `variadic` member set are actually
C-variadic functions. Make this a little more explicit by renaming the
`variadic` boolean value, `c_variadic`.
2019-02-27 10:21:54 -05:00
Dan Robertson 58147d486b
Support defining C compatible variadic functions
Add support for defining C compatible variadic functions in unsafe rust
with extern "C".
2019-02-27 10:21:35 -05:00
csmoe ccfa5d6df8 replace &'tcx Substs with SubstsRef 2019-02-26 19:30:57 +08:00
bors ea43c3c688 Auto merge of #58561 - ljedrz:HirIdify_some_nodes, r=Zoxc
Remove NodeId from some HIR nodes

The next iteration of https://github.com/rust-lang/rust/pull/57578.

Removes `NodeId` from:

- [x] `Lifetime`
- [x] `Ty`
- [x] `GenericParam`
- [x] `WhereClause`
- [x] `WhereEqPredicate`
- [x] `MacroDef`
- [x] `Block`
- [x] `Expr`

r? @Zoxc
2019-02-26 06:13:27 +00:00