Commit Graph

208 Commits

Author SHA1 Message Date
Mazdak Farrokhzad 2c3e5d3de0 - remove syntax::{span_warn!, span_err!, span_fatal!. struct_err!}
- remove syntax::{help!, span_help!, span_note!}
- remove unused syntax::{struct_span_fatal, struct_span_err_or_warn!, span_err_or_warn!}
- lintify check_for_bindings_named_same_as_variants + conflicting_repr_hints
- inline syntax::{struct_span_warn!, diagnostic_used!}
- stringify_error_code! -> error_code! & use it more.
- find_plugin_registrar: de-fatalize an error
- de-fatalize metadata errors
- move type_error_struct! to rustc_typeck
- struct_span_err! -> rustc_errors
2020-01-08 04:25:33 +01:00
Mazdak Farrokhzad ebfd8673a7 Remove rustc_hir reexports in rustc::hir. 2020-01-05 12:49:22 +01:00
Mazdak Farrokhzad 4ff12ce4c1 Normalize `syntax::symbol` imports. 2020-01-02 13:57:04 +01:00
Mark Rousskov a06baa56b9 Format the world 2019-12-22 17:42:47 -05:00
Camille GILLOT acf33f2d6b Use Arena inside hir::ForeignItem. 2019-12-21 23:29:27 +01:00
Mazdak Farrokhzad a7aec3f207 1. ast::Mutability::{Mutable -> Mut, Immutable -> Not}.
2. mir::Mutability -> ast::Mutability.
2019-12-20 22:22:44 +01:00
bors de17464b14 Auto merge of #65881 - anp:implicit-caller-location, r=eddyb,oli-obk
Implement #[track_caller] attribute. (RFC 2091 4/N)

Implements the `#[track_caller]` attribute in both const and codegen contexts.

The const implementation walks up the stack to find the nearest untracked callsite.

The codegen implementation adds an implicit argument to tracked function calls, and populates it with either a call to the previously-landed intrinsic or if the caller has `#[track_caller]` with a copy of the location passed to the current function.

Also includes a little cleanup and a few comments in the other caller location areas.

[Depends on: 65664](https://github.com/rust-lang/rust/pull/65664)
[RFC 2091 text](https://github.com/rust-lang/rfcs/blob/master/text/2091-inline-semantic.md)
[Tracking issue](https://github.com/rust-lang/rust/issues/47809)
[Tracking doc](https://paper.dropbox.com/doc/track_rfc_2091_impl-notes--Anf1NwnIb0xcRv31YLIadyj0Ag-rwCdRc2fi2yvRZ7syGZ9q#:uid=863513134494965680023183&h2=TODO-actually-pass-location-to)
2019-12-07 21:14:39 +00:00
Simon Sapin cba479f75c Add `{f32,f64}::approx_unchecked_to<Int>` unsafe methods
As discussed in https://github.com/rust-lang/rust/issues/10184

Currently, casting a floating point number to an integer with `as` is Undefined Behavior if the value is out of range. `-Z saturating-float-casts` fixes this soundness hole by making `as` “saturate” to the maximum or minimum value of the integer type (or zero for `NaN`), but has measurable negative performance impact in some benchmarks. There is some consensus in that thread for enabling saturation by default anyway, but provide an `unsafe fn` alternative for users who know through some other mean that their values are in range.
2019-12-06 14:01:05 +01:00
Adam Perry 4773ded15b Generate &core::panic::Location type in a single place. 2019-12-05 21:02:56 -08:00
Guillaume Gomez 798e389e57 Update to use new librustc_error_codes library 2019-11-14 13:05:42 +01:00
Aaron Hill dac30115dc
Change TODO to FIXME 2019-11-11 15:14:36 -05:00
Aaron Hill 5553476d49
Use proper intrinsic type 2019-11-11 15:14:35 -05:00
Aaron Hill 848e1d827e
More work on miri_start_panic 2019-11-11 15:14:35 -05:00
Aaron Hill fe88fc03c5
Fix up intrinsic implementation 2019-11-11 15:14:34 -05:00
Camille GILLOT ed640c6a27 Merge hir::Mutability into ast::Mutability. 2019-11-10 12:21:05 +01:00
Oliver Scherer 02f9167f94 Have tidy ensure that we document all `unsafe` blocks in libcore 2019-11-06 11:04:42 +01:00
bors 6c1b220fd7 Auto merge of #63810 - oli-obk:const_offset_from, r=RalfJung,nikic
Make <*const/mut T>::offset_from `const fn`

This reenables offset_of cc @mjbshaw 	after https://github.com/rust-lang/rust/pull/63075 broke it
2019-11-02 22:26:54 +00:00
Adam Perry 86e55b1882 Always use consteval to codegen caller_location. 2019-10-27 12:51:55 -07:00
Adam Perry 743964ad3f Implement core::intrinsics::caller_location.
Returns a `&core::panic::Location` corresponding to where it was
called, also making `Location` a lang item.
2019-10-27 12:50:52 -07:00
Nicholas Nethercote 02edd14cde Convert some `InternedString`s to `Symbols`.
This avoids the needs for various conversions, and makes the code
slightly faster, because `Symbol` comparisons and hashing is faster.
2019-10-21 11:31:02 +11:00
Oliver Scherer 88b5e945e0 Make <*const/mut T>::offset_from `const fn` 2019-10-11 10:40:49 +02:00
Mazdak Farrokhzad 1c2dd143f3
Rollup merge of #64876 - vertexclique:vcq/fix-fn-name-intrinsic-op-unsafety, r=varkor
Fix typo in intrinsics op safety

Title pretty much sums up.
2019-09-28 22:12:10 +02:00
Mahmut Bulut c666bd5570
Fix typo in intrinsics op safety 2019-09-28 18:24:05 +02:00
varkor b474867961 Rename `ForeignItem.node` to `ForeignItem.kind` 2019-09-26 18:21:48 +01:00
Eduard-Mihai Burtescu 0f1da639d4 Rename overflowing_{add,sub,mul} intrinsics to wrapping_{add,sub,mul}. 2019-08-16 20:04:21 +03:00
Tatsuyuki Ishi 2358e3eff6 Revert "Rollup merge of #62150 - alex:mem-uninit-refactor, r=RalfJung"
This reverts commit 1d45156866, reversing
changes made to 0f92eb8a4a.
2019-08-10 22:16:35 +09:00
Steven Fackler 91fa898975 Stabilize the type_name intrinsic in core::any
Closes rust-lang/rfcs#1428
2019-07-24 21:35:49 -07:00
Mazdak Farrokhzad 2e86c006f7
Rollup merge of #62168 - ljedrz:the_culmination_of_hiridification, r=Zoxc
The (almost) culmination of HirIdification

It's finally over.

This PR removes old `FIXME`s and renames some functions so that the `HirId` variant has the shorter name.
All that remains (and rightfully so) is stuff in `resolve`, `save_analysis` and (as far as I can tell) in a few places where we can't replace `NodeId` with `HirId`.
2019-07-05 20:26:56 +02:00
Alex Gaynor e4f250e405 Implement mem::{zeroed,uninitialized} in terms of MaybeUninit.
Refs #62061
2019-07-04 09:33:15 -04:00
ljedrz 37d7e1f22a rename hir::map::local_def_id_from_hir_id to local_def_id 2019-07-04 12:53:12 +02:00
Jeremy Stucki d50a3a7b86
Remove needless lifetimes 2019-07-03 10:01:01 +02: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
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
varkor 0e5edc9f16 Add intrinsics for floating-point min and max 2019-06-06 21:27:23 +01:00
lcnr/Bastian Kauschke 4e7319cd3f add unchecked math intrinsics 2019-06-03 12:59:48 +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
ljedrz 3c25193f3f hir: remove NodeId from ForeignItem 2019-03-02 07:48:52 +01: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
bors 7cb3ee453b Auto merge of #58304 - gnzlbg:simd_saturated, r=nagisa
Add generic simd saturated add/sub intrinsics

r? @eddyb
2019-02-24 04:16:12 +00:00
ljedrz eac43ccda4 HirId-ify hir::BodyId 2019-02-13 09:54:58 +01:00
bors b244f61b77 Auto merge of #58341 - alexreg:cosmetic-2-doc-comments, r=steveklabnik
Cosmetic improvements to doc comments

This has been factored out from https://github.com/rust-lang/rust/pull/58036 to only include changes to documentation comments (throughout the rustc codebase).

r? @steveklabnik

Once you're happy with this, maybe we could get it through with r=1, so it doesn't constantly get invalidated? (I'm not sure this will be an issue, but just in case...) Anyway, thanks for your advice so far!
2019-02-12 19:09:24 +00:00
Alexander Regueiro c3e182cf43 rustc: doc comments 2019-02-10 23:42:32 +00:00
gnzlbg 94defa9364 Add simd_saturating_{add,sub} intrinsics 2019-02-08 16:53:53 +01:00
Taiki Endo fe276239b3 librustc_typeck => 2018 2019-02-08 22:30:58 +09:00
Nikita Popov 4a4186e4d1 Use LLVM intrinsics for saturating add/sub 2019-01-29 22:32:13 +01:00
bors 095b44c83b Auto merge of #57269 - gnzlbg:simd_bitmask, r=rkruppe
Add intrinsic to create an integer bitmask from a vector mask

This PR adds a new simd intrinsic: `simd_bitmask(vector) -> unsigned integer` that creates an integer bitmask from a vector mask by extracting one bit of each vector lane.

This is required to implement: https://github.com/rust-lang-nursery/packed_simd/issues/166 .

EDIT: the reason we need an intrinsics for this is that we have to truncate the vector lanes to an `<i1 x N>` vector, and then bitcast that to an `iN` integer (while making sure that we only materialize `i8`, ... , `i64` - that is, no `i1`, `i2`, `i4`, types), and we can't do any of that in a Rust library.

r? @rkruppe
2019-01-24 13:11:06 +00:00