Commit Graph

952 Commits

Author SHA1 Message Date
Yuki Okushi
99e0d8ed79
Minor follow-up after renaming librustc(_middle) 2020-04-03 19:03:13 +09:00
Mazdak Farrokhzad
6daff1400a direct imports for langitem stuff 2020-04-02 13:40:43 +02:00
Mazdak Farrokhzad
124144704f nix rustc_target::abi::* reexport in ty::layout 2020-04-02 13:40:43 +02: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
Mazdak Farrokhzad
7710f2dd5c rustc -> rustc_middle part 1 2020-03-30 07:02:56 +02:00
Ana-Maria Mihalache
50d2c3abd5 Rename TyLayout to TyAndLayout. 2020-03-27 17:14:53 +00:00
bors
6c19a10e24 Auto merge of #68404 - Amanieu:llvm-asm, r=estebank
Rename asm! to llvm_asm!

As per https://github.com/rust-lang/rfcs/pull/2843, this PR renames `asm!` to `llvm_asm!`. It also renames the compiler's internal `InlineAsm` data structures to `LlvmInlineAsm` in preparation for the new `asm!` functionality specified in https://github.com/rust-lang/rfcs/pull/2850.

This PR doesn't actually deprecate `asm!` yet, it just makes it redirect to `llvm_asm!`. This is necessary because we first need to update the submodules (in particular stdarch) to use `llvm_asm!`.
2020-03-27 03:27:09 +00:00
Dylan DPC
7041efcfc3
Rollup merge of #70344 - Centril:hir-pretty, r=eddyb
Decouple `rustc_hir::print` into `rustc_hir_pretty`

High level summary:
- The HIR pretty printer, `rustc_hir::print` is moved into a new crate `rustc_hir_pretty`.
- `rustc_ast_pretty` and `rustc_errors` are dropped as `rustc_hir` dependencies.
- The dependence on HIR pretty is generally reduced, leaving `rustc_save_analysis`, `rustdoc`, `rustc_metadata`, and `rustc_driver` as the remaining clients.

The main goal here is to reduce `rustc_hir`'s dependencies and its size such that it can start and finish earlier, thereby working towards https://github.com/rust-lang/rust/issues/65031.

r? @Zoxc
2020-03-27 01:23:53 +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
f1701ddef1 rustc: remove rustc_hir_pretty dependency. 2020-03-24 08:44:55 +01:00
Mazdak Farrokhzad
22b2781fa5 {rustc::hir::map -> rustc_passes}::hir_id_validator 2020-03-24 04:59:39 +01:00
Alex Tokarev
b35c30251f Reword unused variable warning 2020-03-23 12:14:45 +03:00
Adam Perry
97da6dae41 Allow #[track_caller] in traits.
The codegen implementation already works for this, so we're:

* propagating track_caller attr from trait def to impl
* relaxing errors
* adding tests

Approved in a recent lang team meeting:
https://github.com/rust-lang/lang-team/blob/master/minutes/2020-01-09.md
2020-03-22 17:21:18 -07:00
Dylan DPC
fd3f9176c3
Rollup merge of #69901 - RalfJung:rustc_layout, r=eddyb
add #[rustc_layout(debug)]

@eddyb recently told me about the `#[rustc_layout]` attribute, and I think it would be very useful if it could be used to print all the layout information Rust has about a type. When working with layouts (e.g. in Miri), it is often not clear how certain surface language features get represented internally. I have some awful hacks locally to be able to dump this debug information; with this attribute I could get it on the playground which is so much better. :)
2020-03-21 13:06:35 +01:00
Ralf Jung
7b49678f5f fmt 2020-03-20 23:22:36 +01:00
Matthias Krüger
ad00e91887 remove redundant returns (clippy::needless_return) 2020-03-20 20:23:03 +01:00
Ralf Jung
c62e36bf4c make rustc_layout also work for type definitions 2020-03-20 17:48:03 +01:00
Ralf Jung
55c2cf2a32 add debug option to #[rustc_layout] 2020-03-20 17:25:03 +01:00
Ralf Jung
0296d4968e fix layout_test visitor name 2020-03-20 17:25:03 +01:00
Eduard-Mihai Burtescu
f3ec069886 rustc: use LocalDefId instead of DefIndex in HirId. 2020-03-19 11:16:08 +02:00
Eduard-Mihai Burtescu
42b2adfab0 rustc: introduce DefId::as_local(self) -> Option<LocalDefId> and use it. 2020-03-19 11:15:35 +02:00
Mazdak Farrokhzad
292c538265
Rollup merge of #69920 - Centril:hir-cleanup, r=Zoxc
Remove some imports to the rustc crate

- When we have `NestedVisitorMap::None`, we use `type Map = dyn intravisit::Map<'v>;` instead of the actual map. This doesn't actually result in dynamic dispatch (in the future we may want to use an associated type default to simplify the code).

- Use `rustc_session::` imports instead of `rustc::{session, lint}`.

r? @Zoxc
2020-03-18 18:03:44 +01:00
Oliver Scherer
7894509b00 Fiddle ParamEnv through to a place that used to use ParamEnv::empty in a buggy manner 2020-03-16 18:51:55 +01: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
Mark Mansi
7bd8ce2e50 More Method->Fn renaming 2020-03-15 19:15:55 -05:00
bors
45ebd5808a Auto merge of #68944 - Zoxc:hir-map, r=eddyb
Use queries for the HIR map

r? @eddyb cc @michaelwoerister
2020-03-15 20:40:16 +00:00
Mazdak Farrokhzad
d1e943f263
Rollup merge of #69589 - petrochenkov:maccall, r=Centril
ast: `Mac`/`Macro` -> `MacCall`

It's now obvious that these refer to macro calls rather than to macro definitions.

It's also a single name instead of two different names in different places.

`rustc_expand` usually calls macro calls in a wide sense (including attributes and derives) "macro invocations", but structures and variants renamed in this PR are only relevant to fn-like macros, so it's simpler and clearer to just call them calls.

cc https://github.com/rust-lang/rust/pull/63586#discussion_r314232513
r? @eddyb
2020-03-15 15:40:05 +01:00
John Kåre Alsaker
8b16b023b1 Index HIR after creating TyCtxt 2020-03-14 22:52:30 +01:00
John Kåre Alsaker
38e613c4eb Update krate_attrs and get_module 2020-03-14 22:52:29 +01:00
Camille GILLOT
1fcdc52f70 Make downstream crates compile. 2020-03-14 14:17:43 +01:00
Camille GILLOT
c1e3d556bf Move rustc_infer::traits to new crate rustc_trait_selection. 2020-03-14 14:15:50 +01:00
bors
be055d96c4 Auto merge of #67502 - Mark-Simulacrum:opt-catch, r=Mark-Simulacrum
Optimize catch_unwind to match C++ try/catch

This refactors the implementation of catching unwinds to allow LLVM to inline the "try" closure directly into the happy path, avoiding indirection. This means that the catch_unwind implementation is (after this PR) zero-cost unless a panic is thrown.

https://rust.godbolt.org/z/cZcUSB is an example of the current codegen in a simple case. Notably, the codegen is *exactly the same* if `-Cpanic=abort` is passed, which is clearly not great.

This PR, on the other hand, generates the following assembly:

```asm
# -Cpanic=unwind:
	push   rbx
	mov    ebx,0x2a
	call   QWORD PTR [rip+0x1c53c]        # <happy>
	mov    eax,ebx
	pop    rbx
	ret
	mov    rdi,rax
	call   QWORD PTR [rip+0x1c537]        # cleanup function call
	call   QWORD PTR [rip+0x1c539]        # <unfortunate>
	mov    ebx,0xd
	mov    eax,ebx
	pop    rbx
	ret

# -Cpanic=abort:
	push   rax
	call   QWORD PTR [rip+0x20a1]        # <happy>
	mov    eax,0x2a
	pop    rcx
	ret
```

Fixes #64224, and resolves #64222.
2020-03-13 22:43:06 +00:00
Yuki Okushi
c13548dccd
Rollup merge of #69809 - matthiaskrgr:lifetimes, r=eddyb
remove lifetimes that can be elided (clippy::needless_lifetimes)
2020-03-14 04:03:26 +09:00
Vadim Petrochenkov
e809e0214e ast: Mac/Macro -> MacCall 2020-03-12 22:26:52 +03:00
Matthias Krüger
7b1b08cfee remove lifetimes that can be elided (clippy::needless_lifetimes) 2020-03-12 20:03:09 +01:00
Mazdak Farrokhzad
39c6405097
Rollup merge of #69747 - spastorino:rename-rustc-guide, r=pietroalbini
Rename rustc guide

This is in preparation for https://github.com/rust-lang/rustc-guide/issues/470
Needs to be merged after we actually rename the guide.

Have used this to rename:

`git grep -l 'rustc_guide' | xargs sed -i 's/rustc_guide/rustc_dev_guide/g'`
`git grep -l 'rustc-guide' | xargs sed -i 's/rustc-guide/rustc-dev-guide/g'`
`git grep -l 'rustc guide' | xargs sed -i 's/rustc guide/rustc dev guide/g'`
2020-03-12 16:32:19 +01:00
Mazdak Farrokhzad
9bc7386970
Rollup merge of #69674 - mark-i-m:assoc-fn, r=matthewjasper
Rename DefKind::Method and TraitItemKind::Method

r? @eddyb, @Centril, or @matthewjasper

cc #69498 #60163
2020-03-12 16:32:13 +01:00
Santiago Pastorino
b3b32b74bc
rust-lang.github.io/rustc-dev-guide -> rustc-dev-guide.rust-lang.org 2020-03-10 17:08:18 -03:00
Santiago Pastorino
9d4fdba8be
Rename rustc guide to rustc dev guide 2020-03-10 17:08:16 -03:00
Santiago Pastorino
0037f4e37c
Rename rustc-guide to rustc-dev-guide 2020-03-10 17:08:10 -03:00
Matthias Krüger
136ad015b6 fix various typos 2020-03-06 15:19:31 +01:00
Amanieu d'Antras
f4f91f0b2f Remove eh_unwind_resume lang item 2020-03-05 17:36:50 +00:00
Matthias Krüger
d8d2004c6f Don't use "if let" bindings to only check a value and not actually bind anything.
For example:  `if let Some(_) = foo() {}`	can be reduced to	`if foo().is_some() {}`   (clippy::redundant_pattern_matching)
2020-03-04 20:41:03 +01:00
Mark Mansi
3aeb9f0faf rename TraitItemKind::Method -> Fn 2020-03-03 12:49:58 -06:00
bors
beac68a887 Auto merge of #69612 - Dylan-DPC:rollup-f180gcc, r=Dylan-DPC
Rollup of 7 pull requests

Successful merges:

 - #69504 (Use assert_ne in hash tests)
 - #69554 (Cleanup e0374)
 - #69568 (Clarify explanation of Vec<T> 'fn resize')
 - #69569 (simplify boolean expressions)
 - #69577 (Clean up E0375 explanation)
 - #69598 (rustdoc: HTML escape crate version)
 - #69607 (Clean up E0376 explanation)

Failed merges:

r? @ghost
2020-03-01 17:39:05 +00:00
Dylan DPC
87284d7e79
Rollup merge of #69569 - matthiaskrgr:nonminimal_bool, r=mark-Simulacrum
simplify boolean expressions
2020-03-01 17:23:30 +01:00