about summary refs log tree commit diff
path: root/compiler/rustc_interface/src/util.rs
AgeCommit message (Collapse)AuthorLines
2021-10-01Fix clippy lintsGuillaume Gomez-2/+2
2021-09-25Check for macros in built-in attributes that don't support them.Eric Huss-1/+15
2021-09-23Simplify scoped_threadMark Rousskov-19/+5
Avoids a bunch of manual pointer manipulation.
2021-09-20Enable 2021 compatibility lints for all in-tree codeMark Rousskov-0/+1
This just applies the suggested fixes from the compatibility warnings, leaving any that are in practice spurious in. This is primarily intended to provide a starting point to identify possible fixes to the migrations (e.g., by avoiding spurious warnings). A secondary commit cleans these up where they are false positives (as is true in many of the cases).
2021-09-03Detect bare blocks with type ascription that were meant to be a `struct` literalEsteban Kuber-0/+1
Address part of #34255. Potential improvement: silence the other knock down errors in `issue-34255-1.rs`.
2021-08-21Remove `Session.used_attrs` and move logic to `CheckAttrVisitor`Aaron Hill-3/+3
Instead of updating global state to mark attributes as used, we now explicitly emit a warning when an attribute is used in an unsupported position. As a side effect, we are to emit more detailed warning messages (instead of just a generic "unused" message). `Session.check_name` is removed, since its only purpose was to mark the attribute as used. All of the callers are modified to use `Attribute.has_name` Additionally, `AttributeType::AssumedUsed` is removed - an 'assumed used' attribute is implemented by simply not performing any checks in `CheckAttrVisitor` for a particular attribute. We no longer emit unused attribute warnings for the `#[rustc_dummy]` attribute - it's an internal attribute used for tests, so it doesn't mark sense to treat it as 'unused'. With this commit, a large source of global untracked state is removed.
2021-07-18Remove deadlock virtual call.Camille GILLOT-1/+3
2021-07-08Rework SESSION_GLOBALS API to prevent overwriting itGuillaume Gomez-7/+8
2021-07-06Revert "Revert "Merge CrateDisambiguator into StableCrateId""bjorn3-36/+0
This reverts commit 8176ab8bc18fdd7d3c2cf7f720c51166364c33a3.
2021-06-07Revert "Merge CrateDisambiguator into StableCrateId"bjorn3-0/+36
This reverts commit d0ec85d3fb6d322496cb8f4bc1c21e19f23284ad.
2021-06-04Use SyncOnceCell in get_codegen_backendbjorn3-11/+9
This reduces the amount of unsafe code in get_codegen_backend
2021-06-04Allow printing the version of the default codegen backend if it isn't llvmbjorn3-22/+15
2021-05-30Merge CrateDisambiguator into StableCrateIdbjorn3-36/+0
2021-05-15fix version_str commentRalf Jung-1/+1
2021-05-10Adjust target search algorithm for rustlib pathSimonas Kazlauskas-2/+1
With this the concerns expressed in #83800 should be addressed.
2021-04-06Auto merge of #81641 - bjorn3:find_codegen_backend, r=davidtwcobors-8/+17
Find codegen backends in more locations * Search in the sysroot passed using `--sysroot` in addition to the default sysroot. * Search for `librustc_codegen_$name.so` in addition to `librustc_codegen_$name-$release.so`. This combined would allow putting `librustc_codegen_cranelift.so` in the right location of a sysroot passed using `--sysroot`.
2021-03-13Document `everybody_loops`Camelid-10/+18
2021-03-08Rollup merge of #82047 - the8472:fast-rename, r=davidtwcoDylan DPC-0/+18
bypass auto_da_alloc for metadata files This saves about 0.7% when rerunning the UI test suite. I.e. when the metadata files exist and will be overwritten. No improvements expected for a clean build. So it might show up in incr-patched perf results. ``` regular rename: Benchmark #1: touch src/tools/compiletest/src/main.rs ; RUSTC_WRAPPER="" schedtool -B -e ./x.py test src/test/ui Time (mean ± σ): 47.305 s ± 0.170 s [User: 1631.540 s, System: 412.648 s] Range (min … max): 47.125 s … 47.856 s 20 runs non-durable rename: Benchmark #1: touch src/tools/compiletest/src/main.rs ; RUSTC_WRAPPER="" schedtool -B -e ./x.py test src/test/ui Time (mean ± σ): 46.930 s ± 0.064 s [User: 1634.344 s, System: 396.038 s] Range (min … max): 46.759 s … 47.043 s 20 runs ``` There are more places that trigger auto_da_alloc behavior by overwriting existing files with O_TRUNC, but those are much harder to locate because `O_TRUNC` is set on `open()` but the writeback is triggered on `close()`. The latter is the part which shows up in profiles.
2021-02-19Move handle_deadlock where it is used.Camille GILLOT-4/+28
2021-02-13bypass auto_da_alloc for metadata filesThe8472-0/+18
2021-02-01Find codegen backends in more locationsbjorn3-8/+17
* Search in the sysroot passed using `--sysroot` in addition to the default sysroot. * Search for `librustc_codegen_$name.so` in addition to `librustc_codegen_$name-$release.so`.
2021-02-01Box the biggest ast::ItemKind variantsDániel Buga-2/+2
2020-11-26Properly handle attributes on statementsAaron Hill-2/+0
We now collect tokens for the underlying node wrapped by `StmtKind` instead of storing tokens directly in `Stmt`. `LazyTokenStream` now supports capturing a trailing semicolon after it is initially constructed. This allows us to avoid refactoring statement parsing to wrap the parsing of the semicolon in `parse_tokens`. Attributes on item statements (e.g. `fn foo() { #[bar] struct MyStruct; }`) are now treated as item attributes, not statement attributes, which is consistent with how we handle attributes on other kinds of statements. The feature-gating code is adjusted so that proc-macro attributes are still allowed on item statements on stable. Two built-in macros (`#[global_allocator]` and `#[test]`) needed to be adjusted to support being passed `Annotatable::Stmt`.
2020-11-24Move lev_distance to rustc_ast, make non-genericArlie Davis-3/+6
rustc_ast currently has a few dependencies on rustc_lexer. Ideally, an AST would not have any dependency its lexer, for minimizing unnecessarily design-time dependencies. Breaking this dependency would also have practical benefits, since modifying rustc_lexer would not trigger a rebuild of rustc_ast. This commit does not remove the rustc_ast --> rustc_lexer dependency, but it does remove one of the sources of this dependency, which is the code that handles fuzzy matching between symbol names for making suggestions in diagnostics. Since that code depends only on Symbol, it is easy to move it to rustc_span. It might even be best to move it to a separate crate, since other tools such as Cargo use the same algorithm, and have simply contain a duplicate of the code. This changes the signature of find_best_match_for_name so that it is no longer generic over its input. I checked the optimized binaries, and this function was duplicated at nearly every call site, because most call sites used short-lived iterator chains, generic over Map and such. But there's no good reason for a function like this to be generic, since all it does is immediately convert the generic input (the Iterator impl) to a concrete Vec<Symbol>. This has all of the costs of generics (duplicated method bodies) with no benefit. Changing find_best_match_for_name to be non-generic removed about 10KB of code from the optimized binary. I know it's a drop in the bucket, but we have to start reducing binary size, and beginning to tame over-use of generics is part of that.
2020-11-10Merge set_panic and set_print into set_output_capture.Mara Bos-2/+2
There were no use cases for setting them separately. Merging them simplifies some things.
2020-11-10Use Vec<u8> for LOCAL_STD{OUT,ERR} instead of dyn Write.Mara Bos-6/+2
It was only ever used with Vec<u8> anyway. This simplifies some things. - It no longer needs to be flushed, because that's a no-op anyway for a Vec<u8>. - Writing to a Vec<u8> never fails. - No #[cfg(test)] code is needed anymore to use `realstd` instead of `std`, because Vec comes from alloc, not std (like Write).
2020-11-10Remove io::LocalOutput and use Arc<Mutex<dyn>> for local streams.Mara Bos-18/+3
2020-11-09Rollup merge of #78710 - petrochenkov:macvisit, r=davidtwcoDylan DPC-6/+0
rustc_ast: Do not panic by default when visiting macro calls Panicking by default made sense when we didn't have HIR or MIR and everything worked on AST, but now all AST visitors run early and majority of them have to deal with macro calls, often by ignoring them. The second commit renames `visit_mac` to `visit_mac_call`, the corresponding structures were renamed earlier in https://github.com/rust-lang/rust/pull/69589.
2020-11-04fix a couple of clippy warnings:Matthias Krüger-5/+4
filter_next manual_strip redundant_static_lifetimes single_char_pattern unnecessary_cast unused_unit op_ref redundant_closure useless_conversion
2020-11-03rustc_ast: Do not panic by default when visiting macro callsVadim Petrochenkov-6/+0
2020-10-27Auto merge of #78227 - SergioBenitez:test-stdout-threading, r=m-ou-sebors-0/+5
Capture output from threads spawned in tests This is revival of #75172. Original text: > Fixes #42474. > > r? `@​dtolnay` since you expressed interest in this, but feel free to redirect if you aren't the right person anymore. --- Closes #75172.
2020-10-26Add support for using cg_clif to bootstrap rustcbjorn3-7/+128
2020-10-22Capture output from threads spawned in testsTyler Mandry-0/+5
Fixes #42474.
2020-10-08Remove not needed lambda.Kazantcev Andrey-1/+1
2020-09-27Add option to pass a custom codegen backend from a driverbjorn3-1/+9
2020-09-17PR feedbackkhyperia-3/+3
2020-09-17Let backends define custom targetskhyperia-6/+9
Add a target_override hook that takes priority over builtin targets.
2020-09-10Attach tokens to `ast::Stmt`Aaron Hill-0/+2
We currently only attach tokens when parsing a `:stmt` matcher for a `macro_rules!` macro. Proc-macro attributes on statements are still unstable, and need additional work.
2020-09-10Attach `TokenStream` to `ast::Block`Aaron Hill-0/+1
A `Block` does not have outer attributes, so we only capture tokens when parsing a `macro_rules!` matcher
2020-09-01interface: use `OnceCell` from standard librarymarmeladema-2/+2
2020-08-30mv compiler to compiler/mark-0/+770