about summary refs log tree commit diff
path: root/compiler/rustc_session/src/utils.rs
AgeCommit message (Collapse)AuthorLines
2025-08-27Move `NativeLibKind` from `rustc_session` to `rustc_hir`Jonathan Brouwer-63/+1
2025-04-26session: Cleanup `CanonicalizedPath::new`Vadim Petrochenkov-3/+3
It wants an owned path, so pass an owned path
2025-03-28use `slice::contains` where applicableYotam Ofek-5/+6
2025-02-26Support raw-dylib link kind on ELFNoratrieb-0/+1
raw-dylib is a link kind that allows rustc to link against a library without having any library files present. This currently only exists on Windows. rustc will take all the symbols from raw-dylib link blocks and put them in an import library, where they can then be resolved by the linker. While import libraries don't exist on ELF, it would still be convenient to have this same functionality. Not having the libraries present at build-time can be convenient for several reasons, especially cross-compilation. With raw-dylib, code linking against a library can be cross-compiled without needing to have these libraries available on the build machine. If the libc crate makes use of this, it would allow cross-compilation without having any libc available on the build machine. This is not yet possible with this implementation, at least against libc's like glibc that use symbol versioning. The raw-dylib kind could be extended with support for symbol versioning in the future. This implementation is very experimental and I have not tested it very well. I have tested it for a toy example and the lz4-sys crate, where it was able to successfully link a binary despite not having a corresponding library at build-time.
2024-10-12remove a couple of redundant String to String conversionMatthias Krüger-1/+1
2024-07-29Reformat `use` declarations.Nicholas Nethercote-5/+5
The previous commit updated `rustfmt.toml` appropriately. This commit is the outcome of running `x fmt --all` with the new formatting options.
2024-04-29Remove `extern crate rustc_macros` from numerous crates.Nicholas Nethercote-0/+1
2024-03-28compiler: fix unused_peekable clippy lintklensy-1/+1
warning: `peek` never called on `Peekable` iterator --> compiler\rustc_session\src\utils.rs:130:13 | 130 | let mut args = std::env::args_os().map(|arg| arg.to_string_lossy().to_string()).peekable(); | ^^^^ | = help: consider removing the call to `peekable` = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unused_peekable warning: `peek` never called on `Peekable` iterator --> compiler\rustc_trait_selection\src\traits\error_reporting\suggestions.rs:4934:17 | 4934 | let mut bounds = pred.bounds.iter().peekable(); | ^^^^^^ | = help: consider removing the call to `peekable` = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unused_peekable
2024-02-17Use better heuristic for printing Cargo specific diagnosticsUrgau-1/+19
2023-11-30Move `is_ascii_ident` to where it's used.Nicholas Nethercote-11/+0
2023-10-13Format all the let chains in compilerMichael Goulet-1/+3
2023-09-20Validate crate name in CLI option --externLeón Orell Valerian Liehr-0/+9
2023-08-24Move extra_compiler_flags() to rustc_sessionMartin Nordholts-0/+47
To make it available to other parts of the compiler.
2023-07-24Add missing documentation for `Session::time`Guillaume Gomez-0/+1
2023-03-23Rollup merge of #109231 - Zoxc:fs-non-canon, r=eholkMatthias Krüger-1/+2
Add `try_canonicalize` to `rustc_fs_util` and use it over `fs::canonicalize` This adds `try_canonicalize` which tries to call `fs::canonicalize`, but falls back to `std::path::absolute` if it fails. Existing `canonicalize` calls are replaced with it. `fs::canonicalize` is not guaranteed to work on Windows.
2023-03-19The name of NativeLib will be presentedyukang-1/+8
2023-03-16Add `try_canonicalize` to `rustc_fs_util` and use it over `fs::canonicalize`John Kåre Alsaker-1/+2
2022-12-20rustc: Remove needless lifetimesJeremy Stucki-1/+1
2022-10-19Get rid of native_library projection queriesnils-0/+11
They don't seem particularly useful as I don't expect native libraries to change frequently.
2022-07-26Lib kind -l link-arg:Daniil Belov-1/+4
arbitrary link argument like -C link-arg, but respecting relative order to other `-l` options, unstable
2022-05-22rustc_parse: Move AST -> TokenStream conversion logic to `rustc_ast`Vadim Petrochenkov-58/+0
2022-05-18use `CursorRef` more, to not to clone `Tree`sklensy-1/+1
2022-04-28rustc_ast: Harmonize delimiter naming with `proc_macro::Delimiter`Vadim Petrochenkov-2/+2
2022-04-19incr. comp.: Don't export impl_stable_hash_via_hash!() and warn about using it.Michael Woerister-4/+2
2022-04-02ast_lowering: Stop wrapping `ident` matchers into groupsVadim Petrochenkov-0/+3
The lowered forms goes to metadata, for example during encoding of macro definitions
2022-03-30Stabilize native library modifier syntax and the `whole-archive` modifier ↵Vadim Petrochenkov-0/+20
specifically
2022-03-16resolve the conflict in compiler/rustc_session/src/parse.rscodehorseman-2/+2
Signed-off-by: codehorseman <cricis@yeah.net>
2021-05-05Implement RFC 2951: Native link modifiersLuqman Aden-8/+25
This commit implements both the native linking modifiers infrastructure as well as an initial attempt at the individual modifiers from the RFC. It also introduces a feature flag for the general syntax along with individual feature flags for each modifier.
2021-04-11Implement token-based handling of attributes during expansionAaron Hill-0/+55
This PR modifies the macro expansion infrastructure to handle attributes in a fully token-based manner. As a result: * Derives macros no longer lose spans when their input is modified by eager cfg-expansion. This is accomplished by performing eager cfg-expansion on the token stream that we pass to the derive proc-macro * Inner attributes now preserve spans in all cases, including when we have multiple inner attributes in a row. This is accomplished through the following changes: * New structs `AttrAnnotatedTokenStream` and `AttrAnnotatedTokenTree` are introduced. These are very similar to a normal `TokenTree`, but they also track the position of attributes and attribute targets within the stream. They are built when we collect tokens during parsing. An `AttrAnnotatedTokenStream` is converted to a regular `TokenStream` when we invoke a macro. * Token capturing and `LazyTokenStream` are modified to work with `AttrAnnotatedTokenStream`. A new `ReplaceRange` type is introduced, which is created during the parsing of a nested AST node to make the 'outer' AST node aware of the attributes and attribute target stored deeper in the token stream. * When we need to perform eager cfg-expansion (either due to `#[derive]` or `#[cfg_eval]`), we tokenize and reparse our target, capturing additional information about the locations of `#[cfg]` and `#[cfg_attr]` attributes at any depth within the target. This is a performance optimization, allowing us to perform less work in the typical case where captured tokens never have eager cfg-expansion run.
2021-01-29Pre-canoncalize ExternLocation::ExactPathsRyan Levick-0/+23
2020-08-30mv compiler to compiler/mark-0/+32