203 Commits

Author SHA1 Message Date
LeSeulArtichaut
a977df35d1 Implement RFC 2585 2020-05-27 20:37:56 +02:00
Dylan MacKenzie
119efbcbfb Use is_const_fn_raw when unsafety checking 2020-05-20 14:55:07 -07:00
Amanieu d'Antras
1e7b246086 Add asm! to MIR 2020-05-18 14:41:31 +01:00
Ralf Jung
07d5971eb6 move borrow-of-packed-field unsafety check out of loop 2020-05-16 16:04:31 +02:00
Nicholas Nethercote
27ae2f0d60 Shrink LocalDecl by 56 bytes.
By boxing `local_info`.
2020-05-06 14:15:08 +10:00
Nicholas Nethercote
a17234ca54 Add SourceInfo::outermost. 2020-05-06 12:15:26 +10:00
Dylan DPC
78dc7e15c9
Rollup merge of #71772 - cjgillot:ensure, r=petrochenkov
Mark query function as must_use.

And use the `ensure()` version when the result is not needed.
2020-05-02 18:27:35 +02:00
Camille GILLOT
6cde87def1 Mark query function as must_use. 2020-05-01 17:45:30 +02:00
LeSeulArtichaut
f2c6cbd98f Prevent calls to functions with #[target_feature] in safe contexts 2020-05-01 16:24:59 +02:00
marmeladema
abd31ad6e8 Use LocalDefId in unsafety_check_result query 2020-04-27 21:50:17 +01:00
marmeladema
bfce24aa67 Modify as_local_hir_id to return a bare HirId 2020-04-23 23:14:07 +01:00
marmeladema
6148db719f Modify as_local_hir_id to accept a LocalDefId instead of a DefId 2020-04-23 23:14:07 +01:00
Dylan MacKenzie
8287842eb4 Use Body everywhere 2020-04-22 09:57:43 -07:00
Josh Stone
7b005c5fcb Dogfood more or_patterns in the compiler 2020-04-19 07:33:58 -07:00
ljedrz
66575c9962 comment on the sorting of unused unsafe blocks 2020-04-16 20:00:54 +02:00
ljedrz
672b7682b0 sort unused unsafe blocks by Span instead of NodeId 2020-04-16 14:53:09 +02:00
ljedrz
d167408cb4 simplify unused unsafe block handling 2020-04-16 14:24:52 +02:00
Santiago Pastorino
890b39381f
Use Place directly, it's Copy even more use cases 2020-03-31 14:45:05 -03:00
Santiago Pastorino
760bca4f5b
Use Place directly on check_mut_borrowing_layout_constrained_field, it's Copy 2020-03-31 14:44:00 -03:00
Matthias Krüger
9bba047c2e Use if let instead of match when only matching a single variant (clippy::single_match)
Makes code more compact and reduces nestig.
2020-03-30 10:52:29 +02:00
Mazdak Farrokhzad
1ccb0b4a02 rustc -> rustc_middle part 3 (rustfmt) 2020-03-30 07:19:55 +02:00
Mazdak Farrokhzad
0cb9e36090 rustc -> rustc_middle part 2 2020-03-30 07:16:56 +02:00
Dylan MacKenzie
538cdef64b Use & to do deref coercion for ReadOnlyBodyAndCache 2020-03-29 13:30:26 -07:00
Dylan MacKenzie
b641e9e358 Make Visitor::visit_body take a simple Body 2020-03-29 11:56:36 -07:00
Bastian Kauschke
37603f499a clarify hir_id <-> node_id method names 2020-03-27 16:43:20 +01:00
Amanieu d'Antras
d162d096dd Rename asm! to llvm_asm!
asm! is left as a wrapper around llvm_asm! to maintain compatibility.
2020-03-26 15:49:22 +00:00
Esteban Küber
f18a6dcec0 Rename def_span to guess_head_span 2020-03-25 16:45:12 -07:00
Mazdak Farrokhzad
4392a8b73c use direct imports for rustc::{lint, session}. 2020-03-16 02:52:06 +01:00
Mazdak Farrokhzad
73a625b5fb remove unnecessary hir::map imports 2020-03-16 02:49:19 +01:00
John Kåre Alsaker
8b16b023b1 Index HIR after creating TyCtxt 2020-03-14 22:52:30 +01:00
Matthias Krüger
7b1b08cfee remove lifetimes that can be elided (clippy::needless_lifetimes) 2020-03-12 20:03:09 +01:00
Matthias Krüger
de7c40c168 use .iter() instead of .into_iter() on references. 2020-02-29 03:14:01 +01:00
Matthew Jasper
4af0952961 Call is_freeze less in unsafety-checking
This is to avoid cycles when calling `is_freeze` on an opaque type.
2020-02-14 20:12:46 +00:00
jumbatm
0b2436f3a4 Move more into decorate functions. 2020-02-11 19:50:26 +10:00
jumbatm
d246385122 Run RustFmt 2020-02-11 19:49:01 +10:00
jumbatm
7c58ffe874 Invert control in struct_lint_level.
Caller now passes in a `decorate` function, which is only run if the
lint is allowed.
2020-02-11 19:47:40 +10:00
Dylan DPC
8f5858007c
Rollup merge of #68588 - Centril:check-unsafety-clean, r=Mark-Simulacrum
check_unsafety: more code reuse

r? oli-obk
2020-01-31 01:21:24 +01:00
Santiago Pastorino
5f1caa4032
./x.py fmt 2020-01-28 10:12:54 -03:00
Santiago Pastorino
22a4827dcb
Place::ty_from takes local by value 2020-01-28 10:12:53 -03:00
Mazdak Farrokhzad
dc17f38e04 check_unsafety: more code reuse 2020-01-28 02:30:47 +01:00
Matthias Krüger
ec61761e46 don't clone types that are copy, round two. 2020-01-27 01:18:18 +01:00
Matthew Jasper
f30a8186f7 Make pointers to statics internal 2020-01-23 21:38:15 +00:00
Mazdak Farrokhzad
de6046fa0f remove rustc_error_codes deps except in rustc_driver 2020-01-18 21:53:53 +01:00
Mazdak Farrokhzad
cc51d0350e
Rollup merge of #68045 - Centril:liberate-lints, r=Mark-Simulacrum
Move more of `rustc::lint` into `rustc_lint`

Based on https://github.com/rust-lang/rust/pull/67806.

Here we try to consolidate more of the linting infra into `rustc::lint`. Some high-level notes:

- We now store an `Lrc<dyn Any + Send + Sync>` as opposed to `Lrc<LintStore>` in the `GlobalCtxt`. This enables us to avoid referring to the type, breaking a cyclic dependency, and so we can move things from `rustc::lint` to `rustc_lint`.

- `in_derive_expansion` is, and needs to, be moved as a method on `Span`.

- We reduce the number of ways on `tcx` to emit a lint so that the developer UX is more streamlined.

- `LintLevelsBuilder` is moved to `rustc_lint::levels`, leaving behind `LintLevelMap/Set` in a purified form due to current constraints (hopefully fixable in the future after https://github.com/rust-lang/rust/pull/68133).

- `struct_lint_level` is moved to `rustc::lint` due to current dependency constraints.

- `rustc::lint::context` is moved to `rustc_lint::context`.

- The visitors in `rustc::lint` are moved to `rustc_lint::passes`.
2020-01-12 03:27:59 +01:00
Mazdak Farrokhzad
c151782d76 reduce diversity in linting methods 2020-01-11 07:42:26 +01:00
Santiago Pastorino
5d9b399044 Remove PlaceBase enum and make Place base field be local: Local 2020-01-10 09:08:25 +01:00
Santiago Pastorino
fd5aa32c35 Remove Static from PlaceBase 2020-01-10 09:08:24 +01:00
Santiago Pastorino
b63597dedb Remove StaticKind 2020-01-10 09:08:24 +01:00
Santiago Pastorino
6f2c7025b8 Remove StaticKind::Promoted 2020-01-10 09:08:24 +01:00
Mazdak Farrokhzad
0b3ef24e75
Rollup merge of #67979 - Centril:hir-cleanup, r=Zoxc
Move `intravisit` => `rustc_hir` + misc cleanup

Working towards https://github.com/rust-lang/rust/issues/65031.
This should eventually enable getting rid of rustc as a dependency in various passes (e.g. lints).

cc https://github.com/rust-lang/rust/pull/67806 (this also facilitates liberating lints from tcx)
cc https://github.com/rust-lang/rust/pull/67922 (some other dep reductions)

r? @Zoxc
2020-01-09 00:22:11 +01:00