Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
1ea6cd7
Add std::ffi::c_str modules
clarfonthey Aug 19, 2023
70639c8
Fixing shellcheck comments on lvi test script
raoulstrackx Feb 27, 2024
3e675bd
add myself to rotation
fee1-dead Feb 29, 2024
c3954b3
Add a tidy check that checks whether the fluent slugs only appear once
mu001999 Mar 2, 2024
d88c7ff
Remove unused fluent messages
mu001999 Mar 2, 2024
9da004e
Dynamically size sigaltstk in std
workingjubilee Jul 10, 2023
c7a48a5
Revert back to Git-for-Windows for MinGW CI builds
majaha Mar 7, 2024
1195518
Helper function for resolve_path
kornelski Mar 1, 2024
25ab1c7
Suggest correct path in include_bytes!
kornelski Mar 1, 2024
7843e46
Factor out non-branch-related pattern data
Nadrieril Mar 9, 2024
594cf1d
review
Nadrieril Mar 9, 2024
2dd05e8
Error on invalid compiletest directives in Rust test files
jieyouxu Feb 24, 2024
046c28f
Fix invalid compiletest directives in tests
jieyouxu Feb 24, 2024
ff1459a
Add test to check unused_lifetimes don't duplicate "parameter is neve…
jieyouxu Mar 9, 2024
282db10
Rollup merge of #112136 - clarfonthey:ffi-c_str, r=cuviper
workingjubilee Mar 10, 2024
f946939
Rollup merge of #113525 - workingjubilee:handle-dynamic-minsigstksz, …
workingjubilee Mar 10, 2024
b928e12
Rollup merge of #121561 - jieyouxu:compiletest-directive-typo-check, …
workingjubilee Mar 10, 2024
866fd3a
Rollup merge of #121685 - fortanix:raoul/shellcheck_on_lvi_test_scrip…
workingjubilee Mar 10, 2024
629d584
Rollup merge of #121833 - kornelski:parent_include, r=estebank
workingjubilee Mar 10, 2024
af83d27
Rollup merge of #121860 - mu001999:master, r=Nilstrieb
workingjubilee Mar 10, 2024
72054d9
Rollup merge of #122125 - majaha:mingw_ci_new, r=Mark-Simulacrum
workingjubilee Mar 10, 2024
9e9fd65
Rollup merge of #122221 - Nadrieril:patextradata, r=oli-obk
workingjubilee Mar 10, 2024
5824411
Rollup merge of #122251 - jieyouxu:unused-lifetimes-dedup-test, r=Nad…
workingjubilee Mar 10, 2024
5ba1ea5
Rollup merge of #122264 - fee1-dead-contrib:add, r=fee1-dead
workingjubilee Mar 10, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Helper function for resolve_path
  • Loading branch information
kornelski committed Mar 7, 2024
commit 1195518a5e59e6d37c78db24c637780d2c662f3b
25 changes: 11 additions & 14 deletions compiler/rustc_expand/src/base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1233,21 +1233,18 @@ pub fn resolve_path(sess: &Session, path: impl Into<PathBuf>, span: Span) -> PRe
// after macro expansion (that is, they are unhygienic).
if !path.is_absolute() {
let callsite = span.source_callsite();
let mut result = match sess.source_map().span_to_filename(callsite) {
FileName::Real(name) => name
.into_local_path()
.expect("attempting to resolve a file path in an external file"),
FileName::DocTest(path, _) => path,
other => {
return Err(sess.dcx().create_err(errors::ResolveRelativePath {
span,
path: sess.source_map().filename_for_diagnostics(&other).to_string(),
}));
}
let source_map = sess.source_map();
let Some(mut base_path) = source_map.span_to_filename(callsite).into_local_path() else {
return Err(sess.dcx().create_err(errors::ResolveRelativePath {
span,
path: source_map
.filename_for_diagnostics(&source_map.span_to_filename(callsite))
.to_string(),
}));
};
result.pop();
result.push(path);
Ok(result)
base_path.pop();
base_path.push(path);
Ok(base_path)
} else {
Ok(path)
}
Expand Down
11 changes: 11 additions & 0 deletions compiler/rustc_span/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,17 @@ impl FileName {
src.hash(&mut hasher);
FileName::InlineAsm(hasher.finish())
}

/// Returns the path suitable for reading from the file system on the local host,
/// if this information exists.
/// Avoid embedding this in build artifacts; see `remapped_path_if_available()` for that.
pub fn into_local_path(self) -> Option<PathBuf> {
match self {
FileName::Real(path) => path.into_local_path(),
FileName::DocTest(path, _) => Some(path),
_ => None,
}
}
}

/// Represents a span.
Expand Down