Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 7 pull requests #135789

Merged
merged 182 commits into from
Jan 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
182 commits
Select commit Hold shift + click to select a range
d8eb839
Rename dependency tree view and dependency provider
Giga-Bowser Dec 27, 2024
bdb72bd
internal: Generalize `make::expr_from_text` to types which implement …
Giga-Bowser Dec 14, 2024
8435e3f
internal: `make::expr_prefix` should return `ast::PrefixExpr`
Giga-Bowser Dec 14, 2024
aacc2eb
internal: `make::expr_if` should return `ast::IfExpr`
Giga-Bowser Dec 14, 2024
ef7bb04
internal: `make::expr_tuple` should return `ast::TupleExpr`
Giga-Bowser Dec 16, 2024
6528650
internal: move `make::expr_unit` to `make::ext::expr_unit`
Giga-Bowser Dec 16, 2024
0606db4
internal: Generally improve `make::match_arm`
Giga-Bowser Dec 16, 2024
cce5f25
internal: `make::expr_match` should return `ast::MatchExpr`
Giga-Bowser Dec 16, 2024
cd80380
internal: Add some path constructors to `SyntaxFactory`
Giga-Bowser Dec 14, 2024
396b56f
internal: Add some expr constructors to `SyntaxFactory`
Giga-Bowser Dec 18, 2024
fa8acfa
internal: Add some pattern constructors to `SyntaxFactory`
Giga-Bowser Dec 18, 2024
b2fa162
internal: Migrate `replace_let_with_if_let` assist to `SyntaxEditor`
Giga-Bowser Dec 18, 2024
aa36ac8
internal: Migrate `if let` <=> `match` assists to `SyntaxEditor`
Giga-Bowser Dec 18, 2024
bce6435
Fix a bug with missing binding in MBE
ChayimFriedman2 Jan 7, 2025
a748001
Merge pull request #18877 from ChayimFriedman2/crazy-hang
lnicola Jan 8, 2025
cc07c98
Fix test-fixture autopublishing
lnicola Jan 8, 2025
7c256e5
Merge pull request #18882 from lnicola/publish-test-fixture
lnicola Jan 8, 2025
16721e3
Merge pull request #18855 from Giga-Bowser/migrate-if-let
Veykril Jan 8, 2025
bc1a7fa
fix: Fix `env`/`option_env` macro check disregarding macro_rules defi…
Veykril Jan 8, 2025
8982535
Merge pull request #18884 from Veykril/push-xwqkorxozzkq
Veykril Jan 8, 2025
2be4ce0
refactor: struct holding cargo cfgs settings
qjerome Jan 8, 2025
c59ecb3
fix: autogenerate files
qjerome Jan 8, 2025
93d08b7
fix: requested changed
qjerome Jan 8, 2025
8d1ae29
refactor test helpers within ide-completions
vishruth-thimmaiah Jan 8, 2025
253bba0
Add config setting which allows adding additional include paths to th…
PrototypeNM1 Jan 8, 2025
4001c46
internal: Migrate `wrap_return_type` assist to use `SyntaxEditor`
Giga-Bowser Nov 16, 2024
9b6b629
internal: Migrate `unwrap_return_type` assist to use `SyntaxEditor`
Giga-Bowser Nov 17, 2024
3d6c2f2
minor: Use placeholders in `unwrap_return_type`
Giga-Bowser Nov 17, 2024
13e302c
Fix actual token lookup in completion's `expand()`
ChayimFriedman2 Jan 9, 2025
89a72c7
Make edition per-token, not per-file
ChayimFriedman2 Jan 7, 2025
fbc1d51
Merge pull request #18524 from Giga-Bowser/migrate-wrap-unwrap-return
Veykril Jan 9, 2025
547a12e
Merge pull request #18887 from vishruth-thimmaiah/refactor_completion…
Veykril Jan 9, 2025
cd60477
minor: Fixup macro error kinds
Veykril Jan 9, 2025
85310c4
Merge pull request #18890 from Veykril/push-nwnozlyppvzo
Veykril Jan 9, 2025
f4ecc34
Merge pull request #18885 from qjerome/refactor-cargo-cfgs
Veykril Jan 9, 2025
f6e8974
Merge pull request #18861 from ChayimFriedman2/await-edition
Veykril Jan 9, 2025
e4708fe
Merge pull request #18880 from PrototypeNM1/extra-includes
Veykril Jan 9, 2025
d1b9176
Merge pull request #18889 from ChayimFriedman2/subtle-completion
Veykril Jan 9, 2025
c26f175
Fix parsing cargo test json output by making stdout and optional field
Jan 9, 2025
78c377f
Add a new and improved syntax tree viewer
Giga-Bowser Dec 21, 2024
628db53
Remove the old syntax tree viewer
Giga-Bowser Jan 6, 2025
37b089d
Fix another issue with fixup reversing
ChayimFriedman2 Jan 9, 2025
56d06fb
Add an action to copy an element from the syntax tree view
Giga-Bowser Jan 7, 2025
c9f75a0
Do not compute `prettify_macro_expansion()` unless the "Inline macro"…
ChayimFriedman2 Jan 9, 2025
62a92b3
Remove two hir reexports
ChayimFriedman2 Jan 10, 2025
669d34d
Merge pull request #18899 from ChayimFriedman2/issue-18898
Veykril Jan 10, 2025
5adca85
Merge pull request #18813 from Giga-Bowser/syntax-tree-view
Veykril Jan 10, 2025
ab7f367
Merge pull request #18901 from ChayimFriedman2/hir-reexport
Veykril Jan 10, 2025
2c2d2a7
Merge commit 'e39eacd2d415803ef82de3b6a314e4f2d0fbc4dc' into sync_cg_…
bjorn3 Jan 10, 2025
a642651
Merge branch 'sync_from_rust'
bjorn3 Jan 10, 2025
c4ffd32
internal: Add Definition::Crate
Veykril Jan 10, 2025
7821390
Merge pull request #18902 from Veykril/push-znlsxykqrkoo
Veykril Jan 10, 2025
65a97e6
Merge pull request #18900 from ChayimFriedman2/stupid-hang
Veykril Jan 10, 2025
3b6e364
Respect --sysroot for rustc -vV and -Cpasses=list
bjorn3 Jan 10, 2025
9a9b069
Improve hover module path rendering
Veykril Jan 10, 2025
17a6f31
Implement implicit sized bound inlay hints
Veykril Jan 10, 2025
0a354a4
Merge pull request #18903 from Veykril/push-mqmworppxuyw
Veykril Jan 10, 2025
f513b27
Merge pull request #18904 from Veykril/push-yztnorquuyzw
Veykril Jan 10, 2025
a006eab
Re-implement rust string highlighting via tool attribute
Veykril Jan 10, 2025
337f2c9
Missing errors
jnyfah Jan 10, 2025
b0eb548
Merge pull request #18906 from Veykril/push-upuxsyovskmt
Veykril Jan 10, 2025
a40bbcf
Implement `#[rust_analyzer::skip]` for bodies
Veykril Jan 10, 2025
6d05207
Merge pull request #18907 from Veykril/push-uqlzpttmvurv
Veykril Jan 10, 2025
442c4ed
minor: Fix grammar in doc comments
Wilfred Jan 10, 2025
f00e5ca
Merge pull request #18913 from Wilfred/grammar_fix
lnicola Jan 11, 2025
ab9779b
fix: Fix `ref` text edit for binding mode hints
Veykril Jan 12, 2025
139db0a
Merge pull request #18920 from Veykril/push-zxwtmooxumsl
Veykril Jan 12, 2025
b79da13
internal: Compute inlay hint text edits lazily
Veykril Jan 12, 2025
ed121ec
Fix text edits for discriminant hints
Veykril Jan 12, 2025
b1aa9fb
Merge pull request #18921 from Veykril/push-zwullmxomvsm
Veykril Jan 12, 2025
6766e66
internal: Compute inlay hint tooltips lazily
Veykril Jan 12, 2025
0f900e2
Merge pull request #18923 from Veykril/push-oovkowowotqx
Veykril Jan 12, 2025
70309b1
Fix another bug when reaching macro expansion limit caused a stack ov…
ChayimFriedman2 Jan 12, 2025
a10a921
feat: Add dereferencing autocomplete
boattime Jan 11, 2025
49b2257
Update `notify` to `8.0.0`
decahedron1 Jan 14, 2025
9792803
Add the ability to jump from `into` to `from` definitions
1hakusai1 Jan 14, 2025
d36b3a2
Merge pull request #18933 from decahedron1/notify-7
lnicola Jan 14, 2025
4267a3a
fix_typo
1hakusai1 Jan 14, 2025
4cc9c15
Remove trailing spaces
1hakusai1 Jan 14, 2025
1f5a88a
refactor: get(0) -> first()
1hakusai1 Jan 14, 2025
e7609d6
Disable -Zfunction-sections by default on Windows
bjorn3 Jan 14, 2025
6ef4582
Merge pull request #1554 from rust-lang/fix_msvc_linker_hang
bjorn3 Jan 14, 2025
76cb21a
Update compiler-builtins to 0.1.141
tgross35 Jan 7, 2025
b470508
Hide syntax tree view by default
darichey Jan 14, 2025
d3f6969
Merge pull request #18937 from darichey/hide-syntax-tree-default
lnicola Jan 14, 2025
9024a66
Use a C-safe return type for `__rust_[ui]128_*` overflowing intrinsics
tgross35 Dec 15, 2024
b52c07f
Update compiler-builtins to 0.1.143
tgross35 Jan 15, 2025
a12c80d
Merge pull request #18917 from boattime/master
Veykril Jan 15, 2025
eed2b5c
feat: Render type parameter projection target bounds in inlays
Veykril Jan 12, 2025
0ed9d1c
Merge pull request #18925 from Veykril/push-mtxxvpowwtrt
Veykril Jan 15, 2025
1ceea5b
Early exit in search properly
Veykril Jan 15, 2025
7be6698
Flip on typing config to be opt-in, better defaults
Veykril Jan 15, 2025
7db40dd
Add test cases
1hakusai1 Jan 15, 2025
f669b55
Use adjusted type
1hakusai1 Jan 15, 2025
f441bbf
Fix wrong fixture
1hakusai1 Jan 15, 2025
b56b4d6
fix: Fix semantics not always correctly caching file roots
Veykril Jan 15, 2025
97522d1
Merge pull request #18939 from Veykril/push-wztmylkyqttu
Veykril Jan 15, 2025
38e696f
Merge pull request #18929 from ChayimFriedman2/i-acknowledge-defeat
Veykril Jan 15, 2025
6bf1459
Merge pull request #18940 from Veykril/push-ulowqkpprslq
Veykril Jan 15, 2025
79f1471
fix: Don't return inlay hints outside requested range
Veykril Jan 12, 2025
805598d
Merge pull request #18922 from Veykril/push-tmtzukrsnott
Veykril Jan 15, 2025
88ae089
Merge pull request #18897 from duncanawoods/master
HKalbasi Jan 15, 2025
553d525
Add smart completions that skip `await` or `iter()` and `into_iter()`
ChayimFriedman2 Jan 12, 2025
c656f87
Export likely(), unlikely() and cold_path() in std::hint
x17jiri Dec 1, 2024
41ae382
Add gpu-kernel calling convention
Flakebi Jan 2, 2025
20e3834
add a test for trait upcasting type mismatch
WaffleLapkin Jan 15, 2025
fea2526
update chalk
WaffleLapkin Jan 15, 2025
97a7d23
refactor: rename to descriptive name
1hakusai1 Jan 16, 2025
7f3601f
refactor: Change order of arguments
1hakusai1 Jan 16, 2025
36d705e
Use resolve_method_call_as_callable to handle function types
1hakusai1 Jan 16, 2025
b6ba392
add go-to-type-def actions for func params
lh123 Jan 16, 2025
fdc672e
add goto-to-def actions for trait bound
lh123 Jan 16, 2025
1c73899
Merge pull request #18944 from WaffleLapkin/trait_upcast_chalk
lnicola Jan 16, 2025
d6477b9
Merge pull request #18927 from ChayimFriedman2/skip-iter-await
Veykril Jan 16, 2025
8ec9094
Merge pull request #18946 from lh123/goto-to-type-def-func-param-and-…
Veykril Jan 16, 2025
c00dfed
Partially back out "fix: Fix sourceroot construction for virtual mani…
Veykril Jan 16, 2025
419bdb2
Merge pull request #18949 from Veykril/push-yzklntsnnuts
Veykril Jan 16, 2025
aebad29
Sync from rust 419b3e2d3e350822550eee0e82eeded4d324d584
bjorn3 Jan 16, 2025
8a46f85
Rustup to rustc 1.86.0-nightly (419b3e2d3 2025-01-15)
bjorn3 Jan 16, 2025
cda9145
Fix rustc test suite
bjorn3 Jan 16, 2025
5a97637
Add missing `#[rust_analyzer::rust_fixture]` annotations
Veykril Jan 16, 2025
548d70f
Add edit test for await skipping completions
Veykril Jan 16, 2025
664cdd2
Minor docs improvement
Veykril Jan 16, 2025
4d5632b
Generalize some type walking in hover type actions
Veykril Jan 16, 2025
56059f8
Merge pull request #18950 from Veykril/push-okmsynnltxts
Veykril Jan 16, 2025
fa71da9
Merge pull request #18951 from Veykril/push-zpvunsvlpuxt
Veykril Jan 16, 2025
341a6d5
feat: complete raw, const keyword
lh123 Jan 16, 2025
39a1bb9
update blocklike
jnyfah Jan 16, 2025
824bad7
Fix `debug_assertions` broken in 1c5a125beb35725ccc2ade005db9870db734…
VinTarZ Jan 16, 2025
8d784be
Merge pull request #18953 from VinTarZ/master
lnicola Jan 16, 2025
1f32c2a
don't complete `raw` in `&mut $0`
lh123 Jan 16, 2025
715e457
revert blocklike changes
jnyfah Jan 16, 2025
99c7013
Merge pull request #18952 from lh123/add-raw-keyword-complete
Veykril Jan 16, 2025
05712c6
added tests
jnyfah Jan 16, 2025
474c73b
CRLF to LF
jnyfah Jan 16, 2025
14b00fb
Auto merge of #135047 - Flakebi:amdgpu-kernel-cc, r=workingjubilee
bors Jan 17, 2025
ff5c32f
Merge pull request #18908 from jnyfah/error-braces
Veykril Jan 17, 2025
3ce55e9
add missing `Win32_Foundation` feature
gvozdvmozgu Jan 17, 2025
6c1b1a1
Merge pull request #18963 from gvozdvmozgu/Win32_Foundation
lnicola Jan 17, 2025
577a96a
Bump windows-sys
lnicola Jan 17, 2025
2406225
Update syntax tree viewer docs
Jan 16, 2025
b53b299
Extract variable assist triggers less eagerly
Veykril Jan 18, 2025
5f117b4
fix: `cargo rustc --print` needs `unstable-options`
Veykril Jan 18, 2025
013130c
Merge pull request #18968 from Veykril/push-szvltqqttsyy
Veykril Jan 18, 2025
b8eec1a
Merge pull request #18957 from markmurphydev/docs_vscode_syntax_tree
lnicola Jan 18, 2025
61af2cc
Merge pull request #18966 from lnicola/bump-windows-sys
lnicola Jan 18, 2025
06f6d8b
lsp-server: Drop outgoing messages on background thread
osiewicz Jan 18, 2025
9acb9fa
Revert "Auto merge of #134330 - scottmcm:no-more-rvalue-len, r=matthe…
lqd Jan 18, 2025
31e8419
Fix a bug where enum variants were not considered properly in type ns…
ChayimFriedman2 Jan 19, 2025
1f0e35e
Recognise new IPv6 documentation range from RFC9637
bardiharborow Jan 19, 2025
b81474b
Preparing for merge from rust-lang/rust
lnicola Jan 20, 2025
4cf9f49
Merge from rust-lang/rust
lnicola Jan 20, 2025
3af5c08
Bump rustc crates
lnicola Jan 20, 2025
5f4f6fb
proc-macro-srv: make usage of RTLD_DEEPBIND portable
Fabian-Gruenbichler Jan 16, 2025
141e53b
Merge pull request #18980 from lnicola/sync-from-rust
lnicola Jan 20, 2025
618b913
Merge pull request #18981 from Fabian-Gruenbichler/proc-macro-srv-por…
lnicola Jan 20, 2025
55aee54
Use Semantics::resolve_method_call_as_callable to find implementation
1hakusai1 Jan 20, 2025
f7096db
Add a test case
1hakusai1 Jan 20, 2025
241fd2f
Properly record meaningful imports as re-exports in symbol index
Veykril Jan 18, 2025
70e93ed
Vec -> Box<[_]>
Veykril Jan 18, 2025
dbf7ccc
Preserve impl assoc names in ImplData
Veykril Jan 18, 2025
7ddeaba
Less allocs
Veykril Jan 18, 2025
4193abc
Fix import search not discarding rawness
Veykril Jan 20, 2025
64d4181
Merge pull request #18976 from ChayimFriedman2/non-module-generic-args
Veykril Jan 20, 2025
2233c31
Merge pull request #18972 from osiewicz/drop-outgoing-messages-on-bac…
Veykril Jan 20, 2025
5770977
Merge pull request #18982 from Veykril/push-lstmvzsowxyt
Veykril Jan 20, 2025
fe034ed
Merge pull request #18934 from 1hakusai1/goto_definition_from_into
Veykril Jan 20, 2025
1eb9d15
Merge pull request #18967 from Veykril/push-pwonkmwqmmol
Veykril Jan 20, 2025
e749a38
docs: update contributing docs for submodule/subtree changes
jieyouxu Jan 20, 2025
c79fc90
Updated several files to use rust intrinsic macros instead of the leg…
vayunbiyani Jan 10, 2025
496b073
Sync from rust 9a1d156f38c51441ee51e5a068f1d0caf4bb0f27
bjorn3 Jan 20, 2025
728bc27
Rustup to rustc 1.86.0-nightly (9a1d156f3 2025-01-19)
bjorn3 Jan 20, 2025
cb2efaf
1. Removed 'rustc_nounwind' 2. Rewording of comments
x17jiri Jan 20, 2025
d740a3f
Merge commit '728bc27f32c05ac8a9b5eb33fd101e479072984f' into sync_cg_…
bjorn3 Jan 20, 2025
056a9ce
Respect --target in get_backend_from_raw_matches
bjorn3 Jan 20, 2025
bbec151
Rollup merge of #133695 - x17jiri:hint_likely, r=Amanieu
matthiaskrgr Jan 20, 2025
c8c5fa4
Rollup merge of #135330 - bjorn3:respect_sysroot_in_version_printing,…
matthiaskrgr Jan 20, 2025
0d5b813
Rollup merge of #135333 - vayunbiyani:test-environment, r=RalfJung
matthiaskrgr Jan 20, 2025
8a7db69
Rollup merge of #135741 - bardiharborow:std/net/rfc9637, r=Amanieu
matthiaskrgr Jan 20, 2025
ab69a95
Rollup merge of #135770 - jieyouxu:subtree-submodule-contributing, r=…
matthiaskrgr Jan 20, 2025
b0eadb1
Rollup merge of #135775 - lnicola:sync-from-ra, r=lnicola
matthiaskrgr Jan 20, 2025
67b609a
Rollup merge of #135776 - bjorn3:sync_cg_clif-2025-01-20, r=bjorn3
matthiaskrgr Jan 20, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
9 changes: 9 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,15 @@ Documentation for contributing to the compiler or tooling is located in the [Gui
Development][rustc-dev-guide], commonly known as the [rustc-dev-guide]. Documentation for the
standard library in the [Standard library developers Guide][std-dev-guide], commonly known as the [std-dev-guide].

## Making changes to subtrees and submodules

For submodules, changes need to be made against the repository corresponding the
submodule, and not the main `rust-lang/rust` repository.

For subtrees, prefer sending a PR against the subtree's repository if it does
not need to be made against the main `rust-lang/rust` repostory (e.g. a
rustc-dev-guide change that does not accompany a compiler change).

## About the [rustc-dev-guide]

The [rustc-dev-guide] is meant to help document how rustc –the Rust compiler– works,
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_cranelift/rust-toolchain
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[toolchain]
channel = "nightly-2025-01-10"
channel = "nightly-2025-01-20"
components = ["rust-src", "rustc-dev", "llvm-tools"]
profile = "minimal"
5 changes: 2 additions & 3 deletions compiler/rustc_codegen_cranelift/scripts/test_rustc_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -176,12 +176,11 @@ diff --git a/src/tools/run-make-support/src/rustdoc.rs b/src/tools/run-make-supp
index 9607ff02f96..b7d97caf9a2 100644
--- a/src/tools/run-make-support/src/external_deps/rustdoc.rs
+++ b/src/tools/run-make-support/src/external_deps/rustdoc.rs
@@ -34,8 +34,6 @@ pub fn bare() -> Self {
@@ -34,7 +34,6 @@ pub fn bare() -> Self {
#[track_caller]
pub fn new() -> Self {
let mut cmd = setup_common();
- let target_rpath_dir = env_var_os("TARGET_RPATH_DIR");
- cmd.arg(format!("-L{}", target_rpath_dir.to_string_lossy()));
- cmd.arg("-L").arg(env_var_os("TARGET_RPATH_DIR"));
Self { cmd }
}

Expand Down
10 changes: 9 additions & 1 deletion compiler/rustc_codegen_cranelift/src/driver/aot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -333,9 +333,17 @@ fn make_module(sess: &Session, name: String) -> UnwindModule<ObjectModule> {

let mut builder =
ObjectBuilder::new(isa, name + ".o", cranelift_module::default_libcall_names()).unwrap();

// Disable function sections by default on MSVC as it causes significant slowdowns with link.exe.
// Maybe link.exe has exponential behavior when there are many sections with the same name? Also
// explicitly disable it on MinGW as rustc already disables it by default on MinGW and as such
// isn't tested. If rustc enables it in the future on MinGW, we can re-enable it too once it has
// been on MinGW.
let default_function_sections = sess.target.function_sections && !sess.target.is_like_windows;
builder.per_function_section(
sess.opts.unstable_opts.function_sections.unwrap_or(sess.target.function_sections),
sess.opts.unstable_opts.function_sections.unwrap_or(default_function_sections),
);

UnwindModule::new(ObjectModule::new(builder), true)
}

Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//! Codegen of intrinsics. This includes `extern "rust-intrinsic"`,
//! functions marked with the `#[rustc_intrinsic]` attribute
//! and LLVM intrinsics that have symbol names starting with `llvm.`.

macro_rules! intrinsic_args {
Expand Down
37 changes: 22 additions & 15 deletions compiler/rustc_driver_impl/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ use rustc_middle::ty::TyCtxt;
use rustc_parse::{new_parser_from_file, new_parser_from_source_str, unwrap_or_emit_fatal};
use rustc_session::config::{
CG_OPTIONS, ErrorOutputType, Input, OptionDesc, OutFileName, OutputType, UnstableOptions,
Z_OPTIONS, nightly_options,
Z_OPTIONS, nightly_options, parse_target_triple,
};
use rustc_session::getopts::{self, Matches};
use rustc_session::lint::{Lint, LintId};
Expand Down Expand Up @@ -916,13 +916,7 @@ pub fn version_at_macro_invocation(
safe_println!("host: {}", config::host_tuple());
safe_println!("release: {release}");

let debug_flags = matches.opt_strs("Z");
let backend_name = debug_flags.iter().find_map(|x| x.strip_prefix("codegen-backend="));
let opts = config::Options::default();
let sysroot = filesearch::materialize_sysroot(opts.maybe_sysroot.clone());
let target = config::build_target_config(early_dcx, &opts, &sysroot);

get_codegen_backend(early_dcx, &sysroot, backend_name, &target).print_version();
get_backend_from_raw_matches(early_dcx, matches).print_version();
}
}

Expand Down Expand Up @@ -1125,19 +1119,32 @@ pub fn describe_flag_categories(early_dcx: &EarlyDiagCtxt, matches: &Matches) ->
}

if cg_flags.iter().any(|x| *x == "passes=list") {
let backend_name = debug_flags.iter().find_map(|x| x.strip_prefix("codegen-backend="));

let opts = config::Options::default();
let sysroot = filesearch::materialize_sysroot(opts.maybe_sysroot.clone());
let target = config::build_target_config(early_dcx, &opts, &sysroot);

get_codegen_backend(early_dcx, &sysroot, backend_name, &target).print_passes();
get_backend_from_raw_matches(early_dcx, matches).print_passes();
return true;
}

false
}

/// Get the codegen backend based on the raw [`Matches`].
///
/// `rustc -vV` and `rustc -Cpasses=list` need to get the codegen backend before we have parsed all
/// arguments and created a [`Session`]. This function reads `-Zcodegen-backend`, `--target` and
/// `--sysroot` without validating any other arguments and loads the codegen backend based on these
/// arguments.
fn get_backend_from_raw_matches(
early_dcx: &EarlyDiagCtxt,
matches: &Matches,
) -> Box<dyn CodegenBackend> {
let debug_flags = matches.opt_strs("Z");
let backend_name = debug_flags.iter().find_map(|x| x.strip_prefix("codegen-backend="));
let target = parse_target_triple(early_dcx, matches);
let sysroot = filesearch::materialize_sysroot(matches.opt_str("sysroot").map(PathBuf::from));
let target = config::build_target_config(early_dcx, &target, &sysroot);

get_codegen_backend(early_dcx, &sysroot, backend_name, &target)
}

fn describe_debug_flags() {
safe_println!("\nAvailable options:\n");
print_flag_list("-Z", config::Z_OPTIONS);
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_interface/src/interface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ pub fn run_compiler<R: Send>(config: Config, f: impl FnOnce(&Compiler) -> R + Se
crate::callbacks::setup_callbacks();

let sysroot = filesearch::materialize_sysroot(config.opts.maybe_sysroot.clone());
let target = config::build_target_config(&early_dcx, &config.opts, &sysroot);
let target = config::build_target_config(&early_dcx, &config.opts.target_triple, &sysroot);
let file_loader = config.file_loader.unwrap_or_else(|| Box::new(RealFileLoader));
let path_mapping = config.opts.file_path_mapping();
let hash_kind = config.opts.unstable_opts.src_hash_algorithm(&target);
Expand Down
3 changes: 2 additions & 1 deletion compiler/rustc_interface/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ where
let matches = optgroups().parse(args).unwrap();
let sessopts = build_session_options(&mut early_dcx, &matches);
let sysroot = filesearch::materialize_sysroot(sessopts.maybe_sysroot.clone());
let target = rustc_session::config::build_target_config(&early_dcx, &sessopts, &sysroot);
let target =
rustc_session::config::build_target_config(&early_dcx, &sessopts.target_triple, &sysroot);
let hash_kind = sessopts.unstable_opts.src_hash_algorithm(&target);
let checksum_hash_kind = sessopts.unstable_opts.checksum_hash_algorithm();
let sm_inputs = Some(SourceMapInputs {
Expand Down
8 changes: 6 additions & 2 deletions compiler/rustc_session/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1346,8 +1346,12 @@ pub fn build_configuration(sess: &Session, mut user_cfg: Cfg) -> Cfg {
user_cfg
}

pub fn build_target_config(early_dcx: &EarlyDiagCtxt, opts: &Options, sysroot: &Path) -> Target {
match Target::search(&opts.target_triple, sysroot) {
pub fn build_target_config(
early_dcx: &EarlyDiagCtxt,
target: &TargetTuple,
sysroot: &Path,
) -> Target {
match Target::search(target, sysroot) {
Ok((target, warnings)) => {
for warning in warnings.warning_messages() {
early_dcx.early_warn(warning)
Expand Down
135 changes: 135 additions & 0 deletions library/core/src/hint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -597,3 +597,138 @@ pub const fn black_box<T>(dummy: T) -> T {
pub const fn must_use<T>(value: T) -> T {
value
}

/// Hints to the compiler that a branch condition is likely to be true.
/// Returns the value passed to it.
///
/// It can be used with `if` or boolean `match` expressions.
///
/// When used outside of a branch condition, it may still influence a nearby branch, but
/// probably will not have any effect.
///
/// It can also be applied to parts of expressions, such as `likely(a) && unlikely(b)`, or to
/// compound expressions, such as `likely(a && b)`. When applied to compound expressions, it has
/// the following effect:
/// ```text
/// likely(!a) => !unlikely(a)
/// likely(a && b) => likely(a) && likely(b)
/// likely(a || b) => a || likely(b)
/// ```
///
/// See also the function [`cold_path()`] which may be more appropriate for idiomatic Rust code.
///
/// # Examples
///
/// ```
/// #![feature(likely_unlikely)]
/// use core::hint::likely;
///
/// fn foo(x: i32) {
/// if likely(x > 0) {
/// println!("this branch is likely to be taken");
/// } else {
/// println!("this branch is unlikely to be taken");
/// }
///
/// match likely(x > 0) {
/// true => println!("this branch is likely to be taken"),
/// false => println!("this branch is unlikely to be taken"),
/// }
///
/// // Use outside of a branch condition may still influence a nearby branch
/// let cond = likely(x != 0);
/// if cond {
/// println!("this branch is likely to be taken");
/// }
/// }
/// ```
///
///
#[unstable(feature = "likely_unlikely", issue = "26179")]
#[inline(always)]
pub const fn likely(b: bool) -> bool {
crate::intrinsics::likely(b)
}

/// Hints to the compiler that a branch condition is unlikely to be true.
/// Returns the value passed to it.
///
/// It can be used with `if` or boolean `match` expressions.
///
/// When used outside of a branch condition, it may still influence a nearby branch, but
/// probably will not have any effect.
///
/// It can also be applied to parts of expressions, such as `likely(a) && unlikely(b)`, or to
/// compound expressions, such as `unlikely(a && b)`. When applied to compound expressions, it has
/// the following effect:
/// ```text
/// unlikely(!a) => !likely(a)
/// unlikely(a && b) => a && unlikely(b)
/// unlikely(a || b) => unlikely(a) || unlikely(b)
/// ```
///
/// See also the function [`cold_path()`] which may be more appropriate for idiomatic Rust code.
///
/// # Examples
///
/// ```
/// #![feature(likely_unlikely)]
/// use core::hint::unlikely;
///
/// fn foo(x: i32) {
/// if unlikely(x > 0) {
/// println!("this branch is unlikely to be taken");
/// } else {
/// println!("this branch is likely to be taken");
/// }
///
/// match unlikely(x > 0) {
/// true => println!("this branch is unlikely to be taken"),
/// false => println!("this branch is likely to be taken"),
/// }
///
/// // Use outside of a branch condition may still influence a nearby branch
/// let cond = unlikely(x != 0);
/// if cond {
/// println!("this branch is likely to be taken");
/// }
/// }
/// ```
#[unstable(feature = "likely_unlikely", issue = "26179")]
#[inline(always)]
pub const fn unlikely(b: bool) -> bool {
crate::intrinsics::unlikely(b)
}

/// Hints to the compiler that given path is cold, i.e., unlikely to be taken. The compiler may
/// choose to optimize paths that are not cold at the expense of paths that are cold.
///
/// # Examples
///
/// ```
/// #![feature(cold_path)]
/// use core::hint::cold_path;
///
/// fn foo(x: &[i32]) {
/// if let Some(first) = x.get(0) {
/// // this is the fast path
/// } else {
/// // this path is unlikely
/// cold_path();
/// }
/// }
///
/// fn bar(x: i32) -> i32 {
/// match x {
/// 1 => 10,
/// 2 => 100,
/// 3 => { cold_path(); 1000 }, // this branch is unlikely
/// _ => { cold_path(); 10000 }, // this is also unlikely
/// }
/// }
/// ```
#[unstable(feature = "cold_path", issue = "26179")]
#[inline(always)]
pub const fn cold_path() {
crate::intrinsics::cold_path()
}
11 changes: 7 additions & 4 deletions library/core/src/net/ip_addr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1539,8 +1539,9 @@ impl Ipv6Addr {
/// // Addresses reserved for benchmarking (`2001:2::/48`)
/// assert_eq!(Ipv6Addr::new(0x2001, 2, 0, 0, 0, 0, 0, 1,).is_global(), false);
///
/// // Addresses reserved for documentation (`2001:db8::/32`)
/// // Addresses reserved for documentation (`2001:db8::/32` and `3fff::/20`)
/// assert_eq!(Ipv6Addr::new(0x2001, 0xdb8, 0, 0, 0, 0, 0, 1).is_global(), false);
/// assert_eq!(Ipv6Addr::new(0x3fff, 0, 0, 0, 0, 0, 0, 0).is_global(), false);
///
/// // Unique local addresses (`fc00::/7`)
/// assert_eq!(Ipv6Addr::new(0xfc02, 0, 0, 0, 0, 0, 0, 1).is_global(), false);
Expand Down Expand Up @@ -1686,11 +1687,12 @@ impl Ipv6Addr {
}

/// Returns [`true`] if this is an address reserved for documentation
/// (`2001:db8::/32`).
/// (`2001:db8::/32` and `3fff::/20`).
///
/// This property is defined in [IETF RFC 3849].
/// This property is defined by [IETF RFC 3849] and [IETF RFC 9637].
///
/// [IETF RFC 3849]: https://tools.ietf.org/html/rfc3849
/// [IETF RFC 9637]: https://tools.ietf.org/html/rfc9637
///
/// # Examples
///
Expand All @@ -1701,12 +1703,13 @@ impl Ipv6Addr {
///
/// assert_eq!(Ipv6Addr::new(0, 0, 0, 0, 0, 0xffff, 0xc00a, 0x2ff).is_documentation(), false);
/// assert_eq!(Ipv6Addr::new(0x2001, 0xdb8, 0, 0, 0, 0, 0, 0).is_documentation(), true);
/// assert_eq!(Ipv6Addr::new(0x3fff, 0, 0, 0, 0, 0, 0, 0).is_documentation(), true);
/// ```
#[unstable(feature = "ip", issue = "27709")]
#[must_use]
#[inline]
pub const fn is_documentation(&self) -> bool {
(self.segments()[0] == 0x2001) && (self.segments()[1] == 0xdb8)
matches!(self.segments(), [0x2001, 0xdb8, ..] | [0x3fff, 0..=0x0fff, ..])
}

/// Returns [`true`] if this is an address reserved for benchmarking (`2001:2::/48`).
Expand Down
10 changes: 10 additions & 0 deletions library/core/tests/net/ip_addr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,7 @@ fn ip_properties() {
check!("ff08::", global | multicast);
check!("ff0e::", global | multicast);
check!("2001:db8:85a3::8a2e:370:7334", doc);
check!("3fff:fff:ffff:ffff:ffff:ffff:ffff:ffff", doc);
check!("2001:2::ac32:23ff:21", benchmarking);
check!("102:304:506:708:90a:b0c:d0e:f10", global);
}
Expand Down Expand Up @@ -790,6 +791,15 @@ fn ipv6_properties() {
documentation
);

check!(
"3fff:fff:ffff:ffff:ffff:ffff:ffff:ffff",
&[
0x3f, 0xff, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff
],
documentation
);

check!(
"2001:2::ac32:23ff:21",
&[0x20, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0xac, 0x32, 0x23, 0xff, 0, 0x21],
Expand Down
5 changes: 2 additions & 3 deletions src/tools/miri/tests/fail/intrinsics/copy_overlapping.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
#![feature(intrinsics)]

// Directly call intrinsic to avoid debug assertions in libstd
extern "rust-intrinsic" {
fn copy_nonoverlapping<T>(src: *const T, dst: *mut T, count: usize);
}
#[rustc_intrinsic]
unsafe fn copy_nonoverlapping<T>(_src: *const T, _dst: *mut T, _count: usize);

fn main() {
let mut data = [0u8; 16];
Expand Down
5 changes: 2 additions & 3 deletions src/tools/miri/tests/fail/intrinsics/copy_unaligned.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
#![feature(intrinsics)]

// Directly call intrinsic to avoid debug assertions in libstd
extern "rust-intrinsic" {
fn copy_nonoverlapping<T>(src: *const T, dst: *mut T, count: usize);
}
#[rustc_intrinsic]
unsafe fn copy_nonoverlapping<T>(_src: *const T, _dst: *mut T, _count: usize);

fn main() {
let mut data = [0u16; 8];
Expand Down
5 changes: 2 additions & 3 deletions src/tools/miri/tests/fail/intrinsics/ctlz_nonzero.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
#![feature(intrinsics)]

mod rusti {
extern "rust-intrinsic" {
pub fn ctlz_nonzero<T>(x: T) -> u32;
}
#[rustc_intrinsic]
pub unsafe fn ctlz_nonzero<T>(_x: T) -> u32;
}

pub fn main() {
Expand Down
Loading
Loading