Santiago Pastorino
2bdaccbbcf
Make UnsafetyChecker visitor iterate instead of recurse
2019-06-06 05:17:19 +02:00
Claude-Alban RANÉLY-VERGÉ-DÉPRÉ
6e5e0daff2
Changes the type mir::Mir
into mir::Body
...
The commit should have changed comments as well.
At the time of writting, it passes the tidy and check tool.
Revisions asked by eddyb :
- Renamed of all the occurences of {visit/super}_mir
- Renamed test structures `CachedMir` to `Cached`
Fixing the missing import on `AggregateKind`
2019-05-28 19:17:51 +02:00
Nicholas Nethercote
257eaf523f
Introduce InternedString::intern
.
...
`InternedString::intern(x)` is preferable to
`Symbol::intern(x).as_interned_str()`, because the former involves one
call to `with_interner` while the latter involves two.
The case within InternedString::decode() is particularly hot, and this
change reduces the number of `with_interner` calls by up to 13%.
2019-05-20 09:17:00 +10:00
Nicholas Nethercote
fb084a48e2
Pass a Symbol
to check_name
, emit_feature_err
, and related functions.
2019-05-13 09:29:22 +10:00
Matthew Jasper
22226fa7fb
Remove region from borrow place contexts
2019-04-26 21:35:10 +01:00
Matthew Jasper
0eeab6b9a6
Remove BasicBlock parameter from mir visitor methods
2019-04-26 21:35:10 +01:00
Vadim Petrochenkov
6c187cc0c6
Change return type of TyCtxt::is_static
to bool
...
Add `TyCtxt::is_mutable_static`
2019-04-21 14:41:51 +03:00
varkor
a759e2cc12
Add own_requires_monomorphization
2019-04-18 00:30:50 +01:00
Tyler Mandry
4122d2221e
Remove adt_def from PlaceTy and make it a struct
2019-04-02 12:02:17 -07:00
Saleem Jaffer
752544b284
adding mir::StaticKind enum for static and promoted
2019-03-23 20:18:52 +05:30
Saleem Jaffer
a837b8a368
cleaner code as per review
2019-03-18 15:03:30 +05:30
Saleem Jaffer
7fb1c22da1
promoted is still left in 2 places
2019-03-18 15:03:29 +05:30
ljedrz
cd06038b54
HirIdification: replace NodeId method calls
2019-03-07 09:22:43 +01:00
varkor
8e56729b4d
Handle new ConstValue variants in mir
...
Co-Authored-By: Gabriel Smith <yodaldevoid@users.noreply.github.com>
2019-03-05 22:19:26 +00:00
bors
c1d2d83ca3
Auto merge of #58754 - ljedrz:I_hate_NodeIds, r=Zoxc
...
Remove NodeId from more HIR nodes
The next iteration of HirIdification (#57578 ).
Removes `NodeId` from:
- [x] `Stmt`
- [x] `Local`
- [x] `Field`
- [x] `AnonConst`
- [x] `TraitItem`
- [x] `ImplItem`
- [x] `TypeBinding`
- [x] `Arg`
- [x] `TraitRef`
- [x] `VisibilityKind`
It will most probably break clippy again; I'd appreciate a **delegate** again if/when it is good to go so I can attach a clippy fix later.
r? @Zoxc
2019-03-01 15:36:13 +00:00
ljedrz
c2e517e0c4
ty: HirIdify some lints
2019-03-01 11:18:49 +01:00
Santiago Pastorino
0f993d5a7a
Put Local, Static and Promoted as one Base variant of Place
2019-03-01 05:02:00 +01:00
ljedrz
021a140dcd
hir: remove NodeId from Block
2019-02-24 17:09:26 +01:00
Alexander Regueiro
c3e182cf43
rustc: doc comments
2019-02-10 23:42:32 +00:00
Taiki Endo
725af30809
librustc_mir => 2018
2019-02-08 06:28:15 +09:00
Oliver Scherer
aedc3a51df
Declare some unconst operations as unsafe in const fn
2019-01-21 16:01:57 +01:00
Niko Matsakis
8e89184a7b
rename type_moves_by_default
to type_is_copy_modulo_regions
2019-01-02 17:35:06 -05:00
Mark Rousskov
2a663555dd
Remove licenses
2018-12-25 21:08:33 -07:00
Mazdak Farrokhzad
b42a3acaec
stabilize min_const_unsafe_fn in 1.33.
2018-12-23 10:29:38 +01:00
Ralf Jung
c1160a8f86
treat ref-to-raw cast like a reborrow: do a special kind of retag
2018-12-18 09:56:31 +01:00
Oliver Scherer
8d0b64f16d
Make const unsafe fn
bodies unsafe
2018-12-11 10:27:00 +01:00
Alexander Regueiro
ee89c088b0
Various minor/cosmetic improvements to code
2018-12-07 23:53:34 +00:00
John Kåre Alsaker
a70babed03
Use a function to access the Hir map to be able to turn it into a query later
2018-12-06 17:24:36 +01:00
Oliver Scherer
f4115765c5
Intrinsic checks are just needed for qualify_min_const_fn
2018-12-04 10:17:37 +01:00
Oliver Scherer
b77969466c
Clear up some code
2018-12-04 10:17:37 +01:00
Oliver Scherer
4497ff3762
Emit feature gate suggestion
2018-12-04 10:17:36 +01:00
Oliver Scherer
e5d90652e2
Comment on the unsafety code for layout constrained fields
2018-12-04 10:17:36 +01:00
Oliver Scherer
55abc0bc90
Also prevent mutation fields directly
2018-12-04 10:17:36 +01:00
Oliver Scherer
1894a5fe2c
Also make immutable references to non-freeze restricted value range types unsafe
2018-12-04 10:17:36 +01:00
Oliver Scherer
081c49783f
generalize the message about the creation of layout restricted types
2018-12-04 10:17:36 +01:00
Oliver Scherer
8bdb11c4d9
Forbid the creation of mutable borrows to fields of layout constrained types
2018-12-04 10:17:36 +01:00
Oliver Scherer
693c55372e
Move ref to packed struct field check into projection arm
2018-12-04 10:17:36 +01:00
Oliver Scherer
02b22323f1
Make sure the initialization of constrained int range newtypes is unsafe
2018-12-04 10:17:36 +01:00
Oliver Scherer
906a49eef2
Document unsafe rules with comments and bug!
calls
2018-12-04 10:17:36 +01:00
Oliver Scherer
f2ae7b78d6
Allow calling const unsafe fn
in const fn
behind a feature gate
2018-12-04 10:17:36 +01:00
Matthew Jasper
b16985a354
Remove mir::StatementKind::EndRegion
...
Since lexical MIR borrow check is gone, and validation no longer uses
these, they can be removed.
2018-11-18 11:05:19 +00:00
Ralf Jung
f27cd60ae1
no more action on ref or cast, but add new MIR statement for escaping a ptr to raw
2018-11-07 16:54:31 +01:00
Ralf Jung
aafcf2c942
Emit Retag statements, kill Validate statements
...
Also "rename" -Zmir-emit-validate to -Zmir-emit-retag, which is just a boolean (yes or no).
2018-10-29 09:05:18 +01:00
David Wood
6208bd8e03
Refactor and add PlaceContext::AscribeUserTy
.
...
This commit refactors `PlaceContext` to split it into four different
smaller enums based on if the context represents a mutating use,
non-mutating use, maybe-mutating use or a non-use (this is based on the
recommendation from @oli-obk on Zulip[1]).
This commit then introduces a `PlaceContext::AscribeUserTy` variant.
`StatementKind::AscribeUserTy` is now correctly mapped to
`PlaceContext::AscribeUserTy` instead of `PlaceContext::Validate`.
`PlaceContext::AscribeUserTy` can also now be correctly categorized as a
non-use which fixes an issue with constant promotion in statics after a
cast introduces a `AscribeUserTy` statement.
[1]: https://rust-lang.zulipchat.com/#narrow/stream/122657-wg-nll/subject/.2355288.20cast.20fails.20to.20promote.20to.20'static/near/136536949
2018-10-27 12:11:37 +02:00
Oliver Scherer
3c9258e604
Prefer Default::default
over FxHash*::default
in struct constructors
2018-10-19 14:34:44 +02:00
Oliver Scherer
ee81739dc1
Deprecate the FxHashMap()
and FxHashSet()
constructor function hack
2018-10-19 14:34:44 +02:00
Remy Rakic
f5e310530a
Refactor 'ReadForMatch' into 'FakeRead' and add the cause of the fake read
2018-09-18 14:36:37 +02:00
Niko Matsakis
dd3cc9669a
add the AscribeUserType
statement kind
...
Make it have the semantics of subtype.
2018-09-10 08:22:31 -04:00
Oliver Schneider
472ca71598
Implement the min_const_fn
feature gate
2018-08-31 08:39:59 +02:00
varkor
e2a1cce9c5
Rename hir::map::NodeKind to hir::Node
2018-08-27 21:46:23 +01:00